commit a9fe9c68f4da944c9ae03062668250f7d9966dc8 Author: Salvatore La Manna Date: Mon Jan 9 16:00:17 2023 +0100 Primo commit diff --git a/.ant-targets-build.xml b/.ant-targets-build.xml new file mode 100644 index 0000000..e6562d9 --- /dev/null +++ b/.ant-targets-build.xml @@ -0,0 +1,52 @@ +all +build-common.format-javadoc +build-common.setup-eclipse +build-css +build-db +build-service +build-summary +build-upgrade-table +build-wsdl +build-xsd +clean +compile +compile-jsp +compile-test +create +deploy +direct-deploy +direct-deploy-ext-cmd +direct-deploy-hook-cmd +direct-deploy-layouttpl-cmd +direct-deploy-portlet-cmd +direct-deploy-theme-cmd +direct-deploy-web-cmd +ear +extract-plugins-sdk +format-javadoc +format-source +jar +jar-javadoc +jar-source +javadoc +prepare-upgrade-table +print-current-time +print-stale-snapshot +publish +publish-local-m2-release +publish-local-m2-snapshot +publish-remote-m2-release +publish-remote-m2-snapshot +release +run-cpd +run-pmd +setup-arquillian +setup-eclipse +setup-jrebel +sort-xml-attributes +test +test-integration +test-unit +war +watch +zip-portal diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..92856e1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +*.class +*.war +sicilia-*.jar +**/classes/ +**/.sass-cache/ +**/.ivy/cache/ +**/tmp/ +**/build/ +.DS_Store +._* diff --git a/.ivy/ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar b/.ivy/ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar new file mode 100644 index 0000000..4d15fc7 Binary files /dev/null and b/.ivy/ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar differ diff --git a/.project b/.project new file mode 100644 index 0000000..29a7055 --- /dev/null +++ b/.project @@ -0,0 +1,8 @@ + + + login-hook + + + + + diff --git a/CONTRIBUTING.markdown b/CONTRIBUTING.markdown new file mode 100644 index 0000000..178bef2 --- /dev/null +++ b/CONTRIBUTING.markdown @@ -0,0 +1,28 @@ +# How to Contribute + +Liferay is developed by its community consisting of Liferay users, enthusiasts, +employees, customers, partners, and others. We strongly encourage you to +contribute to Liferay's open source projects by implementing new features, +enhancing existing features, and fixing bugs. We also welcome your participation +in our forums, writing documentation, and translating existing documentation. + +Liferay is known for its innovative top quality features. To maintain this +reputation, all code changes are reviewed by a core set of Liferay project +maintainers. We encourage you to introduce yourself to the [core +maintainer(s)](https://issues.liferay.com/browse/LPS#selectedTab=com.atlassian.jira.plugin.system.project%3Acomponents-panel) +and engage them as you contribute to the areas they maintain. + +As you have ideas for features you want to implement, follow the contribution +steps outlined in the [CONTRIBUTING +guide](https://github.com/liferay/liferay-portal/blob/master/CONTRIBUTING.markdown) +found in the [liferay-portal](https://github.com/liferay/liferay-portal) +repository. This guide contains details on how to contribute to Liferay and +additional useful resource links. For more details on specific steps, and to get +a deeper understanding of Liferay in general, make sure to read Liferay's +official [User +Guide](http://www.liferay.com/documentation/liferay-portal/6.1/user-guide) and +[Development +Guide](http://www.liferay.com/documentation/liferay-portal/6.1/development). +These guides contain extensive explanations, examples, and reference material +for you to consult time and time again. + diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..040a61a --- /dev/null +++ b/README.markdown @@ -0,0 +1,139 @@ +# Liferay Plugins + +The liferay-plugins repository is part of the Liferay Portal project. [Liferay +Portal](http://www.liferay.com/community/liferay-projects/liferay-portal) is an +open source enterprise web platform for building business solutions that deliver +immediate results and long-term value. Liferay Portal started out as a personal +development project in 2000 and was open sourced in 2001. + +To get started, check out the project's community homepage at +[http://liferay.org](http://liferay.org)! + +Most of the plugins found in the liferay-plugins repository can be easily +installed on Liferay Portal via [Liferay +Marketplace](http://liferay.com/marketplace). To build one or more of the +plugins yourself, read below for details. + +## Source Code + +Liferay's main source code resides in two repositories: +[liferay-portal](https://github.com/liferay/liferay-portal) and +[liferay-plugins](https://github.com/liferay/liferay-plugins). Liferay has +additional repositories for the following: + +* [AlloyUI](https://github.com/liferay/alloy-ui) +* [Documentation](https://github.com/liferay/liferay-docs) +* [Git Tools](https://github.com/liferay/git-tools) +* [Liferay Faces](https://github.com/liferay/liferay-faces) +* [Liferay IDE](https://github.com/liferay/liferay-ide) +* [Maven Support](https://github.com/liferay/liferay-maven-support) + +Liferay Portal *releases* are built from the liferay-portal repository and +include select plugins from the liferay-plugins repository. You can build +Liferay Portal, its plugins, and/or any of the other supporting technologies +from their respective repositories. + +For more information on building liferay-portal, see the [README +file](https://github.com/liferay/liferay-portal/blob/master/README.markdown) in +the liferay-portal repository. + +## Quick Start + +In the [liferay-plugins](https://github.com/liferay/liferay-plugins) repository, +plugins are laid out in a software development kit (SDK) -- the Liferay Plugins +SDK. All Liferay plugin types, including portlets, themes, layout templates, +hooks, and EXT plugins, can be created and maintained in the SDK. [The Plugins +SDK](http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/the-plugins-s-3) +chapter of Liferay's [Development +Guide](http://www.liferay.com/documentation/liferay-portal/6.1/development) +explains how to create, build, and deploy your plugins. Follow the instructions +in this section to build and deploy any of the existing SDK plugins quickly. + +For demonstration purposes, let's pretend your user name is *joe* and you have a +Liferay instance bundled with Apache Tomcat running in your `/home/joe/` +directory. + +1. Fork the [liferay-plugins](https://github.com/liferay/liferay-plugins) +repository. + +2. Clone your fork of the repository. +3. Create a `build.${username}.properties` file in the root directory of your +liferay-plugins repository clone. Be sure to replace `${username}` with your +user name. + + /home/joe/liferay-plugins/build.joe.properties + + Note, to determine your user name, execute `echo %USERNAME%` on Windows or + `whoami` on Unix/Linux. + +4. In your `build.${username}.properties` file, specify the +`app.server.parent.dir` property set to the parent path of your app server. + + app.server.parent.dir=/home/joe/liferay-portal-6.1.1-ga2 + + Use your `build.${username}.properties` file to specify any additional + properties you wish to override from the base `build.properties` file; do + not modify the base file. + +5. Navigate to the directory of a plugin (e.g. *Sample JSP Portlet*) and deploy +it using Ant. + + cd /home/joe/liferay-plugins/portlets/sample-jsp-portlet + ant deploy + + The plugin compiles, its WAR file is built to the plugin's `dist` directory, + the WAR file is copied to your Liferay *Hot Deploy* directory, and the + plugin is deployed immediately. It's just that easy! + +There are many other options for developing new Liferay plugins using the +Plugins SDK. Consult the [Liferay Development +Guide](http://www.liferay.com/documentation/liferay-portal/6.1/development) for +indispensable explanations, examples, and reference material on the Liferay +Plugins SDK and surrounding technologies. + +Also, check out Liferay IDE. The [Liferay IDE +project](http://www.liferay.com/community/liferay-projects/liferay-ide) provides +an Eclipse-based Liferay development environment to help you build and maintain +Liferay projects easily. + +Finally, consider using Maven to build Liferay Plugins. For excellent overviews +of Maven support for Liferay, check out [Mika Koivisto's +presentation](http://www.slideshare.net/koivimik/developing-liferay-plugins-with-maven) +and [Getting Started with Liferay Maven +SDK](http://www.liferay.com/web/mika.koivisto/blog/-/blogs/12322618). + +## Contributing + +Liferay welcomes any and all contributions! If you have an idea for a new plugin +or a new feature in an existing plugin, and wish to implement it, follow the +contribution steps outlined in the [CONTRIBUTING +guide](https://github.com/liferay/liferay-portal/blob/master/CONTRIBUTING.markdown). +It explains how to contribute to Liferay and contains links to additional useful +resources. + +## More Information + +For more information about filing bugs, staying updated with Liferay on social +media, and other ways to participate, check out the [Liferay Community +Homepage](http://liferay.org) and consult the [README +file](https://github.com/liferay/liferay-portal/blob/master/README.markdown) in +the liferay-portal repository. + +## Liferay Portal Community Edition License + +This library, *Liferay Portal Community Edition*, is free software ("Licensed +Software"); you can redistribute it and/or modify it under the terms of the [GNU +Lesser General Public License](http://www.gnu.org/licenses/lgpl-2.1.html) as +published by the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This library is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; including but not limited to, the implied warranty of MERCHANTABILITY, +NONINFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +Public License for more details. + +You should have received a copy of the [GNU Lesser General Public +License](http://www.gnu.org/licenses/lgpl-2.1.html) along with this library; if +not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth +Floor, Boston, MA 02110-1301 USA + diff --git a/apps/build.xml b/apps/build.xml new file mode 100644 index 0000000..9b6f6e4 --- /dev/null +++ b/apps/build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/apps/plugins-inspector.log.test-broken b/apps/plugins-inspector.log.test-broken new file mode 100644 index 0000000..72c649e --- /dev/null +++ b/apps/plugins-inspector.log.test-broken @@ -0,0 +1,14 @@ +build.xml is nonstandard. +Unable to clean all plugins. +Unable to compile all plugins. +Module /Users/brian/dev/projects/github/liferay-plugins-ee-6.2.x/apps/test-broken/test-broken-portlet must not have both a "docroot" and a "src" directory. +/Users/brian/dev/projects/github/liferay-plugins-ee-6.2.x/apps/test-broken/test-broken-portlet/docroot/WEB-INF/liferay-hook.xml has an nonstandard language-properties element. +/Users/brian/dev/projects/github/liferay-plugins-ee-6.2.x/apps/test-broken/test-broken-portlet/docroot/WEB-INF/liferay-hook.xml has a nonstandard custom-jsp-dir element. +/Users/brian/dev/projects/github/liferay-plugins-ee-6.2.x/apps/test-broken/test-broken-portlet/docroot/WEB-INF/web.xml contains generated code. +/Users/brian/dev/projects/github/liferay-plugins-ee-6.2.x/apps/test-broken/test-broken-portlet/docroot/WEB-INF/lib must not be checked into source control. +/Users/brian/dev/projects/github/liferay-plugins-ee-6.2.x/apps/test-broken/test-broken-portlet/docroot/WEB-INF/tld must not be checked into source control. +/Users/brian/dev/projects/github/liferay-plugins-ee-6.2.x/apps/test-broken/test-broken-portlet/lib must not be checked into source control. +Module /Users/brian/dev/projects/github/liferay-plugins-ee-6.2.x/apps/test-broken/test-empty-portlet must have a "docroot" or a "src" directory. +/Users/brian/dev/projects/github/liferay-plugins-ee-6.2.x/apps/test-broken/test-empty-portlet/ivy.xml.MD5 must not be checked into source control. +Plugins must not have custom .gitignore files. +Plugins must not generate modified files. diff --git a/apps/test-broken/build.xml b/apps/test-broken/build.xml new file mode 100644 index 0000000..f3d2ac5 --- /dev/null +++ b/apps/test-broken/build.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/apps/test-broken/test-broken-portlet/build.xml b/apps/test-broken/test-broken-portlet/build.xml new file mode 100644 index 0000000..a6a060d --- /dev/null +++ b/apps/test-broken/test-broken-portlet/build.xml @@ -0,0 +1,13 @@ + + + + + + + + Hello world. + Hello world. + + + + \ No newline at end of file diff --git a/apps/test-broken/test-broken-portlet/docroot/WEB-INF/lib/commons-logging.jar b/apps/test-broken/test-broken-portlet/docroot/WEB-INF/lib/commons-logging.jar new file mode 100644 index 0000000..8758a96 Binary files /dev/null and b/apps/test-broken/test-broken-portlet/docroot/WEB-INF/lib/commons-logging.jar differ diff --git a/apps/test-broken/test-broken-portlet/docroot/WEB-INF/liferay-hook.xml b/apps/test-broken/test-broken-portlet/docroot/WEB-INF/liferay-hook.xml new file mode 100644 index 0000000..06d3b73 --- /dev/null +++ b/apps/test-broken/test-broken-portlet/docroot/WEB-INF/liferay-hook.xml @@ -0,0 +1,7 @@ + + + + + resources/Language*.properties + /META-INF/custom-jsps + \ No newline at end of file diff --git a/apps/test-broken/test-broken-portlet/docroot/WEB-INF/tld/c.tld b/apps/test-broken/test-broken-portlet/docroot/WEB-INF/tld/c.tld new file mode 100644 index 0000000..98efa6a --- /dev/null +++ b/apps/test-broken/test-broken-portlet/docroot/WEB-INF/tld/c.tld @@ -0,0 +1,572 @@ + + + + + JSTL 1.2 core library + JSTL core + 1.2 + c + http://java.sun.com/jsp/jstl/core + + + + Provides core validation features for JSTL tags. + + + org.apache.taglibs.standard.tlv.JstlCoreTLV + + + + + + Catches any Throwable that occurs in its body and optionally + exposes it. + + catch + org.apache.taglibs.standard.tag.common.core.CatchTag + JSP + + +Name of the exported scoped variable for the +exception thrown from a nested action. The type of the +scoped variable is the type of the exception thrown. + + var + false + false + + + + + + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + + choose + com.liferay.taglib.core.ChooseTag + JSP + + + + + Simple conditional tag, which evalutes its body if the + supplied condition is true and optionally exposes a Boolean + scripting variable representing the evaluation of this condition + + if + com.liferay.taglib.core.IfTag + JSP + + +The test condition that determines whether or +not the body content should be processed. + + test + true + true + boolean + + + +Name of the exported scoped variable for the +resulting value of the test condition. The type +of the scoped variable is Boolean. + + var + false + false + + + +Scope for var. + + scope + false + false + + + + + + Retrieves an absolute or relative URL and exposes its contents + to either the page, a String in 'var', or a Reader in 'varReader'. + + import + org.apache.taglibs.standard.tag.rt.core.ImportTag + org.apache.taglibs.standard.tei.ImportTEI + JSP + + +The URL of the resource to import. + + url + true + true + + + +Name of the exported scoped variable for the +resource's content. The type of the scoped +variable is String. + + var + false + false + + + +Scope for var. + + scope + false + false + + + +Name of the exported scoped variable for the +resource's content. The type of the scoped +variable is Reader. + + varReader + false + false + + + +Name of the context when accessing a relative +URL resource that belongs to a foreign +context. + + context + false + true + + + +Character encoding of the content at the input +resource. + + charEncoding + false + true + + + + + + The basic iteration tag, accepting many different + collection types and supporting subsetting and other + functionality + + forEach + org.apache.taglibs.standard.tag.rt.core.ForEachTag + org.apache.taglibs.standard.tei.ForEachTEI + JSP + + +Collection of items to iterate over. + + items + false + true + java.lang.Object + + java.lang.Object + + + + +If items specified: +Iteration begins at the item located at the +specified index. First item of the collection has +index 0. +If items not specified: +Iteration begins with index set at the value +specified. + + begin + false + true + int + + + +If items specified: +Iteration ends at the item located at the +specified index (inclusive). +If items not specified: +Iteration ends when index reaches the value +specified. + + end + false + true + int + + + +Iteration will only process every step items of +the collection, starting with the first one. + + step + false + true + int + + + +Name of the exported scoped variable for the +current item of the iteration. This scoped +variable has nested visibility. Its type depends +on the object of the underlying collection. + + var + false + false + + + +Name of the exported scoped variable for the +status of the iteration. Object exported is of type +javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested +visibility. + + varStatus + false + false + + + + + + Iterates over tokens, separated by the supplied delimeters + + forTokens + org.apache.taglibs.standard.tag.rt.core.ForTokensTag + JSP + + +String of tokens to iterate over. + + items + true + true + java.lang.String + + java.lang.String + + + + +The set of delimiters (the characters that +separate the tokens in the string). + + delims + true + true + java.lang.String + + + +Iteration begins at the token located at the +specified index. First token has index 0. + + begin + false + true + int + + + +Iteration ends at the token located at the +specified index (inclusive). + + end + false + true + int + + + +Iteration will only process every step tokens +of the string, starting with the first one. + + step + false + true + int + + + +Name of the exported scoped variable for the +current item of the iteration. This scoped +variable has nested visibility. + + var + false + false + + + +Name of the exported scoped variable for the +status of the iteration. Object exported is of +type +javax.servlet.jsp.jstl.core.LoopTag +Status. This scoped variable has nested +visibility. + + varStatus + false + false + + + + + + Like <%= ... >, but for expressions. + + out + org.apache.taglibs.standard.tag.rt.core.OutTag + JSP + + +Expression to be evaluated. + + value + true + true + + + +Default value if the resulting value is null. + + default + false + true + + + +Determines whether characters <,>,&,'," in the +resulting string should be converted to their +corresponding character entity codes. Default value is +true. + + escapeXml + false + true + + + + + + + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + + otherwise + com.liferay.taglib.core.OtherwiseTag + JSP + + + + + Adds a parameter to a containing 'import' tag's URL. + + param + org.apache.taglibs.standard.tag.rt.core.ParamTag + JSP + + +Name of the query string parameter. + + name + true + true + + + +Value of the parameter. + + value + false + true + + + + + + Redirects to a new URL. + + redirect + org.apache.taglibs.standard.tag.rt.core.RedirectTag + JSP + + +The URL of the resource to redirect to. + + url + false + true + + + +Name of the context when redirecting to a relative URL +resource that belongs to a foreign context. + + context + false + true + + + + + + Removes a scoped variable (from a particular scope, if specified). + + remove + org.apache.taglibs.standard.tag.common.core.RemoveTag + empty + + +Name of the scoped variable to be removed. + + var + true + false + + + +Scope for var. + + scope + false + false + + + + + + Sets the result of an expression evaluation in a 'scope' + + set + org.apache.taglibs.standard.tag.rt.core.SetTag + JSP + + +Name of the exported scoped variable to hold the value +specified in the action. The type of the scoped variable is +whatever type the value expression evaluates to. + + var + false + false + + + +Expression to be evaluated. + + value + false + true + + java.lang.Object + + + + +Target object whose property will be set. Must evaluate to +a JavaBeans object with setter property property, or to a +java.util.Map object. + + target + false + true + + + +Name of the property to be set in the target object. + + property + false + true + + + +Scope for var. + + scope + false + false + + + + + + Creates a URL with optional query parameters. + + url + org.apache.taglibs.standard.tag.rt.core.UrlTag + JSP + + +Name of the exported scoped variable for the +processed url. The type of the scoped variable is +String. + + var + false + false + + + +Scope for var. + + scope + false + false + + + +URL to be processed. + + value + false + true + + + +Name of the context when specifying a relative URL +resource that belongs to a foreign context. + + context + false + true + + + + + + Subtag of <choose> that includes its body if its + condition evalutes to 'true' + + when + com.liferay.taglib.core.WhenTag + JSP + + +The test condition that determines whether or not the +body content should be processed. + + test + true + true + boolean + + + + diff --git a/apps/test-broken/test-broken-portlet/docroot/WEB-INF/web.xml b/apps/test-broken/test-broken-portlet/docroot/WEB-INF/web.xml new file mode 100644 index 0000000..23cef3a --- /dev/null +++ b/apps/test-broken/test-broken-portlet/docroot/WEB-INF/web.xml @@ -0,0 +1,63 @@ + + + + test-partially-broken-portlet + + Invoker Filter - ERROR + com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter + + dispatcher + ERROR + + + + Invoker Filter - FORWARD + com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter + + dispatcher + FORWARD + + + + Invoker Filter - INCLUDE + com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter + + dispatcher + INCLUDE + + + + Invoker Filter - REQUEST + com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter + + dispatcher + REQUEST + + + + Invoker Filter - ERROR + /* + ERROR + + + Invoker Filter - FORWARD + /* + FORWARD + + + Invoker Filter - INCLUDE + /* + INCLUDE + + + Invoker Filter - REQUEST + /* + REQUEST + + + com.liferay.portal.kernel.servlet.PluginContextListener + + + com.liferay.portal.kernel.servlet.SerializableSessionAttributeListener + + \ No newline at end of file diff --git a/apps/test-broken/test-broken-portlet/lib/commons-logging.jar b/apps/test-broken/test-broken-portlet/lib/commons-logging.jar new file mode 100644 index 0000000..8758a96 Binary files /dev/null and b/apps/test-broken/test-broken-portlet/lib/commons-logging.jar differ diff --git a/apps/test-broken/test-broken-portlet/modified_file.txt b/apps/test-broken/test-broken-portlet/modified_file.txt new file mode 100644 index 0000000..e69de29 diff --git a/apps/test-broken/test-broken-portlet/src/com/liferay/test/Test.java b/apps/test-broken/test-broken-portlet/src/com/liferay/test/Test.java new file mode 100644 index 0000000..e69de29 diff --git a/apps/test-broken/test-empty-portlet/ivy.xml.MD5 b/apps/test-broken/test-empty-portlet/ivy.xml.MD5 new file mode 100644 index 0000000..db102c2 --- /dev/null +++ b/apps/test-broken/test-empty-portlet/ivy.xml.MD5 @@ -0,0 +1 @@ +3a1587eeafa8dc5f13f833811cdda85a \ No newline at end of file diff --git a/apps/test-working/build.xml b/apps/test-working/build.xml new file mode 100644 index 0000000..03bbb21 --- /dev/null +++ b/apps/test-working/build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/build-common-ivy.xml b/build-common-ivy.xml new file mode 100644 index 0000000..bf7418f --- /dev/null +++ b/build-common-ivy.xml @@ -0,0 +1,794 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +module.snapshot.git.id=${git.commit.module.log} +module.snapshot.url=${cdn.sonatype.url}/com/liferay/${bnd.Bundle-SymbolicName}/${bnd.Bundle-Version}-SNAPSHOT/${bnd.Bundle-SymbolicName}-${bnd.Bundle-Version}-${snapshot.tstamp}.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build-common-osgi-plugin.xml b/build-common-osgi-plugin.xml new file mode 100644 index 0000000..dae9b0d --- /dev/null +++ b/build-common-osgi-plugin.xml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/build-common-plugin.xml b/build-common-plugin.xml new file mode 100644 index 0000000..5e167da --- /dev/null +++ b/build-common-plugin.xml @@ -0,0 +1,950 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${build-service.output} + + + + + Service Builder generated exceptions. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Compiling JSPs with ${app.server.type} is not supported. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${jspc.output} + + + + + + + JSPs failed to compile. + + + + + + + + + + + + + + + + + + + + + + + JSPs failed to compile. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${build-wsdd.output} + + + + + WSDD Builder generated exceptions. + + + + + + + + + Bundle-SymbolicName: ${bnd.Bundle-SymbolicName}.wsdd +Bundle-Name: ${bnd.Bundle-Name} WSDD descriptors +Bundle-Version: ${bnd.Bundle-Version} +Fragment-Host: ${bnd.Bundle-SymbolicName} +Import-Package: javax.servlet,javax.servlet.http +Include-Resource: WEB-INF/=server-config.wsdd,classes;filter:=*.wsdd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Applying patch @{patch.file}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Use "ant test-class-group -Dtest.class.group.index=0". + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Use "ant test-package -Dtest.package=com.liferay.portal.kernel.util". + + + + + + + + + + diff --git a/build-common-plugins-inspector.xml b/build-common-plugins-inspector.xml new file mode 100644 index 0000000..2f5f907 --- /dev/null +++ b/build-common-plugins-inspector.xml @@ -0,0 +1,233 @@ + + + + + + + + + @{message}${line.separator} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /*/bin +/*/classes +/*/ivy.xml.MD5 +/*/javadoc +/*/lib +/*/test-classes +/*/test-results + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${plugins-inspector.log.content} + + Plugins inspector is not detecting all errors. Expected "${plugins-inspector.log.expected.checksum}" but found "${plugins-inspector.log.actual.checksum}". + + + + + + + + + + ${plugins-inspector.log.content} + + Plugins inspector is not detecting false errors. + + + + + + + + + ${plugins-inspector.log.content} + + Plugins inspector detected errors. + + + + + + + + + + + \ No newline at end of file diff --git a/build-common-plugins.xml b/build-common-plugins.xml new file mode 100644 index 0000000..1adf5f1 --- /dev/null +++ b/build-common-plugins.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build-common.xml b/build-common.xml new file mode 100644 index 0000000..53b5fb7 --- /dev/null +++ b/build-common.xml @@ -0,0 +1,3535 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Please use Ant 1.8.0 or above. + + + + + + + + + + + + + + + + + +. + +Task cannot continue because ECJ is not installed. + +ECJ was automatically installed. Please rerun your task. + + + + + + + + + + + + + + +. + +Task cannot continue because Error-Prone is not installed. + +Error-Prone was automatically installed. Please rerun your task. + + + + + + + + + + + + + + + + + + + + + ${build-css.output} + + + + + Sass to CSS Builder generated exceptions. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Custom javac source ${javac.source} + + + + + + + + + + + Custom javac target ${javac.target} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +. + +Detected inclusion of portal-impl.jar in WEB-INF/lib. + +portal-impl.jar is designed with a large number of singleton classes which are +instantiated on the basis that they will exist alone in the application server. + +While compile time issues may be resolved, portlets cannot be made to work by +simply adding portal-impl.jar, because doing so violates the above assumption, +and the resulting problems will be extremely difficult to debug. + +Please find a solution that does not require portal-impl.jar. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Unable to automatically update web.xml in ${plugin.file}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @{module.dir} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${pmd.java.ruleset} + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${jmx.remote.port} + ${app.server.tomcat.manager.password} + ${app.server.tomcat.manager.user} + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Use "ant test-class -Dtest.class=StringUtilTest". + + + + + + + Test class ${test.class} cannot be found. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> + +<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %> + +<%@ page import="com.liferay.portal.model.Portlet" %> +<%@ page import="com.liferay.portal.service.PortletLocalServiceUtil" %> + +<%@ page import="java.util.Set" %> + + + +<% +Portlet portlet = PortletLocalServiceUtil.getPortletById(portletDisplay.getId()); + +Set paths = application.getResourcePaths("/WEB-INF/jsp/" + portlet.getFriendlyURLMapping() + "/controllers/"); + +for (String path : paths) { + int x = path.lastIndexOf("/"); + int y = path.indexOf("_controller.jsp"); + + if (y == -1) { + continue; + } + + String controller = path.substring(x + 1, y); +%> + + + + + + + + +<% +} +%>]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + screenshot.png does not exist. + + + + + + + + + thumbnail.png does not exist. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Please set the property "upgrade.table.dir" before running this task. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This task must be called by the create script. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + ]]> + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Detected a modification in ${watch.sources.path}. + + + + Deploying ${watch.deploy.path}. + + + + + + + + Finished deployment. Watching for additional modifications. + + + + + diff --git a/build.properties b/build.properties new file mode 100644 index 0000000..384f3ed --- /dev/null +++ b/build.properties @@ -0,0 +1,544 @@ +## +## DO NOT EDIT THIS FILE. +## +## To update the properties of this file, create a separate properties file +## named "build.${user.name}.properties" with the properties to overwrite. +## + +## +## Application Server +## + + # + # Specify the application server type. + # + #app.server.type=geronimo + #app.server.type=glassfish + #app.server.type=jboss + #app.server.type=jetty + #app.server.type=jonas + #app.server.type=resin + app.server.type=tomcat + #app.server.type=weblogic + #app.server.type=websphere + #app.server.type=wildfly + + # + # Specify the application server parent directory. + # + app.server.parent.dir=${sdk.dir}/../bundles + + # + # Specify the paths to an unzipped Geronimo bundle. + # + app.server.geronimo.dir=${app.server.parent.dir}/geronimo-2.2.1 + app.server.geronimo.deploy.dir=${app.server.geronimo.dir}/deploy + app.server.geronimo.lib.global.dir=${app.server.geronimo.dir}/var/shared/lib + app.server.geronimo.portal.dir=${app.server.geronimo.dir}/deploy/liferay-portal + + # + # Specify the paths to an unzipped Glassfish bundle. + # + app.server.glassfish.dir=${app.server.parent.dir}/glassfish-3.1.2.2 + app.server.glassfish.deploy.dir=${app.server.glassfish.dir}/autodeploy + app.server.glassfish.lib.global.dir=${app.server.glassfish.dir}/domains/domain1/lib + app.server.glassfish.portal.dir=${app.server.glassfish.dir}/domains/domain1/applications/liferay-portal + + # + # Specify the paths to an unzipped JBoss bundle. + # + app.server.jboss.dir=${app.server.parent.dir}/jboss-eap-6.1.0 + app.server.jboss.deploy.dir=${app.server.jboss.dir}/standalone/deployments + app.server.jboss.lib.global.dir=${app.server.jboss.dir}/modules/com/liferay/portal/main + app.server.jboss.portal.dir=${app.server.jboss.dir}/standalone/deployments/ROOT.war + + # + # Specify the paths to an unzipped Jetty bundle. + # + app.server.jetty.dir=${app.server.parent.dir}/jetty-8.1.10 + app.server.jetty.deploy.dir=${app.server.jetty.dir}/webapps + app.server.jetty.lib.global.dir=${app.server.jetty.dir}/lib/ext/liferay + app.server.jetty.portal.dir=${app.server.jetty.dir}/webapps/root + + # + # Specify the paths to an unzipped JOnAS bundle. + # + app.server.jonas.dir=${app.server.parent.dir}/jonas-5.2.3 + app.server.jonas.deploy.dir=${app.server.jonas.dir}/deploy + app.server.jonas.lib.global.dir=${app.server.jonas.dir}/lib/ext + app.server.jonas.portal.dir=${app.server.jonas.dir}/deploy/liferay-portal + + # + # Specify the paths to an unzipped Resin bundle. + # + app.server.resin.dir=${app.server.parent.dir}/resin-4.0.44 + app.server.resin.deploy.dir=${app.server.resin.dir}/webapps + app.server.resin.lib.global.dir=${app.server.resin.dir}/ext-lib + app.server.resin.portal.dir=${app.server.resin.dir}/webapps/ROOT + + # + # Specify the paths to an unzipped tc Server bundle. + # + app.server.tcserver.dir=${app.server.parent.dir}/tc-server-2.6.4 + app.server.tcserver.deploy.dir=${app.server.tcserver.dir}/liferay/webapps + app.server.tcserver.lib.global.dir=${app.server.tcserver.dir}/liferay/lib + app.server.tcserver.portal.dir=${app.server.tcserver.dir}/liferay/webapps/ROOT + + # + # Specify the paths to an unzipped Tomcat bundle. + # + app.server.tomcat.dir=${app.server.parent.dir}/tomcat-7.0.62 + app.server.tomcat.deploy.dir=${app.server.tomcat.dir}/webapps + app.server.tomcat.lib.global.dir=${app.server.tomcat.dir}/lib/ext + app.server.tomcat.manager.user=tomcat + app.server.tomcat.manager.password=tomcat + app.server.tomcat.portal.dir=${app.server.tomcat.dir}/webapps/ROOT + + # + # Specify the paths to a WebLogic domain with Liferay installed. + # + app.server.weblogic.dir=${app.server.parent.dir}/weblogic-12.1.3 + app.server.weblogic.deploy.dir=${app.server.weblogic.dir}/domains/liferay/autodeploy + app.server.weblogic.lib.global.dir=${app.server.weblogic.dir}/domains/liferay/lib + app.server.weblogic.portal.dir=${app.server.weblogic.dir}/domains/liferay/autodeploy/ROOT + + # + # Specify the paths to a WebSphere profile with Liferay installed. + # + app.server.websphere.dir=${app.server.parent.dir}/websphere-7.0 + app.server.websphere.deploy.dir=${app.server.websphere.dir}/profiles/liferay/wsadmin-deploy + app.server.websphere.lib.global.dir=${app.server.websphere.dir}/lib/ext + app.server.websphere.portal.dir=${app.server.websphere.dir}/profiles/liferay/installedApps/liferay-cell/liferay-portal.ear/liferay-portal.war + + # + # Specify the paths to an unzipped JBoss AS bundle. + # + app.server.wildfly.dir=${app.server.parent.dir}/jboss-7.1.1 + app.server.wildfly.deploy.dir=${app.server.wildfly.dir}/standalone/deployments + app.server.wildfly.lib.global.dir=${app.server.wildfly.dir}/modules/com/liferay/portal/main + app.server.wildfly.portal.dir=${app.server.wildfly.dir}/standalone/deployments/ROOT.war + +## +## Auto Deploy +## + + # + # Plugins will be deployed to this directory. Make sure that Liferay is + # also set to scan this directory. + # + auto.deploy.dir=${app.server.parent.dir}/deploy + + # + # Set this to true if deployed WARs are unpacked. Set this to false your + # application server has concurrency issues with deploying large WARs. + # + auto.deploy.unpack.war=true + + # + # Set this to true if you want the deployer to rename portlet.xml to + # portlet-custom.xml. This is only needed when deploying the portal on + # WebSphere 6.1.x with a version before 6.1.0.7 because WebSphere's portlet + # container will try to process a portlet at the same time that Liferay is + # trying to process a portlet. + # + auto.deploy.custom.portlet.xml=false + +## +## Baseline JAR +## + + baseline.jar.bnddir.name=.bnd + + baseline.jar.report.level=diff + #baseline.jar.report.level=off + #baseline.jar.report.level=persist + #baseline.jar.report.level=standard + + baseline.jar.report.only.dirty.packages=true + + baseline.jar.reports.dir.name=baseline-reports + + -baseline= + -baselinerepo=localrepo + -fixupmessages: "While setting properties ...";is:=ignore + -jsp: *.jsp,*.jspf + -metatype: * + -plugin=\ + aQute.bnd.deployer.repository.LocalIndexedRepo;\ + local=${sdk.dir}/.bnd/localrepo;\ + name=localrepo;\ + phase=any;\ + type=R5,\ + aQute.bnd.deployer.repository.FixedIndexedRepo;\ + cache=${sdk.dir}/.bnd/remoterepo;\ + locations='http://obr.liferay.com/r5/liferay-portal/index.xml.gz';\ + name=remoterepo;\ + phase=any;\ + type=R5,\ + com.liferay.ant.bnd.bower.BowerAnalyzerPlugin,\ + com.liferay.ant.bnd.jsp.JspAnalyzerPlugin,\ + com.liferay.ant.bnd.sass.SassAnalyzerPlugin + -pluginpath=${sdk.dir}/osgi/lib/plugin/bnd-repository.jar + -releaserepo=localrepo + -sass: * + +## +## BND JSP Support +## + + # + # When creating bundles which contain JSPs, simply add ${bnd.jsp.support.imports} as + # part of the package imports in the bnd file. + # + bnd.jsp.support.imports=\ + ${bnd.jsp.support.imports.javax.el},\ + ${bnd.jsp.support.imports.javax.servlet},\ + ${bnd.jsp.support.imports.javax.servlet.jsp},\ + ${bnd.jsp.support.imports.javax.servlet.jsp.jstl},\ + ${bnd.jsp.support.imports.org.apache.jasper},\ + ${bnd.jsp.support.imports.org.apache.taglibs.standard},\ + ${bnd.jsp.support.imports.xml},\ + javax.tools + + bnd.jsp.support.imports.javax.el=\ + com.sun.el;version='${bnd.jsp.support.version.javax.el}',\ + com.sun.el.lang;version='${bnd.jsp.support.version.javax.el}',\ + com.sun.el.parser;version='${bnd.jsp.support.version.javax.el}',\ + com.sun.el.stream;version='${bnd.jsp.support.version.javax.el}',\ + com.sun.el.util;version='${bnd.jsp.support.version.javax.el}',\ + javax.el;version='${bnd.jsp.support.version.javax.el}' + + bnd.jsp.support.imports.javax.servlet=\ + javax.servlet;version='${bnd.jsp.support.version.javax.servlet}',\ + javax.servlet.annotation;version='${bnd.jsp.support.version.javax.servlet}',\ + javax.servlet.descriptor;version='${bnd.jsp.support.version.javax.servlet}',\ + javax.servlet.http;version='${bnd.jsp.support.version.javax.servlet}',\ + javax.servlet.resources + + bnd.jsp.support.imports.javax.servlet.jsp=\ + javax.servlet.jsp;version='${bnd.jsp.support.version.javax.servlet.jsp}',\ + javax.servlet.jsp.el;version='${bnd.jsp.support.version.javax.servlet.jsp}',\ + javax.servlet.jsp.tagext;version='${bnd.jsp.support.version.javax.servlet.jsp}' + + bnd.jsp.support.imports.javax.servlet.jsp.jstl=\ + javax.servlet.jsp.jstl.core;version='${bnd.jsp.support.version.javax.servlet.jsp.jstl}',\ + javax.servlet.jsp.jstl.fmt;version='${bnd.jsp.support.version.javax.servlet.jsp.jstl}',\ + javax.servlet.jsp.jstl.sql;version='${bnd.jsp.support.version.javax.servlet.jsp.jstl}',\ + javax.servlet.jsp.jstl.tlv;version='${bnd.jsp.support.version.javax.servlet.jsp.jstl}' + + bnd.jsp.support.imports.org.apache.jasper=\ + org.apache.jasper;version='${bnd.jsp.support.version.org.apache.jasper}',\ + org.apache.jasper.compiler;version='${bnd.jsp.support.version.org.apache.jasper}',\ + org.apache.jasper.compiler.tagplugin;version='${bnd.jsp.support.version.org.apache.jasper}',\ + org.apache.jasper.resources;version='${bnd.jsp.support.version.org.apache.jasper}',\ + org.apache.jasper.runtime;version='${bnd.jsp.support.version.org.apache.jasper}',\ + org.apache.jasper.security;version='${bnd.jsp.support.version.org.apache.jasper}',\ + org.apache.jasper.servlet;version='${bnd.jsp.support.version.org.apache.jasper}',\ + org.apache.jasper.tagplugins.jstl;version='${bnd.jsp.support.version.org.apache.jasper}',\ + org.apache.jasper.xmlparser;version='${bnd.jsp.support.version.org.apache.jasper}',\ + org.glassfish.jsp.api;version='${bnd.jsp.support.version.org.apache.jasper}' + + bnd.jsp.support.imports.org.apache.taglibs.standard=\ + org.apache.taglibs.standard;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.extra.spath;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.functions;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.lang.jstl;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.lang.jstl.parser;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.lang.jstl.test;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.lang.jstl.test.beans;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.lang.support;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.resources;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.common.core;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.common.fmt;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.common.sql;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.common.xml;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.el.core;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.el.fmt;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.el.sql;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.el.xml;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.rt.core;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.rt.fmt;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.rt.sql;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tag.rt.xml;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tei;version='${bnd.jsp.support.version.org.apache.taglibs.standard}',\ + org.apache.taglibs.standard.tlv;version='${bnd.jsp.support.version.org.apache.taglibs.standard}' + + bnd.jsp.support.imports.xml=\ + javax.xml.parsers,\ + javax.xml.transform,\ + javax.xml.transform.dom,\ + javax.xml.transform.stream,\ + javax.xml.validation,\ + org.w3c.dom,\ + org.w3c.dom.ls,\ + org.xml.sax,\ + org.xml.sax.ext,\ + org.xml.sax.helpers + + bnd.jsp.support.version.javax.el=[3.0.0,4.0) + bnd.jsp.support.version.javax.servlet=[2.6.0,4.0.0) + bnd.jsp.support.version.javax.servlet.jsp=[2.3.2,3.0) + bnd.jsp.support.version.javax.servlet.jsp.jstl=[1.2.1,2.0) + bnd.jsp.support.version.org.apache.jasper=[2.3.2,3.0) + bnd.jsp.support.version.org.apache.taglibs.standard=[1.2.3,2.0) + +## +## Clean +## + + clean.delete.ivy.md5=false + clean.delete.lib=false + +## +## Compiler +## + + ant.build.javac.source=1.7 + ant.build.javac.target=1.7 + + #javac.compiler=com.google.errorprone.ErrorProneAntCompilerAdapter + #javac.compiler=modern + javac.compiler=org.eclipse.jdt.core.JDTCompilerAdapter + + javac.debug=on + javac.deprecation=off + javac.encoding=UTF-8 + javac.nowarn=on + +## +## Database +## + + # + # Set the database name used by the SQL scripts. + # + database.name=lportal + + # + # Set the database server types to build SQL scripts for. + # + database.types=db2,derby,firebird,hypersonic,informix,ingres,interbase,jdatastore,mysql,oracle,postgresql,sap,sqlserver,sybase + #database.types=mysql + +## +## Extension Environment +## + + #ext.work.dir= + +## +## Ivy +## + + ivy.cache.ttl.default=eternal + ivy.custom.settings.file=${sdk.dir}/ivy-settings.xml + ivy.home=${sdk.dir}/.ivy + + #ivy.jar.url=http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar + ivy.jar.url=https://cdn.lfrs.sl/repository.liferay.com/nexus/content/repositories/liferay-public-snapshots/com/liferay/org.apache.ivy/${ivy.version}/org.apache.ivy-${ivy.version}.jar + + ivy.log.level=quiet + ivy.pom.developer.name=Brian Wing Shun Chan + ivy.pom.developer.organization=Liferay, Inc. + ivy.pom.developer.organizationUrl=http://www.liferay.com + ivy.pom.license.name=LGPL 2.1 + ivy.pom.license.url=http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt + ivy.pom.scm.connection=scm:git:git@github.com:liferay/liferay-plugins.git + ivy.pom.scm.developerConnection=scm:git:git@github.com:liferay/liferay-plugins.git + ivy.pom.scm.url=http://github.com/liferay/liferay-plugins + ivy.resolve.transitive.dependencies.test=true + ivy.resolve.transitive.dependencies=true + + #ivy.version=2.4.0 + ivy.version=2.4.0.LIFERAY-PATCHED-1-SNAPSHOT + +## +## JMX +## + + jmx.remote.port=8099 + +## +## JRebel +## + + # + # Set the directory that will be used to generate a plugin's JRebel + # configuraton file. Not specifying a directory means that the generated + # JRebel configuration file will be placed in a plugin's compiled classes + # output directory. This is also the directory that JRebel will use to look + # for updated classes. + # + #jrebel.plugin.classes.dir= + +## +## JUnit +## + + junit.debug.jpda=-agentlib:jdwp=transport=dt_socket,address=8001,server=y,suspend=y + + junit.halt.on.failure=false + junit.java.integration.gc=-Xms512m -Xmx512m -XX:MaxNewSize=32m -XX:MaxPermSize=200m -XX:MaxTenuringThreshold=0 -XX:NewSize=32m -XX:ParallelGCThreads=2 -XX:PermSize=200m -XX:SurvivorRatio=65536 -XX:TargetSurvivorRatio=0 -XX:-UseAdaptiveSizePolicy -XX:+UseParallelOldGC + junit.java.unit.gc=-Xms256m -Xmx256m -XX:MaxNewSize=32m -XX:MaxPermSize=64m -XX:MaxTenuringThreshold=0 -XX:NewSize=32m -XX:ParallelGCThreads=2 -XX:PermSize=64m -XX:SurvivorRatio=65536 -XX:TargetSurvivorRatio=0 -XX:-UseAdaptiveSizePolicy -XX:+UseParallelOldGC + junit.java.unit.gc.logging=off + junit.jvm=java + junit.test.excludes=(?!) + +## +## Libraries +## + + required.portal.jars=commons-logging.jar,log4j.jar,util-bridges.jar,util-java.jar,util-taglib.jar + +## +## Liferay Home +## + + liferay.home=${app.server.parent.dir}/.. + +## +## Mirrors +## + + mirrors.cache.dir=${user.home}/.liferay/mirrors + +## +## Module Framework +## + + # + # Set the directory which will form the base path of the module framework. + # + module.framework.base.dir=${liferay.home}/osgi + +## +## NodeJS +## + + nodejs.npm.url=http://nodejs.org/dist/npm/npm-${nodejs.npm.version}.zip + nodejs.npm.version=1.4.9 + + #nodejs.url= + + nodejs.url[linux32]=http://nodejs.org/dist/v${nodejs.version}/node-v${nodejs.version}-linux-x86.tar.gz + nodejs.url[linux64]=http://nodejs.org/dist/v${nodejs.version}/node-v${nodejs.version}-linux-x64.tar.gz + nodejs.url[osx32]=http://nodejs.org/dist/v${nodejs.version}/node-v${nodejs.version}-darwin-x86.tar.gz + nodejs.url[osx64]=http://nodejs.org/dist/v${nodejs.version}/node-v${nodejs.version}-darwin-x64.tar.gz + nodejs.url[windows32]=http://nodejs.org/dist/v${nodejs.version}/node.exe + nodejs.url[windows64]=http://nodejs.org/dist/v${nodejs.version}/x64/node.exe + + nodejs.version=0.10.35 + +## +## Operating Systems +## + + os.apple=Mac OS X + os.unix=Linux,FreeBSD,Solaris,SunOS + os.windows=Windows 95,Windows 98,Windows NT,Windows 2000,Windows 2003,Windows XP,Windows Vista,Windows 7 + +## +## PGP +## + + pgp.generator= + pgp.keyname=auto + pgp.passphrase= + +## +## Plugins +## + + # + # Set the excludes and includes attributes. These attributes are read when + # you run "ant" from the hooks, layouttpl, portlets, shared, themes, or webs + # directory. By default, the ant task will go through every subdirectory. + # Setting these attributes can limit it to just the plugins you're working + # on. + # + plugins.excludes=modules-admin-portlet + plugins.includes=* + + # + # Set the excludes and includes attributes for converting a bundle that has + # the portal and a set of deployed plugins into an EAR file. The web + # applications that match these attributes will be included into the + # generated liferay-portal.ear via the command "ant ear". + # + # For example, if you are using Tomcat, then the directory specified in + # the property "app.server.tomcat.deploy.dir" will point to + # ${app.server.tomcat.dir}/webapps by default. Running "ant ear" will create + # an EAR based on all the WARs in that directory with names that match the + # excludes and includes from these two properties. + # + plugins.ear.excludes= + plugins.ear.includes=tunnel-web + + # + # Specify the path of the portal servlet context. + # + # Set this property if you deploy the portal to another path besides root. + # + plugins.ear.portal.context.path=/ + + # + # Set this to true to generate a source ZIP file when creating a plugin WAR + # file. + # + plugins.src.zip.enabled=false + + # + # Set this to true to optimize the size of plugin WAR files by not included + # portal dependencies that will can injected at deploy time. + # + plugins.war.clean.portal.dependencies=true + + # + # Set the excludes attributes to specify files that will be excluded from a + # plugin WAR. + # + #plugins.war.excludes=**/WEB-INF/service/**,**/WEB-INF/src/** + +## +## PMD +## + + pmd.cpd.minimun.token.count=100 + pmd.java.excludes=apps/**,tools/** + pmd.java.includes=**/src/**/*.java + pmd.java.ruleset=${sdk.dir}/dependencies/net.sourceforge.pmd/rulesets/java/standard-rules.xml + pmd.output.console=true + pmd.output.type=xml + pmd.threads=2 + +## +## Snapshot +## + + snapshot.check.enabled=true + +## +## Sonatype +## + + sonatype.release.hostname=repository.liferay.com + sonatype.release.password= + sonatype.release.realm=Sonatype Nexus Repository Manager + sonatype.release.url=https://repository.liferay.com/nexus/content/repositories/liferay-public-releases + sonatype.release.username= + + sonatype.snapshot.hostname=repository.liferay.com + sonatype.snapshot.password= + sonatype.snapshot.realm=Sonatype Nexus Repository Manager + sonatype.snapshot.url=https://repository.liferay.com/nexus/content/repositories/liferay-public-snapshots + sonatype.snapshot.username= + +## +## Version +## + + # + # Set the version of Liferay Portal that these plugins are designed for. + # + lp.version=6.2.0 + lp.version.file.suffix= diff --git a/build.ture.properties b/build.ture.properties new file mode 100644 index 0000000..f4c5d94 --- /dev/null +++ b/build.ture.properties @@ -0,0 +1,9 @@ +# Managed by Liferay IDE (remove this comment to prevent future updates) + +app.server.tomcat.lib.global.dir = /home/ture/liferay/portali/paesaggistica/tomcat-7.0.62/lib/ext +app.server.tomcat.deploy.dir = /home/ture/liferay/portali/paesaggistica/tomcat-7.0.62/webapps +app.server.parent.dir = /home/ture/liferay/portali/paesaggistica +app.server.tomcat.dir = /home/ture/liferay/portali/paesaggistica/tomcat-7.0.62 +app.server.type = tomcat +app.server.tomcat.portal.dir = /home/ture/liferay/portali/paesaggistica/tomcat-7.0.62/webapps/ROOT +javac.encoding = UTF-8 diff --git a/build.ture.properties.paesaggistica b/build.ture.properties.paesaggistica new file mode 100644 index 0000000..f4c5d94 --- /dev/null +++ b/build.ture.properties.paesaggistica @@ -0,0 +1,9 @@ +# Managed by Liferay IDE (remove this comment to prevent future updates) + +app.server.tomcat.lib.global.dir = /home/ture/liferay/portali/paesaggistica/tomcat-7.0.62/lib/ext +app.server.tomcat.deploy.dir = /home/ture/liferay/portali/paesaggistica/tomcat-7.0.62/webapps +app.server.parent.dir = /home/ture/liferay/portali/paesaggistica +app.server.tomcat.dir = /home/ture/liferay/portali/paesaggistica/tomcat-7.0.62 +app.server.type = tomcat +app.server.tomcat.portal.dir = /home/ture/liferay/portali/paesaggistica/tomcat-7.0.62/webapps/ROOT +javac.encoding = UTF-8 diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..41c3bd9 --- /dev/null +++ b/build.xml @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +. + +This task only works when the property "app.server.type" is "tomcat". However, +the outputted files will work in any supported application server. + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ci.properties b/ci.properties new file mode 100644 index 0000000..cc0681e --- /dev/null +++ b/ci.properties @@ -0,0 +1 @@ +jira.project.keys=CLDSVCS,LEVP,LOOP,LPS,LRAMF,LRDCOM,LRDOCS,LRIS,LRQA,LRU,SOS,SYNC,ZOE \ No newline at end of file diff --git a/common.bnd b/common.bnd new file mode 100644 index 0000000..9de5dff --- /dev/null +++ b/common.bnd @@ -0,0 +1,13 @@ +Bundle-SymbolicName: ${plugin.name} +Bundle-Vendor: ${release.info.vendor} +Bundle-Version: ${release.info.version}.${plugin.version} +Git-Descriptor: ${system-allow-fail;git describe --dirty --always} +Git-SHA: ${system-allow-fail;git rev-list -1 HEAD} +Javac-Compiler: ${javac.compiler} +Javac-Debug: ${javac.debug} +Javac-Deprecation: ${javac.deprecation} +Javac-Encoding: ${javac.encoding} + +-donotcopy: (\.touch) +-dsannotations: * +-sources: false \ No newline at end of file diff --git a/copyright.txt b/copyright.txt new file mode 100644 index 0000000..17ba5f3 --- /dev/null +++ b/copyright.txt @@ -0,0 +1,13 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ \ No newline at end of file diff --git a/dependencies/aQute.bnd/ivy.xml b/dependencies/aQute.bnd/ivy.xml new file mode 100644 index 0000000..3df8050 --- /dev/null +++ b/dependencies/aQute.bnd/ivy.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dependencies/aQute.bnd/ivy.xml.MD5 b/dependencies/aQute.bnd/ivy.xml.MD5 new file mode 100644 index 0000000..42e4208 --- /dev/null +++ b/dependencies/aQute.bnd/ivy.xml.MD5 @@ -0,0 +1 @@ +45b38289274e4397c600a212c5477afa diff --git a/dependencies/aQute.bnd/lib/biz.aQute.bnd.jar b/dependencies/aQute.bnd/lib/biz.aQute.bnd.jar new file mode 100644 index 0000000..b624953 Binary files /dev/null and b/dependencies/aQute.bnd/lib/biz.aQute.bnd.jar differ diff --git a/dependencies/com.liferay.ant.bnd/ivy.xml b/dependencies/com.liferay.ant.bnd/ivy.xml new file mode 100644 index 0000000..245112d --- /dev/null +++ b/dependencies/com.liferay.ant.bnd/ivy.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dependencies/com.liferay.ant.bnd/ivy.xml.MD5 b/dependencies/com.liferay.ant.bnd/ivy.xml.MD5 new file mode 100644 index 0000000..b5ecd14 --- /dev/null +++ b/dependencies/com.liferay.ant.bnd/ivy.xml.MD5 @@ -0,0 +1 @@ +605466165ccd54086efdcbde81396ccb diff --git a/dependencies/com.liferay.ant.bnd/lib/ant-launcher.jar b/dependencies/com.liferay.ant.bnd/lib/ant-launcher.jar new file mode 100644 index 0000000..97c2262 Binary files /dev/null and b/dependencies/com.liferay.ant.bnd/lib/ant-launcher.jar differ diff --git a/dependencies/com.liferay.ant.bnd/lib/ant.jar b/dependencies/com.liferay.ant.bnd/lib/ant.jar new file mode 100644 index 0000000..24641e7 Binary files /dev/null and b/dependencies/com.liferay.ant.bnd/lib/ant.jar differ diff --git a/dependencies/com.liferay.ant.bnd/lib/biz.aQute.bnd.jar b/dependencies/com.liferay.ant.bnd/lib/biz.aQute.bnd.jar new file mode 100644 index 0000000..b624953 Binary files /dev/null and b/dependencies/com.liferay.ant.bnd/lib/biz.aQute.bnd.jar differ diff --git a/dependencies/com.liferay.ant.bnd/lib/com.liferay.ant.bnd.jar b/dependencies/com.liferay.ant.bnd/lib/com.liferay.ant.bnd.jar new file mode 100644 index 0000000..cb91f1e Binary files /dev/null and b/dependencies/com.liferay.ant.bnd/lib/com.liferay.ant.bnd.jar differ diff --git a/dependencies/com.liferay.ant.mirrors.get/ivy.xml b/dependencies/com.liferay.ant.mirrors.get/ivy.xml new file mode 100644 index 0000000..dfa7af5 --- /dev/null +++ b/dependencies/com.liferay.ant.mirrors.get/ivy.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/dependencies/com.liferay.ant.mirrors.get/ivy.xml.MD5 b/dependencies/com.liferay.ant.mirrors.get/ivy.xml.MD5 new file mode 100644 index 0000000..ba7c5c0 --- /dev/null +++ b/dependencies/com.liferay.ant.mirrors.get/ivy.xml.MD5 @@ -0,0 +1 @@ +0ffa7525c54ac6279b4bab37db8be270 diff --git a/dependencies/com.liferay.ant.mirrors.get/lib/com.liferay.ant.mirrors.get.jar b/dependencies/com.liferay.ant.mirrors.get/lib/com.liferay.ant.mirrors.get.jar new file mode 100644 index 0000000..2a1c272 Binary files /dev/null and b/dependencies/com.liferay.ant.mirrors.get/lib/com.liferay.ant.mirrors.get.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/ivy.xml b/dependencies/com.liferay.jasper.jspc/ivy.xml new file mode 100644 index 0000000..6493346 --- /dev/null +++ b/dependencies/com.liferay.jasper.jspc/ivy.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dependencies/com.liferay.jasper.jspc/ivy.xml.MD5 b/dependencies/com.liferay.jasper.jspc/ivy.xml.MD5 new file mode 100644 index 0000000..07710c1 --- /dev/null +++ b/dependencies/com.liferay.jasper.jspc/ivy.xml.MD5 @@ -0,0 +1 @@ +413efe1107bf241590e56459721708af diff --git a/dependencies/com.liferay.jasper.jspc/lib/com.liferay.jasper.jspc.jar b/dependencies/com.liferay.jasper.jspc/lib/com.liferay.jasper.jspc.jar new file mode 100644 index 0000000..4c0f045 Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/com.liferay.jasper.jspc.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/ecj.jar b/dependencies/com.liferay.jasper.jspc/lib/ecj.jar new file mode 100644 index 0000000..0f9a1da Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/ecj.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/jsp-api.jar b/dependencies/com.liferay.jasper.jspc/lib/jsp-api.jar new file mode 100644 index 0000000..c0195af Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/jsp-api.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/jstl-api.jar b/dependencies/com.liferay.jasper.jspc/lib/jstl-api.jar new file mode 100644 index 0000000..30d4d92 Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/jstl-api.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/jstl.jar b/dependencies/com.liferay.jasper.jspc/lib/jstl.jar new file mode 100644 index 0000000..0fd275e Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/jstl.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/servlet-api.jar b/dependencies/com.liferay.jasper.jspc/lib/servlet-api.jar new file mode 100644 index 0000000..fb52493 Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/servlet-api.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/tomcat-api.jar b/dependencies/com.liferay.jasper.jspc/lib/tomcat-api.jar new file mode 100644 index 0000000..da0f0bb Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/tomcat-api.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/tomcat-el-api.jar b/dependencies/com.liferay.jasper.jspc/lib/tomcat-el-api.jar new file mode 100644 index 0000000..8696056 Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/tomcat-el-api.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/tomcat-jasper-el.jar b/dependencies/com.liferay.jasper.jspc/lib/tomcat-jasper-el.jar new file mode 100644 index 0000000..8823666 Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/tomcat-jasper-el.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/tomcat-jasper.jar b/dependencies/com.liferay.jasper.jspc/lib/tomcat-jasper.jar new file mode 100644 index 0000000..971c057 Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/tomcat-jasper.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/tomcat-jsp-api.jar b/dependencies/com.liferay.jasper.jspc/lib/tomcat-jsp-api.jar new file mode 100644 index 0000000..8642a47 Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/tomcat-jsp-api.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/tomcat-juli.jar b/dependencies/com.liferay.jasper.jspc/lib/tomcat-juli.jar new file mode 100644 index 0000000..3a6755b Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/tomcat-juli.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/tomcat-servlet-api.jar b/dependencies/com.liferay.jasper.jspc/lib/tomcat-servlet-api.jar new file mode 100644 index 0000000..5048dbb Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/tomcat-servlet-api.jar differ diff --git a/dependencies/com.liferay.jasper.jspc/lib/tomcat-util.jar b/dependencies/com.liferay.jasper.jspc/lib/tomcat-util.jar new file mode 100644 index 0000000..7dfb6c9 Binary files /dev/null and b/dependencies/com.liferay.jasper.jspc/lib/tomcat-util.jar differ diff --git a/dependencies/net.sourceforge.pmd/ivy.xml b/dependencies/net.sourceforge.pmd/ivy.xml new file mode 100644 index 0000000..e62113b --- /dev/null +++ b/dependencies/net.sourceforge.pmd/ivy.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/dependencies/net.sourceforge.pmd/ivy.xml.MD5 b/dependencies/net.sourceforge.pmd/ivy.xml.MD5 new file mode 100644 index 0000000..aa76dfa --- /dev/null +++ b/dependencies/net.sourceforge.pmd/ivy.xml.MD5 @@ -0,0 +1 @@ +8bf302b4c3d37005e0f46a0be4d0e69c diff --git a/dependencies/net.sourceforge.pmd/lib/asm.jar b/dependencies/net.sourceforge.pmd/lib/asm.jar new file mode 100644 index 0000000..573535b Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/asm.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/com.liferay.pmd.jar b/dependencies/net.sourceforge.pmd/lib/com.liferay.pmd.jar new file mode 100644 index 0000000..f375fab Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/com.liferay.pmd.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/commons-io.jar b/dependencies/net.sourceforge.pmd/lib/commons-io.jar new file mode 100644 index 0000000..90035a4 Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/commons-io.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/commons-lang3.jar b/dependencies/net.sourceforge.pmd/lib/commons-lang3.jar new file mode 100644 index 0000000..2ce08ae Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/commons-lang3.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/javacc.jar b/dependencies/net.sourceforge.pmd/lib/javacc.jar new file mode 100644 index 0000000..2550727 Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/javacc.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/jaxen.jar b/dependencies/net.sourceforge.pmd/lib/jaxen.jar new file mode 100644 index 0000000..c201609 Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/jaxen.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/jcommander.jar b/dependencies/net.sourceforge.pmd/lib/jcommander.jar new file mode 100644 index 0000000..e86b47b Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/jcommander.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/pmd-core.jar b/dependencies/net.sourceforge.pmd/lib/pmd-core.jar new file mode 100644 index 0000000..ab0d3a3 Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/pmd-core.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/pmd-java.jar b/dependencies/net.sourceforge.pmd/lib/pmd-java.jar new file mode 100644 index 0000000..9d2501c Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/pmd-java.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/saxon.jar b/dependencies/net.sourceforge.pmd/lib/saxon.jar new file mode 100644 index 0000000..6ded01e Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/saxon.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/xercesImpl.jar b/dependencies/net.sourceforge.pmd/lib/xercesImpl.jar new file mode 100644 index 0000000..0aaa990 Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/xercesImpl.jar differ diff --git a/dependencies/net.sourceforge.pmd/lib/xml-apis.jar b/dependencies/net.sourceforge.pmd/lib/xml-apis.jar new file mode 100644 index 0000000..4673346 Binary files /dev/null and b/dependencies/net.sourceforge.pmd/lib/xml-apis.jar differ diff --git a/dependencies/net.sourceforge.pmd/rulesets/java/standard-rules.xml b/dependencies/net.sourceforge.pmd/rulesets/java/standard-rules.xml new file mode 100644 index 0000000..e7e433e --- /dev/null +++ b/dependencies/net.sourceforge.pmd/rulesets/java/standard-rules.xml @@ -0,0 +1,200 @@ + + + + + Selected standard rules from PMD out of box rule sets. Please refer to the origin rule set file, rule name and version info for future update. + + + + Detect when Assert#fail is called improperly. + + 3 + + + + + + + + + + [Origin rule set file rulesets/java/basic.xml] Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boolean.valueOf() instead. + + 2 + + + + + + + [Origin rule set file rulesets/java/basic.xml] Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass. + + 3 + + + + + + + [Origin rule set file rulesets/java/unnecessary.xml] Avoid the use of unnecessary return statements. + + 3 + + + + + + + [Origin rule set file rulesets/java/unnecessary.xml] An operation on an Immutable object (String, BigDecimal or BigInteger) won't change the object itself since the result of the operation is a new object. Therefore, ignoring the operation result is an error. + + 3 + + + + + + + [Origin rule set file rulesets/java/unusedcode.xml] Detects when a local variable is declared and/or assigned, but not used. + + 3 + + + + + \ No newline at end of file diff --git a/dependencies/org.apache.maven.maven.ant.tasks/ivy.xml b/dependencies/org.apache.maven.maven.ant.tasks/ivy.xml new file mode 100644 index 0000000..04406da --- /dev/null +++ b/dependencies/org.apache.maven.maven.ant.tasks/ivy.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dependencies/org.apache.maven.maven.ant.tasks/ivy.xml.MD5 b/dependencies/org.apache.maven.maven.ant.tasks/ivy.xml.MD5 new file mode 100644 index 0000000..eac6c7a --- /dev/null +++ b/dependencies/org.apache.maven.maven.ant.tasks/ivy.xml.MD5 @@ -0,0 +1 @@ +2aae42c5c43b993944b8c0fe9e31d5fb diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/ant-launcher.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/ant-launcher.jar new file mode 100644 index 0000000..08ec632 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/ant-launcher.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/ant.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/ant.jar new file mode 100644 index 0000000..85292f0 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/ant.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/backport-util-concurrent.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/backport-util-concurrent.jar new file mode 100644 index 0000000..3a4c279 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/backport-util-concurrent.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/classworlds.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/classworlds.jar new file mode 100644 index 0000000..1208b48 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/classworlds.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-ant-tasks.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-ant-tasks.jar new file mode 100644 index 0000000..bec446f Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-ant-tasks.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-artifact-manager.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-artifact-manager.jar new file mode 100644 index 0000000..181bc39 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-artifact-manager.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-artifact.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-artifact.jar new file mode 100644 index 0000000..abab479 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-artifact.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-error-diagnostics.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-error-diagnostics.jar new file mode 100644 index 0000000..9daada2 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-error-diagnostics.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-model.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-model.jar new file mode 100644 index 0000000..73175f8 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-model.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-plugin-registry.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-plugin-registry.jar new file mode 100644 index 0000000..1b87d9a Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-plugin-registry.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-profile.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-profile.jar new file mode 100644 index 0000000..5394d32 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-profile.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-project.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-project.jar new file mode 100644 index 0000000..63b9ebd Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-project.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-repository-metadata.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-repository-metadata.jar new file mode 100644 index 0000000..5b4f494 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-repository-metadata.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-settings.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-settings.jar new file mode 100644 index 0000000..edef547 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/maven-settings.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/nekohtml.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/nekohtml.jar new file mode 100644 index 0000000..716901e Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/nekohtml.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/plexus-container-default.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/plexus-container-default.jar new file mode 100644 index 0000000..d205236 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/plexus-container-default.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/plexus-interpolation.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/plexus-interpolation.jar new file mode 100644 index 0000000..c937688 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/plexus-interpolation.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/plexus-utils.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/plexus-utils.jar new file mode 100644 index 0000000..8149689 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/plexus-utils.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-file.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-file.jar new file mode 100644 index 0000000..39da9ec Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-file.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-http-lightweight.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-http-lightweight.jar new file mode 100644 index 0000000..845bef0 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-http-lightweight.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-http-shared.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-http-shared.jar new file mode 100644 index 0000000..08a96a5 Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-http-shared.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-provider-api.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-provider-api.jar new file mode 100644 index 0000000..246548d Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/wagon-provider-api.jar differ diff --git a/dependencies/org.apache.maven.maven.ant.tasks/lib/xercesMinimal.jar b/dependencies/org.apache.maven.maven.ant.tasks/lib/xercesMinimal.jar new file mode 100644 index 0000000..649a66b Binary files /dev/null and b/dependencies/org.apache.maven.maven.ant.tasks/lib/xercesMinimal.jar differ diff --git a/dependencies/org.codehaus.groovy/ivy.xml b/dependencies/org.codehaus.groovy/ivy.xml new file mode 100644 index 0000000..6b9a32e --- /dev/null +++ b/dependencies/org.codehaus.groovy/ivy.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dependencies/org.codehaus.groovy/ivy.xml.MD5 b/dependencies/org.codehaus.groovy/ivy.xml.MD5 new file mode 100644 index 0000000..3c011cc --- /dev/null +++ b/dependencies/org.codehaus.groovy/ivy.xml.MD5 @@ -0,0 +1 @@ +e1a7d560dfc36faf61c7d7da67bb03df diff --git a/dependencies/org.codehaus.groovy/lib/groovy-all.jar b/dependencies/org.codehaus.groovy/lib/groovy-all.jar new file mode 100644 index 0000000..aad4185 Binary files /dev/null and b/dependencies/org.codehaus.groovy/lib/groovy-all.jar differ diff --git a/dependencies/org.freemarker/ivy.xml b/dependencies/org.freemarker/ivy.xml new file mode 100644 index 0000000..72f3620 --- /dev/null +++ b/dependencies/org.freemarker/ivy.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dependencies/org.freemarker/ivy.xml.MD5 b/dependencies/org.freemarker/ivy.xml.MD5 new file mode 100644 index 0000000..5dff026 --- /dev/null +++ b/dependencies/org.freemarker/ivy.xml.MD5 @@ -0,0 +1 @@ +f6d028f89713fdbf3004b38da2b16dcf diff --git a/dependencies/org.freemarker/lib/org.freemarker.jar b/dependencies/org.freemarker/lib/org.freemarker.jar new file mode 100644 index 0000000..74c16fd Binary files /dev/null and b/dependencies/org.freemarker/lib/org.freemarker.jar differ diff --git a/dependencies/org.sonar.ant/ivy.xml b/dependencies/org.sonar.ant/ivy.xml new file mode 100644 index 0000000..40722ed --- /dev/null +++ b/dependencies/org.sonar.ant/ivy.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dependencies/org.sonar.ant/ivy.xml.MD5 b/dependencies/org.sonar.ant/ivy.xml.MD5 new file mode 100644 index 0000000..6d91380 --- /dev/null +++ b/dependencies/org.sonar.ant/ivy.xml.MD5 @@ -0,0 +1 @@ +3325db6f628a33488c6c832368b134e4 diff --git a/dependencies/org.sonar.ant/lib/sonar-ant-task.jar b/dependencies/org.sonar.ant/lib/sonar-ant-task.jar new file mode 100644 index 0000000..125e86c Binary files /dev/null and b/dependencies/org.sonar.ant/lib/sonar-ant-task.jar differ diff --git a/ext/build-common-ext.xml b/ext/build-common-ext.xml new file mode 100644 index 0000000..6d0fc06 --- /dev/null +++ b/ext/build-common-ext.xml @@ -0,0 +1,348 @@ + + + + + + + + +. + +WARNING: Support for ServiceBuilder in EXT plugins will be deprecated in future +versions. EXT plugins are designed to override the portal's core code that +cannot be done with hooks, layout templates, portlets, or themes. EXT plugins +are not meant to contain new custom services. Please migrate your service.xml to +a portlet plugin. + + + + + + + + + + + + + + +. + +WARNING: Support for ServiceBuilder in EXT plugins will be deprecated in future +versions. EXT plugins are designed to override the portal's core code that +cannot be done with hooks, layout templates, portlets, or themes. EXT plugins +are not meant to contain new custom services. Please migrate your service.xml to +a portlet plugin. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +. + +${property.name} does not exist! + +The properties "app.server.dir", "app.server.zip.name", and "ext.work.dir" are +not properly specified. + +The directory denoted by the property "ext.work.dir" will be deleted and the zip +file denoted by the property "app.server.zip.name" will be unzipped into this +directory. The property "app.server.dir" must point to the application server +directory that was unzipped into "ext.work.dir". + +For example, if "ext.work.dir" points to "C:\ext-work", and +"app.server.zip.name" points to "C:\files\liferay-portal-tomcat-6.0-${lp.version}.zip", +then "app.server.dir" should point to +"C:\ext-work\liferay-portal-${lp.version}\tomcat-6.0.18". + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +. + +"docroot\WEB-INF\ext-web\docroot\WEB-INF\lib" must not exist. Put JAR files in +"docroot\WEB-INF\ext-lib\portal" that need to be accessible to the portal class +loader. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ext/build.xml b/ext/build.xml new file mode 100644 index 0000000..73e4ee3 --- /dev/null +++ b/ext/build.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + This task must be called by the create script. + + + + + + + + + + ${ext.name}-ext already exists. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +. + +Usage: ant upgrade-ext -Dext.dir=C:\ext -Dext.name=hello-world -Dext.display.name="Hello World" + +The arguments "ext.dir", "ext.name", and "ext.display.name" are not properly +specified. + +This task will build an EXT plugin from a legacy EXT environment. The files in +the directory denoted by "ext.dir" will be copied into the EXT plugin directory +called "ext.name"-ext. The property "ext.dir" must point to a legacy EXT +environment and the EXT plugin directory called "ext-name"-ext must not already +exist. + + + + + + + + ${ext.name}-ext already exists. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ext/create.bat b/ext/create.bat new file mode 100644 index 0000000..4147e26 --- /dev/null +++ b/ext/create.bat @@ -0,0 +1,25 @@ +@echo off + +if "" == "%1" goto errorCreate + +if "" == "%2" goto errorCreate + +call ant -Dext.name=%1 -Dext.display.name=%2 create + +rem call ant deploy + +goto end + +:errorCreate + echo. + echo Usage: create.bat hello-world "Hello World" + echo. + echo The first hello-world is your extension environment name. A new directory will + echo be created based on the extension environment name. + echo. + echo The second "Hello World" is the extension environment's display name. The + echo quotation marks are only needed because there is a space in the display name. + + goto end + +:end \ No newline at end of file diff --git a/ext/create.sh b/ext/create.sh new file mode 100644 index 0000000..8655d95 --- /dev/null +++ b/ext/create.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +#set -x + +if [ $# -lt 2 ]; then + echo + echo Usage: ./create.sh hello-world \"Hello World\" + echo + echo The first hello-world is your extension environment name. A new directory will + echo be created based on the extension environment name. + echo + echo The second "Hello World" is the extension environment\'s display name. The + echo quotation marks are only needed because there is a space in the display name. + + exit 127 +fi + +ant -Dext.name=$1 -Dext.display.name=\"$2\" create + +#ant deploy + +exit 0 \ No newline at end of file diff --git a/hooks/build-common-hook.xml b/hooks/build-common-hook.xml new file mode 100644 index 0000000..4137b7a --- /dev/null +++ b/hooks/build-common-hook.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/hooks/build.xml b/hooks/build.xml new file mode 100644 index 0000000..8e5132d --- /dev/null +++ b/hooks/build.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + This task must be called by the create script. + + + + + + + + + + ${hook.name}-hook already exists. + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hooks/create.bat b/hooks/create.bat new file mode 100644 index 0000000..574b28b --- /dev/null +++ b/hooks/create.bat @@ -0,0 +1,25 @@ +@echo off + +if "" == "%1" goto errorCreate + +if "" == "%2" goto errorCreate + +call ant -Dhook.name=%1 -Dhook.display.name=%2 create + +rem call ant deploy + +goto end + +:errorCreate + echo. + echo Usage: create.bat hello-world "Hello World" + echo. + echo The first hello-world is your hook id. A new directory will be created based on + echo the hook id. + echo. + echo The second "Hello World" is the hook's display name. The quotation marks are + echo only needed because there is a space in the display name. + + goto end + +:end \ No newline at end of file diff --git a/hooks/create.sh b/hooks/create.sh new file mode 100644 index 0000000..ad5d82e --- /dev/null +++ b/hooks/create.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +#set -x + +if [ $# -lt 2 ]; then + echo + echo Usage: ./create.sh hello-world \"Hello World\" + echo + echo The first hello-world is your hook id. A new directory will be created based on + echo the hook id. + echo + echo The second \"Hello World\" is the hook\'s display name. The quotation marks are + echo only needed because there is a space in the display name. + + exit 127 +fi + +ant -Dhook.name=$1 -Dhook.display.name=\"$2\" create + +#ant deploy + +exit 0 \ No newline at end of file diff --git a/hooks/sicilia-login-hook/.classpath b/hooks/sicilia-login-hook/.classpath new file mode 100644 index 0000000..bf57290 --- /dev/null +++ b/hooks/sicilia-login-hook/.classpath @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hooks/sicilia-login-hook/.project b/hooks/sicilia-login-hook/.project new file mode 100644 index 0000000..6e8b3e5 --- /dev/null +++ b/hooks/sicilia-login-hook/.project @@ -0,0 +1,48 @@ + + + sicilia-login-hook + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.apache.ivyde.eclipse.ivynature + org.eclipse.wst.jsdt.core.jsNature + + + + 1669365700807 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/hooks/sicilia-login-hook/.settings/.jsdtscope b/hooks/sicilia-login-hook/.settings/.jsdtscope new file mode 100644 index 0000000..840a01d --- /dev/null +++ b/hooks/sicilia-login-hook/.settings/.jsdtscope @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/hooks/sicilia-login-hook/.settings/org.eclipse.wst.common.component b/hooks/sicilia-login-hook/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..e04d966 --- /dev/null +++ b/hooks/sicilia-login-hook/.settings/org.eclipse.wst.common.component @@ -0,0 +1,11 @@ + + + + + + uses + + + + + diff --git a/hooks/sicilia-login-hook/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/hooks/sicilia-login-hook/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000..1f9ee53 --- /dev/null +++ b/hooks/sicilia-login-hook/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hooks/sicilia-login-hook/.settings/org.eclipse.wst.common.project.facet.core.xml b/hooks/sicilia-login-hook/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..cded63a --- /dev/null +++ b/hooks/sicilia-login-hook/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/hooks/sicilia-login-hook/.settings/org.eclipse.wst.jsdt.ui.superType.container b/hooks/sicilia-login-hook/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/hooks/sicilia-login-hook/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/hooks/sicilia-login-hook/.settings/org.eclipse.wst.jsdt.ui.superType.name b/hooks/sicilia-login-hook/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/hooks/sicilia-login-hook/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/hooks/sicilia-login-hook/build.xml b/hooks/sicilia-login-hook/build.xml new file mode 100644 index 0000000..c2d19b3 --- /dev/null +++ b/hooks/sicilia-login-hook/build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/hooks/sicilia-login-hook/docroot/META-INF/MANIFEST.MF b/hooks/sicilia-login-hook/docroot/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/hooks/sicilia-login-hook/docroot/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/.gitignore b/hooks/sicilia-login-hook/docroot/WEB-INF/.gitignore new file mode 100644 index 0000000..840e7d3 --- /dev/null +++ b/hooks/sicilia-login-hook/docroot/WEB-INF/.gitignore @@ -0,0 +1 @@ +/classes/ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/bcprov-jdk15on.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/bcprov-jdk15on.jar new file mode 100644 index 0000000..4076e11 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/bcprov-jdk15on.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-codec.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-codec.jar new file mode 100644 index 0000000..2245120 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-codec.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-collections.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-collections.jar new file mode 100644 index 0000000..c35fa1f Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-collections.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-httpclient.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-httpclient.jar new file mode 100644 index 0000000..7c59774 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-httpclient.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-lang.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-lang.jar new file mode 100644 index 0000000..98467d3 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/commons-lang.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/esapi.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/esapi.jar new file mode 100644 index 0000000..06b9149 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/esapi.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/guava.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/guava.jar new file mode 100644 index 0000000..632772f Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/guava.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/httpclient.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/httpclient.jar new file mode 100644 index 0000000..218ee25 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/httpclient.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/httpcore.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/httpcore.jar new file mode 100644 index 0000000..163dc43 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/httpcore.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/java-support.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/java-support.jar new file mode 100644 index 0000000..557873f Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/java-support.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/jcl-over-slf4j.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/jcl-over-slf4j.jar new file mode 100644 index 0000000..90153b0 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/jcl-over-slf4j.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/joda-time.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/joda-time.jar new file mode 100644 index 0000000..69fa924 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/joda-time.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/jsr305.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/jsr305.jar new file mode 100644 index 0000000..021df89 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/jsr305.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/jul-to-slf4j.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/jul-to-slf4j.jar new file mode 100644 index 0000000..9b5e8c1 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/jul-to-slf4j.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/log4j-over-slf4j.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/log4j-over-slf4j.jar new file mode 100644 index 0000000..3f30396 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/log4j-over-slf4j.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/metrics-core.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/metrics-core.jar new file mode 100644 index 0000000..5767166 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/metrics-core.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/not-yet-commons-ssl.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/not-yet-commons-ssl.jar new file mode 100644 index 0000000..9e38f97 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/not-yet-commons-ssl.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/opensaml.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/opensaml.jar new file mode 100644 index 0000000..34ae4e3 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/opensaml.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/openws.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/openws.jar new file mode 100644 index 0000000..563b0f9 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/openws.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/slf4j-api.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/slf4j-api.jar new file mode 100644 index 0000000..8f004d3 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/slf4j-api.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/velocity.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/velocity.jar new file mode 100644 index 0000000..ae936d3 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/velocity.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/xmlsec.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/xmlsec.jar new file mode 100644 index 0000000..2512fb5 Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/xmlsec.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/lib/xmltooling.jar b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/xmltooling.jar new file mode 100644 index 0000000..6bf1f4f Binary files /dev/null and b/hooks/sicilia-login-hook/docroot/WEB-INF/lib/xmltooling.jar differ diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/liferay-hook.xml b/hooks/sicilia-login-hook/docroot/WEB-INF/liferay-hook.xml new file mode 100644 index 0000000..6cd1c92 --- /dev/null +++ b/hooks/sicilia-login-hook/docroot/WEB-INF/liferay-hook.xml @@ -0,0 +1,16 @@ + + + + + portal.properties + + Sicilia SSO + it.mwg.sicilia.login.filter.SiciliaLoginFilter + + + Sicilia SSO + /c/portal/login + FORWARD + REQUEST + + \ No newline at end of file diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/liferay-plugin-package.properties b/hooks/sicilia-login-hook/docroot/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..433fe62 --- /dev/null +++ b/hooks/sicilia-login-hook/docroot/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,12 @@ +name=Sicilia Login Hook +module-group-id=liferay +module-incremental-version=1 +tags= +short-description= +long-description= +change-log= +page-url=http://www.liferay.com +author=Liferay, Inc. +licenses=LGPL +liferay-versions=6.2.0+ +required-deployment-contexts=sicilia-login-portlet diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/constants/ApiConstants.java b/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/constants/ApiConstants.java new file mode 100644 index 0000000..0b880c4 --- /dev/null +++ b/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/constants/ApiConstants.java @@ -0,0 +1,21 @@ +package it.mwg.sicilia.login.constants; + +/** + * @author Manifattura Web Group per Regione Siciliana + */ +public class ApiConstants { + + public static final String PARAMETER_AUTH = "auth"; + public static final String PARAMETER_CALLBACK_URL = "callback"; + public static final String PARAMETER_TOKEN = "token"; + public static final String PARAMETER_USERNAME = "username"; + public static final String PARAMETER_PASSWORD = "password"; + public static final String PARAMETER_FIRST_NAME = "nome"; + public static final String PARAMETER_LAST_NAME = "cognome"; + public static final String PARAMETER_CODICE_FISCALE = "codice_fiscale"; + + private static final String SESSION_BASE = "SICILIA_HOOK_"; + public static final String SESSION_AUTH = SESSION_BASE + PARAMETER_AUTH.toUpperCase(); + public static final String SESSION_TOKEN = SESSION_BASE + PARAMETER_TOKEN.toUpperCase(); + public static final String SESSION_USER_DATA = SESSION_BASE + "USER_DATA"; +} diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/filter/SiciliaAutoLogin.java b/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/filter/SiciliaAutoLogin.java new file mode 100644 index 0000000..7cf752c --- /dev/null +++ b/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/filter/SiciliaAutoLogin.java @@ -0,0 +1,132 @@ +package it.mwg.sicilia.login.filter; + +import it.mwg.sicilia.login.constants.ApiConstants; + +import java.util.Date; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.security.SecureRandom; +import com.liferay.portal.kernel.util.ParamUtil; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.model.User; +import com.liferay.portal.security.auth.AutoLogin; +import com.liferay.portal.security.auth.AutoLoginException; +import com.liferay.portal.service.ServiceContext; +import com.liferay.portal.service.UserLocalServiceUtil; +import com.liferay.portal.util.PortalUtil; + +/** + * @author Manifattura Web Group per Regione Siciliana + */ +public class SiciliaAutoLogin implements AutoLogin { + + @Override + public String[] login(HttpServletRequest request, HttpServletResponse response) throws AutoLoginException { + User user = null; + HttpSession session = request.getSession(); + @SuppressWarnings("unchecked") + Map userData = (Map) session.getAttribute(ApiConstants.SESSION_USER_DATA); + if (Validator.isNotNull(userData)) { + long companyId = PortalUtil.getCompanyId(request); + user = logUser(companyId, userData.get(ApiConstants.PARAMETER_CODICE_FISCALE), + userData.get(ApiConstants.PARAMETER_FIRST_NAME), userData.get(ApiConstants.PARAMETER_LAST_NAME)); + if (Validator.isNotNull(user)) { + String redirect = ParamUtil.getString(request, "redirect"); + if (Validator.isNotNull(redirect)) { + request.setAttribute(AUTO_LOGIN_REDIRECT_AND_CONTINUE, redirect); + } + return new String[] { String.valueOf(user.getUserId()), user.getPassword(), + String.valueOf(user.isPasswordEncrypted()) }; + } + } + return null; + } + + @Override + public String[] handleException(HttpServletRequest request, HttpServletResponse response, Exception e) + throws AutoLoginException { + + _log.error(e); + return null; + } + + private User logUser(long companyId, String screenName, String firstName, String lastName) { + + _log.info("Cerco l'utente " + screenName + " (" + firstName + " " + lastName + ")"); + User user = null; + try { + user = UserLocalServiceUtil.fetchUserByScreenName(companyId, screenName); + if (Validator.isNull(user)) { + long creatorUserId = UserLocalServiceUtil.getDefaultUserId(companyId); + boolean autoPassword = true; + String password = randomPassword(24); + boolean autoScreenName = false; + String emailAddress = screenName + "@no-email.regione.sicilia.it"; + long facebookId = 0; + String openId = StringPool.BLANK; + Locale locale = Locale.ITALY; + String middleName = StringPool.BLANK; + int prefixId = 0; + int suffixId = 0; + boolean male = true; + int birthdayMonth = 0; + int birthdayDay = 1; + int birthdayYear = 1970; + String jobTitle = StringPool.BLANK; + long[] groupIds = null; + long[] organizationIds = null; + long[] roleIds = null; + long[] userGroupIds = null; + boolean sendEmail = false; + ServiceContext serviceContext = new ServiceContext(); + user = UserLocalServiceUtil.addUser(creatorUserId, companyId, autoPassword, password, password, + autoScreenName, screenName.toLowerCase(), emailAddress, facebookId, openId, locale, + capitalize(firstName), middleName, capitalize(lastName), prefixId, suffixId, male, + birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds, roleIds, + userGroupIds, sendEmail, serviceContext); + user.setPasswordModified(true); + user.setPasswordModifiedDate(new Date()); + user.setPasswordReset(false); + UserLocalServiceUtil.updateUser(user); + } + } catch (SystemException | PortalException e) { + _log.error("Errore durante l'autenticazione/creazione dell'utente " + screenName, e); + } + return user; + } + + private String capitalize(String str) { + + int length = str.length(); + StringBuilder sb = new StringBuilder(length); + boolean capital = true; + for (int i = 0; i < length; i++) { + char c = str.charAt(i); + sb.append(capital ? Character.toTitleCase(c) : Character.toLowerCase(c)); + capital = (c == ' '); + } + return sb.toString(); + } + + private String randomPassword(int length) { + + SecureRandom rnd = new SecureRandom(); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < length; i++) { + sb.append((char) (32 + rnd.nextInt(95))); + } + return sb.toString(); + } + + private static final Log _log = LogFactoryUtil.getLog(SiciliaAutoLogin.class); +} diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/filter/SiciliaLoginFilter.java b/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/filter/SiciliaLoginFilter.java new file mode 100644 index 0000000..d8c50bc --- /dev/null +++ b/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/filter/SiciliaLoginFilter.java @@ -0,0 +1,79 @@ +package it.mwg.sicilia.login.filter; + +import it.mwg.sicilia.login.constants.ApiConstants; +import it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil; +import it.mwg.sicilia.login.util.ApiUtil; + +import java.io.IOException; +import java.util.Map; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.util.PortalUtil; + +/** + * @author Manifattura Web Group per Regione Siciliana + */ +public class SiciliaLoginFilter implements Filter { + + @Override + public void destroy() {} + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, + ServletException { + + HttpServletRequest httpRequest = (HttpServletRequest) request; + if (httpRequest.getHeader("x-requested-with") == null) { + long companyId = PortalUtil.getCompanyId(httpRequest); + String url = httpRequest.getRequestURL().toString(); + String qs = httpRequest.getQueryString(); + if (Validator.isNotNull(qs)) { + url += StringPool.QUESTION + qs; + } + HttpSession session = httpRequest.getSession(); + String token = (String) session.getAttribute(ApiConstants.SESSION_TOKEN); + if (Validator.isNull(token)) { + token = ApiUtil.getToken(companyId, url); + if (Validator.isNull(token)) { + _log.error("Il token è nullo"); + } else { + session.setAttribute(ApiConstants.SESSION_TOKEN, token); + ((HttpServletResponse) response).sendRedirect(ConfigurazioneLocalServiceUtil + .getApiServer(companyId) + "?t=" + token); + } + return; + } else { + Map userData = ApiUtil.getUserInfo(companyId, token); + if (Validator.isNull(userData)) { + // Se il token è scaduto si ricomincia + token = ApiUtil.getToken(companyId, url); + session.setAttribute(ApiConstants.SESSION_TOKEN, token); + ((HttpServletResponse) response).sendRedirect(ConfigurazioneLocalServiceUtil + .getApiServer(companyId) + "?t=" + token); + return; + } else { + session.setAttribute(ApiConstants.SESSION_USER_DATA, userData); + } + } + } + chain.doFilter(request, response); + } + + @Override + public void init(FilterConfig config) throws ServletException {} + + public static final Log _log = LogFactoryUtil.getLog(SiciliaLoginFilter.class); +} diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/util/ApiUtil.java b/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/util/ApiUtil.java new file mode 100644 index 0000000..a5a2a53 --- /dev/null +++ b/hooks/sicilia-login-hook/docroot/WEB-INF/src/it/mwg/sicilia/login/util/ApiUtil.java @@ -0,0 +1,159 @@ +package it.mwg.sicilia.login.util; + +import it.mwg.sicilia.login.constants.ApiConstants; +import it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import com.liferay.portal.kernel.json.JSONException; +import com.liferay.portal.kernel.json.JSONFactoryUtil; +import com.liferay.portal.kernel.json.JSONObject; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.Validator; + +/** + * @author Manifattura Web Group per Regione Siciliana + */ +public class ApiUtil { + + public static String getToken(long companyId, String callbackURL) { + + if (Validator.isNull(auth)) { + login(companyId); + } + for (int i = 0; i < 10; i++) { + if (Validator.isNotNull(auth)) { + JSONObject map = JSONFactoryUtil.createJSONObject(); + map.put(ApiConstants.PARAMETER_AUTH, auth); + map.put(ApiConstants.PARAMETER_CALLBACK_URL, callbackURL); + map = post(companyId, ENDPOINT_GET_TOKEN, map); + if (Validator.isNotNull(map)) { + switch (map.getInt(LABEL_ERROR_CODE)) { + case ERROR_OK: + return map.getString(ApiConstants.PARAMETER_TOKEN); + case ERROR_INVALID_AUTH: + _log.info("Auth scaduto. Eseguo nuovo login"); + login(companyId); + break; + default: + _log.error("Errore durante la creazione del token: " + map.toString()); + return null; + } + } else { + _log.error("Errore inatteso durante la creazione del token"); + } + } + } + return null; + } + + private static String getUrl(long companyId, String suffix) { + + StringBuilder sb = new StringBuilder(ConfigurazioneLocalServiceUtil.getApiServer(companyId)); + if (sb.charAt(sb.length() - 1) != '/') { + sb.append('/'); + } + sb.append(suffix); + return sb.toString(); + } + + public static Map getUserInfo(long companyId, String token) { + + JSONObject map = JSONFactoryUtil.createJSONObject(); + map.put(ApiConstants.PARAMETER_AUTH, auth).put(ApiConstants.PARAMETER_TOKEN, token); + map = post(companyId, ENDPOINT_GET_USER, map); + if (Validator.isNotNull(map)) { + switch (map.getInt(LABEL_ERROR_CODE)) { + case ERROR_OK: + Map ret = new HashMap(); + ret.put(ApiConstants.PARAMETER_FIRST_NAME, map.getString(ApiConstants.PARAMETER_FIRST_NAME)); + ret.put(ApiConstants.PARAMETER_LAST_NAME, map.getString(ApiConstants.PARAMETER_LAST_NAME)); + ret.put(ApiConstants.PARAMETER_CODICE_FISCALE, map.getString(ApiConstants.PARAMETER_CODICE_FISCALE)); + return ret; + default: + _log.error("Errore durante il recupero dei dati utente: " + map.toString()); + } + } + return null; + } + + private static void login(long companyId) { + + JSONObject map = JSONFactoryUtil.createJSONObject(); + map.put(ApiConstants.PARAMETER_USERNAME, ConfigurazioneLocalServiceUtil.getApiUsername(companyId)); + map.put(ApiConstants.PARAMETER_PASSWORD, ConfigurazioneLocalServiceUtil.getApiPassword(companyId)); + map = post(companyId, ENDPOINT_LOGIN, map); + if (Validator.isNotNull(map)) { + if (ERROR_OK == map.getInt(LABEL_ERROR_CODE)) { + auth = map.getString(ApiConstants.PARAMETER_AUTH); + } else { + _log.error("Errore durante il login: " + map.toString()); + auth = null; + } + } + } + + private static JSONObject post(long companyId, String endPoint, JSONObject json) { + + try { + URL url = new URL(getUrl(companyId, endPoint)); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("POST"); + connection.setRequestProperty("User-Agent", HTTP_USER_AGENT); + connection.setDoOutput(true); + connection.setReadTimeout(10000); + OutputStream stream = connection.getOutputStream(); + stream.write(json.toString().getBytes()); + stream.flush(); + stream.close(); + int code = connection.getResponseCode(); + String response = readResponse(connection); + connection.disconnect(); + if (code == HttpURLConnection.HTTP_OK) { + JSONObject ret = JSONFactoryUtil.createJSONObject(response); + return ret; + } else { + _log.error("Inviato: " + json.toString() + " (" + url.toString() + endPoint + ")"); + _log.error("Ricevuto: " + response); + } + } catch (IOException | JSONException e) { + _log.error(e); + } + return null; + } + + private static String readResponse(HttpURLConnection connection) throws IOException { + + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + StringBuilder builder = new StringBuilder(); + String inputLine; + while ((inputLine = reader.readLine()) != null) { + builder.append(inputLine); + } + reader.close(); + return builder.toString(); + } + + private static final Log _log = LogFactoryUtil.getLog(ApiUtil.class); + + private static String auth = null; + + private static final String ENDPOINT_LOGIN = "api/v1/login.cgi"; + private static final String ENDPOINT_GET_TOKEN = "api/v1/get_token.cgi"; + private static final String ENDPOINT_GET_USER = "api/v1/get_user.cgi"; + + private static final int ERROR_OK = 0; + private static final int ERROR_INVALID_AUTH = 1; + + private static final String LABEL_ERROR_CODE = "code"; + + private static final String HTTP_USER_AGENT = "Sicilia Login like Mozilla/5.0"; +} diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/src/portal.properties b/hooks/sicilia-login-hook/docroot/WEB-INF/src/portal.properties new file mode 100644 index 0000000..49465fe --- /dev/null +++ b/hooks/sicilia-login-hook/docroot/WEB-INF/src/portal.properties @@ -0,0 +1,2 @@ +#auth.pipeline.enable.liferay.check=false +auto.login.hooks=it.mwg.sicilia.login.filter.SiciliaAutoLogin diff --git a/hooks/sicilia-login-hook/docroot/WEB-INF/web.xml b/hooks/sicilia-login-hook/docroot/WEB-INF/web.xml new file mode 100644 index 0000000..ff1320b --- /dev/null +++ b/hooks/sicilia-login-hook/docroot/WEB-INF/web.xml @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/hooks/sicilia-login-hook/ivy.xml b/hooks/sicilia-login-hook/ivy.xml new file mode 100644 index 0000000..af13eba --- /dev/null +++ b/hooks/sicilia-login-hook/ivy.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hooks/sicilia-login-hook/ivy.xml.MD5 b/hooks/sicilia-login-hook/ivy.xml.MD5 new file mode 100644 index 0000000..3860cef --- /dev/null +++ b/hooks/sicilia-login-hook/ivy.xml.MD5 @@ -0,0 +1 @@ +f32cef52cdc5e9d134e7a5e7d76b9c50 diff --git a/hooks/sicilia-login-hook/test/integration/arquillian.xml b/hooks/sicilia-login-hook/test/integration/arquillian.xml new file mode 100644 index 0000000..9413609 --- /dev/null +++ b/hooks/sicilia-login-hook/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + 8099 + tomcat + tomcat + + + \ No newline at end of file diff --git a/ivy-settings-publisher.xml b/ivy-settings-publisher.xml new file mode 100644 index 0000000..a1588f7 --- /dev/null +++ b/ivy-settings-publisher.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ivy-settings.xml b/ivy-settings.xml new file mode 100644 index 0000000..30a41fe --- /dev/null +++ b/ivy-settings.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ivy.xml b/ivy.xml new file mode 100644 index 0000000..abc54a8 --- /dev/null +++ b/ivy.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ivy.xml.MD5 b/ivy.xml.MD5 new file mode 100644 index 0000000..feae7b2 --- /dev/null +++ b/ivy.xml.MD5 @@ -0,0 +1 @@ +ae2292c03b059802eec34967b7e85b8a diff --git a/layouttpl/build-common-layouttpl.xml b/layouttpl/build-common-layouttpl.xml new file mode 100644 index 0000000..97d42d0 --- /dev/null +++ b/layouttpl/build-common-layouttpl.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/layouttpl/build.xml b/layouttpl/build.xml new file mode 100644 index 0000000..ce61cfa --- /dev/null +++ b/layouttpl/build.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + This task must be called by the create script. + + + + + + + + + + ${layouttpl.name}-layouttpl already exists. + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/layouttpl/create.bat b/layouttpl/create.bat new file mode 100644 index 0000000..61c6e3b --- /dev/null +++ b/layouttpl/create.bat @@ -0,0 +1,28 @@ +@echo off + +if "" == "%1" goto errorCreate +if "" == "%2" goto errorCreate + +call ant -Dlayouttpl.name=%1 -Dlayouttpl.display.name=%2 create + +cd %1-layouttpl + +rem call ant deploy + +cd .. + +goto end + +:errorCreate + echo. + echo Usage: create.bat hello-world "Hello World" + echo. + echo The first hello-world is your layouttpl id. A new directory will be created + echo based on the layouttpl id. + echo. + echo The second "Hello World" is the layouttpl's display name. The quotation marks + echo are only needed because there is a space in the display name. + + goto end + +:end \ No newline at end of file diff --git a/layouttpl/create.sh b/layouttpl/create.sh new file mode 100644 index 0000000..ab37c3f --- /dev/null +++ b/layouttpl/create.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +#set -x + +if [ $# -lt 2 ]; then + echo + echo Usage: ./create.sh hello-world \"Hello World\" + echo + echo The first hello-world is your layouttpl id. A new directory will be created + echo based on the layouttpl id. + echo + echo The second \"Hello World\" is the layouttpl\'s display name. The quotation marks + echo are only needed because there is a space in the display name. + + exit 127 +fi + +ant -Dlayouttpl.name=$1 -Dlayouttpl.display.name=\"$2\" create + +cd $1-layouttpl + +#ant deploy + +exit 0 \ No newline at end of file diff --git a/lib/activation.jar b/lib/activation.jar new file mode 100644 index 0000000..53f82a1 Binary files /dev/null and b/lib/activation.jar differ diff --git a/lib/ant-apache-bsf.jar b/lib/ant-apache-bsf.jar new file mode 100644 index 0000000..5196d57 Binary files /dev/null and b/lib/ant-apache-bsf.jar differ diff --git a/lib/ant-contrib.jar b/lib/ant-contrib.jar new file mode 100644 index 0000000..0625376 Binary files /dev/null and b/lib/ant-contrib.jar differ diff --git a/lib/ant-launcher.jar b/lib/ant-launcher.jar new file mode 100644 index 0000000..e1dcfb2 Binary files /dev/null and b/lib/ant-launcher.jar differ diff --git a/lib/ant.jar b/lib/ant.jar new file mode 100644 index 0000000..f68c9cf Binary files /dev/null and b/lib/ant.jar differ diff --git a/lib/antelopetasks.jar b/lib/antelopetasks.jar new file mode 100644 index 0000000..ff6375d Binary files /dev/null and b/lib/antelopetasks.jar differ diff --git a/lib/bcpg-jdk16.jar b/lib/bcpg-jdk16.jar new file mode 100644 index 0000000..8e51360 Binary files /dev/null and b/lib/bcpg-jdk16.jar differ diff --git a/lib/bcprov-jdk16.jar b/lib/bcprov-jdk16.jar new file mode 100644 index 0000000..27d3481 Binary files /dev/null and b/lib/bcprov-jdk16.jar differ diff --git a/lib/bsf.jar b/lib/bsf.jar new file mode 100644 index 0000000..2288c36 Binary files /dev/null and b/lib/bsf.jar differ diff --git a/lib/bsh.jar b/lib/bsh.jar new file mode 100644 index 0000000..36fe03d Binary files /dev/null and b/lib/bsh.jar differ diff --git a/lib/ccpp.jar b/lib/ccpp.jar new file mode 100644 index 0000000..a06a98a Binary files /dev/null and b/lib/ccpp.jar differ diff --git a/lib/commons-logging.jar b/lib/commons-logging.jar new file mode 100644 index 0000000..1deef14 Binary files /dev/null and b/lib/commons-logging.jar differ diff --git a/lib/ecj.jar b/lib/ecj.jar new file mode 100644 index 0000000..92f9909 Binary files /dev/null and b/lib/ecj.jar differ diff --git a/lib/error_prone_ant.jar b/lib/error_prone_ant.jar new file mode 100644 index 0000000..e4282e3 Binary files /dev/null and b/lib/error_prone_ant.jar differ diff --git a/lib/jalopy.jar b/lib/jalopy.jar new file mode 100644 index 0000000..fe51ce2 Binary files /dev/null and b/lib/jalopy.jar differ diff --git a/lib/javax.servlet-api.jar b/lib/javax.servlet-api.jar new file mode 100644 index 0000000..4e2edcc Binary files /dev/null and b/lib/javax.servlet-api.jar differ diff --git a/lib/jsp-api.jar b/lib/jsp-api.jar new file mode 100644 index 0000000..c0195af Binary files /dev/null and b/lib/jsp-api.jar differ diff --git a/lib/log4j.jar b/lib/log4j.jar new file mode 100644 index 0000000..5429a90 Binary files /dev/null and b/lib/log4j.jar differ diff --git a/lib/mail.jar b/lib/mail.jar new file mode 100644 index 0000000..fd4555b Binary files /dev/null and b/lib/mail.jar differ diff --git a/lib/net.sf.jargs.jar b/lib/net.sf.jargs.jar new file mode 100644 index 0000000..cdbc80b Binary files /dev/null and b/lib/net.sf.jargs.jar differ diff --git a/lib/org.osgi.compendium.jar b/lib/org.osgi.compendium.jar new file mode 100644 index 0000000..84141aa Binary files /dev/null and b/lib/org.osgi.compendium.jar differ diff --git a/lib/org.osgi.core.jar b/lib/org.osgi.core.jar new file mode 100644 index 0000000..d881a6a Binary files /dev/null and b/lib/org.osgi.core.jar differ diff --git a/lib/qdox.jar b/lib/qdox.jar new file mode 100644 index 0000000..092fc51 Binary files /dev/null and b/lib/qdox.jar differ diff --git a/lib/serializer.jar b/lib/serializer.jar new file mode 100644 index 0000000..99f98db Binary files /dev/null and b/lib/serializer.jar differ diff --git a/lib/xalan.jar b/lib/xalan.jar new file mode 100644 index 0000000..458fa73 Binary files /dev/null and b/lib/xalan.jar differ diff --git a/lib/xercesImpl.jar b/lib/xercesImpl.jar new file mode 100644 index 0000000..9dcd8c3 Binary files /dev/null and b/lib/xercesImpl.jar differ diff --git a/lib/xml-apis.jar b/lib/xml-apis.jar new file mode 100644 index 0000000..4673346 Binary files /dev/null and b/lib/xml-apis.jar differ diff --git a/misc/jalopy.xml b/misc/jalopy.xml new file mode 100644 index 0000000..03ba99e --- /dev/null +++ b/misc/jalopy.xml @@ -0,0 +1,78 @@ + + + + +6 + + + + +
1
+1 +
+
+ + + +1 + + +/** + * @author $author$ +*/ +/** + * @author $author$ +*/ + + + +true + + +
+/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ +true +
+ + +0 +4 + + +true + + + +false + + + +false + + + + +false + + + + + +true + + + +
+
\ No newline at end of file diff --git a/osgi/lib/plugin/bnd-repository.jar b/osgi/lib/plugin/bnd-repository.jar new file mode 100644 index 0000000..944ae0d Binary files /dev/null and b/osgi/lib/plugin/bnd-repository.jar differ diff --git a/portlets/build-common-alloy-portlet.xml b/portlets/build-common-alloy-portlet.xml new file mode 100644 index 0000000..aa5aec6 --- /dev/null +++ b/portlets/build-common-alloy-portlet.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/portlets/build-common-portlet.xml b/portlets/build-common-portlet.xml new file mode 100644 index 0000000..cfaaabc --- /dev/null +++ b/portlets/build-common-portlet.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/portlets/build.xml b/portlets/build.xml new file mode 100644 index 0000000..a235541 --- /dev/null +++ b/portlets/build.xml @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + This task must be called by the create script. + + + + + + + + + + ${portlet.dir} already exists. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +portal-dependency-jars=commons-beanutils.jar,commons-collections.jar,commons-digester.jar,commons-fileupload.jar,commons-io.jar,commons-lang.jar + +speed-filters-enabled=false + + + + + +portal-dependency-jars=commons-beanutils.jar,commons-collections.jar,commons-digester.jar,commons-lang.jar + +speed-filters-enabled=false + + + + + + ]]> + + false + false]]> + + + + + + + + com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet]]> + javax.portlet.faces.GenericFacesPortlet]]> + + + + view-template]]> + javax.portlet.faces.defaultViewId.view]]> + + + + /view.jsp]]> + /views/view.xhtml]]> + + + + + + + + + + + + + + + + + + + +portal-dependency-jars=aopalliance.jar,commons-logging.jar,jstl-api.jar,jstl-impl.jar,spring-aop.jar,spring-beans.jar,spring-context.jar,spring-core.jar,spring-expression.jar,spring-web.jar,spring-webmvc.jar,spring-webmvc-portlet.jar + + + ]]> + + false]]> + + + + com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet]]> + org.springframework.web.portlet.DispatcherPortlet]]> + + + + view-template]]> + contextConfigLocation]]> + + + + /view.jsp]]> + /WEB-INF/spring-context/portlet/@portlet.name@-portlet.xml]]> + + + + + + + + + + + + + + + +portal-dependency-jars=vaadin.jar + + + com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet]]> + com.vaadin.terminal.gwt.server.ApplicationPortlet2]]> + + + + view-template]]> + application]]> + + + + /view.jsp]]> + @portlet.java.package.name@.@portlet.java.class.name@Application]]> + + + + + + + + ]]> + + false + false]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/portlets/create.bat b/portlets/create.bat new file mode 100644 index 0000000..baaa1a7 --- /dev/null +++ b/portlets/create.bat @@ -0,0 +1,33 @@ +@echo off + +if "" == "%1" goto errorCreate + +if "" == "%2" goto errorCreate + +if "" == "%3" set PORTLET_FRAMEWORK=mvc +if not "" == "%3" set PORTLET_FRAMEWORK=%3 + +call ant -Dportlet.name=%1 -Dportlet.display.name=%2 -Dportlet.framework=%PORTLET_FRAMEWORK% create + +rem call ant deploy + +goto end + +:errorCreate + echo. + echo Usage: create.bat hello-world "Hello World" + echo. + echo The first hello-world is your portlet id. A new directory will be created based + echo on the portlet id. + echo. + echo The second "Hello World" is the portlet's display name. The quotation marks are + echo only needed because there is a space in the display name. + echo. + echo A third value can be passed to specify the portlet framework to use. Valid + echo values are "jsf", "icefaces", "liferay_faces_alloy", "mvc", "primefaces", + echo "richfaces", "spring_mvc", or "vaadin". The default value is "mvc". The + echo quotation marks are not needed. + + goto end + +:end \ No newline at end of file diff --git a/portlets/create.sh b/portlets/create.sh new file mode 100644 index 0000000..4e41fb8 --- /dev/null +++ b/portlets/create.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +#set -x + +if [ $# -lt 2 ]; then + echo + echo Usage: ./create.sh hello-world \"Hello World\" + echo + echo The first hello-world is your portlet id. A new directory will be created based + echo on the portlet id. + echo + echo The second \"Hello World\" is the portlet\'s display name. The quotation marks are + echo only needed because there is a space in the display name. + echo + echo A third value can be passed to specify the portlet framework to use. Valid + echo values are \"jsf\", \"icefaces\", \"liferay_faces_alloy\", \"mvc\", \"primefaces\", + echo \"richfaces\", \"spring_mvc\", or \"vaadin\". The default value is \"mvc\". The + echo quotation marks are not needed. + + exit 127 +fi + +ant -Dportlet.name=$1 -Dportlet.display.name=\"$2\" -Dportlet.framework=$3 create + +#ant deploy + +exit 0 \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/.classpath b/portlets/sicilia-login-portlet/.classpath new file mode 100644 index 0000000..2dcb5cc --- /dev/null +++ b/portlets/sicilia-login-portlet/.classpath @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/portlets/sicilia-login-portlet/.project b/portlets/sicilia-login-portlet/.project new file mode 100644 index 0000000..3c9468f --- /dev/null +++ b/portlets/sicilia-login-portlet/.project @@ -0,0 +1,48 @@ + + + sicilia-login-portlet + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.apache.ivyde.eclipse.ivynature + org.eclipse.wst.jsdt.core.jsNature + + + + 1669365750355 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/portlets/sicilia-login-portlet/.settings/.jsdtscope b/portlets/sicilia-login-portlet/.settings/.jsdtscope new file mode 100644 index 0000000..840a01d --- /dev/null +++ b/portlets/sicilia-login-portlet/.settings/.jsdtscope @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/portlets/sicilia-login-portlet/.settings/org.eclipse.jdt.core.prefs b/portlets/sicilia-login-portlet/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f42de36 --- /dev/null +++ b/portlets/sicilia-login-portlet/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/portlets/sicilia-login-portlet/.settings/org.eclipse.jst.jsp.core.prefs b/portlets/sicilia-login-portlet/.settings/org.eclipse.jst.jsp.core.prefs new file mode 100644 index 0000000..3a5c98d --- /dev/null +++ b/portlets/sicilia-login-portlet/.settings/org.eclipse.jst.jsp.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +validateFragments=false +validation.use-project-settings=true diff --git a/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.common.component b/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..4b5261c --- /dev/null +++ b/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.common.component @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000..500dfcc --- /dev/null +++ b/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.common.project.facet.core.xml b/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..b0264db --- /dev/null +++ b/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.jsdt.ui.superType.container b/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.jsdt.ui.superType.name b/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/portlets/sicilia-login-portlet/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/.tern-project b/portlets/sicilia-login-portlet/.tern-project new file mode 100644 index 0000000..a185ba0 --- /dev/null +++ b/portlets/sicilia-login-portlet/.tern-project @@ -0,0 +1 @@ +{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/build.xml b/portlets/sicilia-login-portlet/build.xml new file mode 100644 index 0000000..28b5809 --- /dev/null +++ b/portlets/sicilia-login-portlet/build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/META-INF/MANIFEST.MF b/portlets/sicilia-login-portlet/docroot/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/.gitignore b/portlets/sicilia-login-portlet/docroot/WEB-INF/.gitignore new file mode 100644 index 0000000..840e7d3 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/.gitignore @@ -0,0 +1 @@ +/classes/ diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/lib/commons-codec.jar b/portlets/sicilia-login-portlet/docroot/WEB-INF/lib/commons-codec.jar new file mode 100644 index 0000000..1d7417c Binary files /dev/null and b/portlets/sicilia-login-portlet/docroot/WEB-INF/lib/commons-codec.jar differ diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-display.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-display.xml new file mode 100644 index 0000000..13b1cbc --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-display.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-hook.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-hook.xml new file mode 100644 index 0000000..812685c --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-hook.xml @@ -0,0 +1,5 @@ + + + + portal.properties + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-plugin-package.properties b/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..d5caeca --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,13 @@ +name=Sicilia Login Portlet +module-group-id=liferay +module-incremental-version=1 +tags= +short-description= +long-description= +change-log= +page-url=http://www.liferay.com +author=Manifattura Web Group s.r.l. +licenses=LGPL +liferay-versions=6.2.0+ +portal-dependency-tlds=c.tld +portal-dependency-jars=jstl-impl.jar diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-portlet.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-portlet.xml new file mode 100644 index 0000000..7884cc2 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/liferay-portlet.xml @@ -0,0 +1,27 @@ + + + + + + configurazione-sicilia-login + /icon.png + configuration + 1.2 + + + administrator + Administrator + + + guest + Guest + + + power-user + Power User + + + user + User + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/portlet.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/portlet.xml new file mode 100644 index 0000000..0db3cf0 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/portlet.xml @@ -0,0 +1,39 @@ + + + + + + configurazione-sicilia-login + Configurazione Login Hook + it.mwg.sicilia.login.portlet.ConfigurazioneLogin + + view-template + /html/configurazione/view.jsp + + 0 + + text/html + view + + content.Language + + Sicilia Login Portlet + Sicilia Login Portlet + + + + administrator + + + guest + + + power-user + + + user + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/service.xml new file mode 100644 index 0000000..8ee3b27 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service.xml @@ -0,0 +1,26 @@ + + + + Manifattura Web Group s.r.l. + sicilia_login + + + + + + + + + + + + + + + + + + + + diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/NoSuchConfigurazioneException.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/NoSuchConfigurazioneException.java new file mode 100644 index 0000000..4c12eb7 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/NoSuchConfigurazioneException.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login; + +import com.liferay.portal.NoSuchModelException; + +/** + * @author Manifattura Web Group s.r.l. + */ +public class NoSuchConfigurazioneException extends NoSuchModelException { + + public NoSuchConfigurazioneException() { + super(); + } + + public NoSuchConfigurazioneException(String msg) { + super(msg); + } + + public NoSuchConfigurazioneException(String msg, Throwable cause) { + super(msg, cause); + } + + public NoSuchConfigurazioneException(Throwable cause) { + super(cause); + } + +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/Configurazione.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/Configurazione.java new file mode 100644 index 0000000..27b9849 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/Configurazione.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.model; + +import com.liferay.portal.model.PersistedModel; + +/** + * The extended model interface for the Configurazione service. Represents a row in the "sicilia_login_Configurazione" database table, with each column mapped to a property of this class. + * + * @author Manifattura Web Group s.r.l. + * @see ConfigurazioneModel + * @see it.mwg.sicilia.login.model.impl.ConfigurazioneImpl + * @see it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl + * @generated + */ +public interface Configurazione extends ConfigurazioneModel, PersistedModel { + /* + * NOTE FOR DEVELOPERS: + * + * Never modify this interface directly. Add methods to {@link it.mwg.sicilia.login.model.impl.ConfigurazioneImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. + */ +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneClp.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneClp.java new file mode 100644 index 0000000..16d2475 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneClp.java @@ -0,0 +1,547 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.model; + +import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.util.ProxyUtil; +import com.liferay.portal.kernel.util.StringBundler; +import com.liferay.portal.model.BaseModel; +import com.liferay.portal.model.impl.BaseModelImpl; +import com.liferay.portal.util.PortalUtil; + +import it.mwg.sicilia.login.service.ClpSerializer; +import it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil; + +import java.io.Serializable; + +import java.lang.reflect.Method; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Manifattura Web Group s.r.l. + */ +public class ConfigurazioneClp extends BaseModelImpl + implements Configurazione { + public ConfigurazioneClp() { + } + + @Override + public Class getModelClass() { + return Configurazione.class; + } + + @Override + public String getModelClassName() { + return Configurazione.class.getName(); + } + + @Override + public long getPrimaryKey() { + return _configurazioneId; + } + + @Override + public void setPrimaryKey(long primaryKey) { + setConfigurazioneId(primaryKey); + } + + @Override + public Serializable getPrimaryKeyObj() { + return _configurazioneId; + } + + @Override + public void setPrimaryKeyObj(Serializable primaryKeyObj) { + setPrimaryKey(((Long)primaryKeyObj).longValue()); + } + + @Override + public Map getModelAttributes() { + Map attributes = new HashMap(); + + attributes.put("configurazioneId", getConfigurazioneId()); + attributes.put("nome", getNome()); + attributes.put("valore", getValore()); + attributes.put("companyId", getCompanyId()); + attributes.put("userId", getUserId()); + attributes.put("userName", getUserName()); + attributes.put("createDate", getCreateDate()); + attributes.put("modifiedDate", getModifiedDate()); + + return attributes; + } + + @Override + public void setModelAttributes(Map attributes) { + Long configurazioneId = (Long)attributes.get("configurazioneId"); + + if (configurazioneId != null) { + setConfigurazioneId(configurazioneId); + } + + String nome = (String)attributes.get("nome"); + + if (nome != null) { + setNome(nome); + } + + String valore = (String)attributes.get("valore"); + + if (valore != null) { + setValore(valore); + } + + Long companyId = (Long)attributes.get("companyId"); + + if (companyId != null) { + setCompanyId(companyId); + } + + Long userId = (Long)attributes.get("userId"); + + if (userId != null) { + setUserId(userId); + } + + String userName = (String)attributes.get("userName"); + + if (userName != null) { + setUserName(userName); + } + + Date createDate = (Date)attributes.get("createDate"); + + if (createDate != null) { + setCreateDate(createDate); + } + + Date modifiedDate = (Date)attributes.get("modifiedDate"); + + if (modifiedDate != null) { + setModifiedDate(modifiedDate); + } + } + + @Override + public long getConfigurazioneId() { + return _configurazioneId; + } + + @Override + public void setConfigurazioneId(long configurazioneId) { + _configurazioneId = configurazioneId; + + if (_configurazioneRemoteModel != null) { + try { + Class clazz = _configurazioneRemoteModel.getClass(); + + Method method = clazz.getMethod("setConfigurazioneId", + long.class); + + method.invoke(_configurazioneRemoteModel, configurazioneId); + } + catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + } + + @Override + public String getNome() { + return _nome; + } + + @Override + public void setNome(String nome) { + _nome = nome; + + if (_configurazioneRemoteModel != null) { + try { + Class clazz = _configurazioneRemoteModel.getClass(); + + Method method = clazz.getMethod("setNome", String.class); + + method.invoke(_configurazioneRemoteModel, nome); + } + catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + } + + @Override + public String getValore() { + return _valore; + } + + @Override + public void setValore(String valore) { + _valore = valore; + + if (_configurazioneRemoteModel != null) { + try { + Class clazz = _configurazioneRemoteModel.getClass(); + + Method method = clazz.getMethod("setValore", String.class); + + method.invoke(_configurazioneRemoteModel, valore); + } + catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + } + + @Override + public long getCompanyId() { + return _companyId; + } + + @Override + public void setCompanyId(long companyId) { + _companyId = companyId; + + if (_configurazioneRemoteModel != null) { + try { + Class clazz = _configurazioneRemoteModel.getClass(); + + Method method = clazz.getMethod("setCompanyId", long.class); + + method.invoke(_configurazioneRemoteModel, companyId); + } + catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + } + + @Override + public long getUserId() { + return _userId; + } + + @Override + public void setUserId(long userId) { + _userId = userId; + + if (_configurazioneRemoteModel != null) { + try { + Class clazz = _configurazioneRemoteModel.getClass(); + + Method method = clazz.getMethod("setUserId", long.class); + + method.invoke(_configurazioneRemoteModel, userId); + } + catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + } + + @Override + public String getUserUuid() throws SystemException { + return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid); + } + + @Override + public void setUserUuid(String userUuid) { + _userUuid = userUuid; + } + + @Override + public String getUserName() { + return _userName; + } + + @Override + public void setUserName(String userName) { + _userName = userName; + + if (_configurazioneRemoteModel != null) { + try { + Class clazz = _configurazioneRemoteModel.getClass(); + + Method method = clazz.getMethod("setUserName", String.class); + + method.invoke(_configurazioneRemoteModel, userName); + } + catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + } + + @Override + public Date getCreateDate() { + return _createDate; + } + + @Override + public void setCreateDate(Date createDate) { + _createDate = createDate; + + if (_configurazioneRemoteModel != null) { + try { + Class clazz = _configurazioneRemoteModel.getClass(); + + Method method = clazz.getMethod("setCreateDate", Date.class); + + method.invoke(_configurazioneRemoteModel, createDate); + } + catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + } + + @Override + public Date getModifiedDate() { + return _modifiedDate; + } + + @Override + public void setModifiedDate(Date modifiedDate) { + _modifiedDate = modifiedDate; + + if (_configurazioneRemoteModel != null) { + try { + Class clazz = _configurazioneRemoteModel.getClass(); + + Method method = clazz.getMethod("setModifiedDate", Date.class); + + method.invoke(_configurazioneRemoteModel, modifiedDate); + } + catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + } + + public BaseModel getConfigurazioneRemoteModel() { + return _configurazioneRemoteModel; + } + + public void setConfigurazioneRemoteModel( + BaseModel configurazioneRemoteModel) { + _configurazioneRemoteModel = configurazioneRemoteModel; + } + + public Object invokeOnRemoteModel(String methodName, + Class[] parameterTypes, Object[] parameterValues) + throws Exception { + Object[] remoteParameterValues = new Object[parameterValues.length]; + + for (int i = 0; i < parameterValues.length; i++) { + if (parameterValues[i] != null) { + remoteParameterValues[i] = ClpSerializer.translateInput(parameterValues[i]); + } + } + + Class remoteModelClass = _configurazioneRemoteModel.getClass(); + + ClassLoader remoteModelClassLoader = remoteModelClass.getClassLoader(); + + Class[] remoteParameterTypes = new Class[parameterTypes.length]; + + for (int i = 0; i < parameterTypes.length; i++) { + if (parameterTypes[i].isPrimitive()) { + remoteParameterTypes[i] = parameterTypes[i]; + } + else { + String parameterTypeName = parameterTypes[i].getName(); + + remoteParameterTypes[i] = remoteModelClassLoader.loadClass(parameterTypeName); + } + } + + Method method = remoteModelClass.getMethod(methodName, + remoteParameterTypes); + + Object returnValue = method.invoke(_configurazioneRemoteModel, + remoteParameterValues); + + if (returnValue != null) { + returnValue = ClpSerializer.translateOutput(returnValue); + } + + return returnValue; + } + + @Override + public void persist() throws SystemException { + if (this.isNew()) { + ConfigurazioneLocalServiceUtil.addConfigurazione(this); + } + else { + ConfigurazioneLocalServiceUtil.updateConfigurazione(this); + } + } + + @Override + public Configurazione toEscapedModel() { + return (Configurazione)ProxyUtil.newProxyInstance(Configurazione.class.getClassLoader(), + new Class[] { Configurazione.class }, + new AutoEscapeBeanHandler(this)); + } + + @Override + public Object clone() { + ConfigurazioneClp clone = new ConfigurazioneClp(); + + clone.setConfigurazioneId(getConfigurazioneId()); + clone.setNome(getNome()); + clone.setValore(getValore()); + clone.setCompanyId(getCompanyId()); + clone.setUserId(getUserId()); + clone.setUserName(getUserName()); + clone.setCreateDate(getCreateDate()); + clone.setModifiedDate(getModifiedDate()); + + return clone; + } + + @Override + public int compareTo(Configurazione configurazione) { + long primaryKey = configurazione.getPrimaryKey(); + + if (getPrimaryKey() < primaryKey) { + return -1; + } + else if (getPrimaryKey() > primaryKey) { + return 1; + } + else { + return 0; + } + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (!(obj instanceof ConfigurazioneClp)) { + return false; + } + + ConfigurazioneClp configurazione = (ConfigurazioneClp)obj; + + long primaryKey = configurazione.getPrimaryKey(); + + if (getPrimaryKey() == primaryKey) { + return true; + } + else { + return false; + } + } + + public Class getClpSerializerClass() { + return _clpSerializerClass; + } + + @Override + public int hashCode() { + return (int)getPrimaryKey(); + } + + @Override + public String toString() { + StringBundler sb = new StringBundler(17); + + sb.append("{configurazioneId="); + sb.append(getConfigurazioneId()); + sb.append(", nome="); + sb.append(getNome()); + sb.append(", valore="); + sb.append(getValore()); + sb.append(", companyId="); + sb.append(getCompanyId()); + sb.append(", userId="); + sb.append(getUserId()); + sb.append(", userName="); + sb.append(getUserName()); + sb.append(", createDate="); + sb.append(getCreateDate()); + sb.append(", modifiedDate="); + sb.append(getModifiedDate()); + sb.append("}"); + + return sb.toString(); + } + + @Override + public String toXmlString() { + StringBundler sb = new StringBundler(28); + + sb.append(""); + sb.append("it.mwg.sicilia.login.model.Configurazione"); + sb.append(""); + + sb.append( + "configurazioneId"); + sb.append( + "nome"); + sb.append( + "valore"); + sb.append( + "companyId"); + sb.append( + "userId"); + sb.append( + "userName"); + sb.append( + "createDate"); + sb.append( + "modifiedDate"); + + sb.append(""); + + return sb.toString(); + } + + private long _configurazioneId; + private String _nome; + private String _valore; + private long _companyId; + private long _userId; + private String _userUuid; + private String _userName; + private Date _createDate; + private Date _modifiedDate; + private BaseModel _configurazioneRemoteModel; + private Class _clpSerializerClass = it.mwg.sicilia.login.service.ClpSerializer.class; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneModel.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneModel.java new file mode 100644 index 0000000..419b26c --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneModel.java @@ -0,0 +1,264 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.model; + +import com.liferay.portal.kernel.bean.AutoEscape; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.model.AuditedModel; +import com.liferay.portal.model.BaseModel; +import com.liferay.portal.model.CacheModel; +import com.liferay.portal.service.ServiceContext; + +import com.liferay.portlet.expando.model.ExpandoBridge; + +import java.io.Serializable; + +import java.util.Date; + +/** + * The base model interface for the Configurazione service. Represents a row in the "sicilia_login_Configurazione" database table, with each column mapped to a property of this class. + * + *

+ * This interface and its corresponding implementation {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link it.mwg.sicilia.login.model.impl.ConfigurazioneImpl}. + *

+ * + * @author Manifattura Web Group s.r.l. + * @see Configurazione + * @see it.mwg.sicilia.login.model.impl.ConfigurazioneImpl + * @see it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl + * @generated + */ +public interface ConfigurazioneModel extends AuditedModel, + BaseModel { + /* + * NOTE FOR DEVELOPERS: + * + * Never modify or reference this interface directly. All methods that expect a configurazione model instance should use the {@link Configurazione} interface instead. + */ + + /** + * Returns the primary key of this configurazione. + * + * @return the primary key of this configurazione + */ + public long getPrimaryKey(); + + /** + * Sets the primary key of this configurazione. + * + * @param primaryKey the primary key of this configurazione + */ + public void setPrimaryKey(long primaryKey); + + /** + * Returns the configurazione ID of this configurazione. + * + * @return the configurazione ID of this configurazione + */ + public long getConfigurazioneId(); + + /** + * Sets the configurazione ID of this configurazione. + * + * @param configurazioneId the configurazione ID of this configurazione + */ + public void setConfigurazioneId(long configurazioneId); + + /** + * Returns the nome of this configurazione. + * + * @return the nome of this configurazione + */ + @AutoEscape + public String getNome(); + + /** + * Sets the nome of this configurazione. + * + * @param nome the nome of this configurazione + */ + public void setNome(String nome); + + /** + * Returns the valore of this configurazione. + * + * @return the valore of this configurazione + */ + @AutoEscape + public String getValore(); + + /** + * Sets the valore of this configurazione. + * + * @param valore the valore of this configurazione + */ + public void setValore(String valore); + + /** + * Returns the company ID of this configurazione. + * + * @return the company ID of this configurazione + */ + @Override + public long getCompanyId(); + + /** + * Sets the company ID of this configurazione. + * + * @param companyId the company ID of this configurazione + */ + @Override + public void setCompanyId(long companyId); + + /** + * Returns the user ID of this configurazione. + * + * @return the user ID of this configurazione + */ + @Override + public long getUserId(); + + /** + * Sets the user ID of this configurazione. + * + * @param userId the user ID of this configurazione + */ + @Override + public void setUserId(long userId); + + /** + * Returns the user uuid of this configurazione. + * + * @return the user uuid of this configurazione + * @throws SystemException if a system exception occurred + */ + @Override + public String getUserUuid() throws SystemException; + + /** + * Sets the user uuid of this configurazione. + * + * @param userUuid the user uuid of this configurazione + */ + @Override + public void setUserUuid(String userUuid); + + /** + * Returns the user name of this configurazione. + * + * @return the user name of this configurazione + */ + @AutoEscape + @Override + public String getUserName(); + + /** + * Sets the user name of this configurazione. + * + * @param userName the user name of this configurazione + */ + @Override + public void setUserName(String userName); + + /** + * Returns the create date of this configurazione. + * + * @return the create date of this configurazione + */ + @Override + public Date getCreateDate(); + + /** + * Sets the create date of this configurazione. + * + * @param createDate the create date of this configurazione + */ + @Override + public void setCreateDate(Date createDate); + + /** + * Returns the modified date of this configurazione. + * + * @return the modified date of this configurazione + */ + @Override + public Date getModifiedDate(); + + /** + * Sets the modified date of this configurazione. + * + * @param modifiedDate the modified date of this configurazione + */ + @Override + public void setModifiedDate(Date modifiedDate); + + @Override + public boolean isNew(); + + @Override + public void setNew(boolean n); + + @Override + public boolean isCachedModel(); + + @Override + public void setCachedModel(boolean cachedModel); + + @Override + public boolean isEscapedModel(); + + @Override + public Serializable getPrimaryKeyObj(); + + @Override + public void setPrimaryKeyObj(Serializable primaryKeyObj); + + @Override + public ExpandoBridge getExpandoBridge(); + + @Override + public void setExpandoBridgeAttributes(BaseModel baseModel); + + @Override + public void setExpandoBridgeAttributes(ExpandoBridge expandoBridge); + + @Override + public void setExpandoBridgeAttributes(ServiceContext serviceContext); + + @Override + public Object clone(); + + @Override + public int compareTo( + it.mwg.sicilia.login.model.Configurazione configurazione); + + @Override + public int hashCode(); + + @Override + public CacheModel toCacheModel(); + + @Override + public it.mwg.sicilia.login.model.Configurazione toEscapedModel(); + + @Override + public it.mwg.sicilia.login.model.Configurazione toUnescapedModel(); + + @Override + public String toString(); + + @Override + public String toXmlString(); +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneSoap.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneSoap.java new file mode 100644 index 0000000..492033e --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneSoap.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.model; + +import java.io.Serializable; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * This class is used by SOAP remote services. + * + * @author Manifattura Web Group s.r.l. + * @generated + */ +public class ConfigurazioneSoap implements Serializable { + public static ConfigurazioneSoap toSoapModel(Configurazione model) { + ConfigurazioneSoap soapModel = new ConfigurazioneSoap(); + + soapModel.setConfigurazioneId(model.getConfigurazioneId()); + soapModel.setNome(model.getNome()); + soapModel.setValore(model.getValore()); + soapModel.setCompanyId(model.getCompanyId()); + soapModel.setUserId(model.getUserId()); + soapModel.setUserName(model.getUserName()); + soapModel.setCreateDate(model.getCreateDate()); + soapModel.setModifiedDate(model.getModifiedDate()); + + return soapModel; + } + + public static ConfigurazioneSoap[] toSoapModels(Configurazione[] models) { + ConfigurazioneSoap[] soapModels = new ConfigurazioneSoap[models.length]; + + for (int i = 0; i < models.length; i++) { + soapModels[i] = toSoapModel(models[i]); + } + + return soapModels; + } + + public static ConfigurazioneSoap[][] toSoapModels(Configurazione[][] models) { + ConfigurazioneSoap[][] soapModels = null; + + if (models.length > 0) { + soapModels = new ConfigurazioneSoap[models.length][models[0].length]; + } + else { + soapModels = new ConfigurazioneSoap[0][0]; + } + + for (int i = 0; i < models.length; i++) { + soapModels[i] = toSoapModels(models[i]); + } + + return soapModels; + } + + public static ConfigurazioneSoap[] toSoapModels(List models) { + List soapModels = new ArrayList(models.size()); + + for (Configurazione model : models) { + soapModels.add(toSoapModel(model)); + } + + return soapModels.toArray(new ConfigurazioneSoap[soapModels.size()]); + } + + public ConfigurazioneSoap() { + } + + public long getPrimaryKey() { + return _configurazioneId; + } + + public void setPrimaryKey(long pk) { + setConfigurazioneId(pk); + } + + public long getConfigurazioneId() { + return _configurazioneId; + } + + public void setConfigurazioneId(long configurazioneId) { + _configurazioneId = configurazioneId; + } + + public String getNome() { + return _nome; + } + + public void setNome(String nome) { + _nome = nome; + } + + public String getValore() { + return _valore; + } + + public void setValore(String valore) { + _valore = valore; + } + + public long getCompanyId() { + return _companyId; + } + + public void setCompanyId(long companyId) { + _companyId = companyId; + } + + public long getUserId() { + return _userId; + } + + public void setUserId(long userId) { + _userId = userId; + } + + public String getUserName() { + return _userName; + } + + public void setUserName(String userName) { + _userName = userName; + } + + public Date getCreateDate() { + return _createDate; + } + + public void setCreateDate(Date createDate) { + _createDate = createDate; + } + + public Date getModifiedDate() { + return _modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + _modifiedDate = modifiedDate; + } + + private long _configurazioneId; + private String _nome; + private String _valore; + private long _companyId; + private long _userId; + private String _userName; + private Date _createDate; + private Date _modifiedDate; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneWrapper.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneWrapper.java new file mode 100644 index 0000000..19b0b70 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/model/ConfigurazioneWrapper.java @@ -0,0 +1,461 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.model; + +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.model.ModelWrapper; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + *

+ * This class is a wrapper for {@link Configurazione}. + *

+ * + * @author Manifattura Web Group s.r.l. + * @see Configurazione + * @generated + */ +public class ConfigurazioneWrapper implements Configurazione, + ModelWrapper { + public ConfigurazioneWrapper(Configurazione configurazione) { + _configurazione = configurazione; + } + + @Override + public Class getModelClass() { + return Configurazione.class; + } + + @Override + public String getModelClassName() { + return Configurazione.class.getName(); + } + + @Override + public Map getModelAttributes() { + Map attributes = new HashMap(); + + attributes.put("configurazioneId", getConfigurazioneId()); + attributes.put("nome", getNome()); + attributes.put("valore", getValore()); + attributes.put("companyId", getCompanyId()); + attributes.put("userId", getUserId()); + attributes.put("userName", getUserName()); + attributes.put("createDate", getCreateDate()); + attributes.put("modifiedDate", getModifiedDate()); + + return attributes; + } + + @Override + public void setModelAttributes(Map attributes) { + Long configurazioneId = (Long)attributes.get("configurazioneId"); + + if (configurazioneId != null) { + setConfigurazioneId(configurazioneId); + } + + String nome = (String)attributes.get("nome"); + + if (nome != null) { + setNome(nome); + } + + String valore = (String)attributes.get("valore"); + + if (valore != null) { + setValore(valore); + } + + Long companyId = (Long)attributes.get("companyId"); + + if (companyId != null) { + setCompanyId(companyId); + } + + Long userId = (Long)attributes.get("userId"); + + if (userId != null) { + setUserId(userId); + } + + String userName = (String)attributes.get("userName"); + + if (userName != null) { + setUserName(userName); + } + + Date createDate = (Date)attributes.get("createDate"); + + if (createDate != null) { + setCreateDate(createDate); + } + + Date modifiedDate = (Date)attributes.get("modifiedDate"); + + if (modifiedDate != null) { + setModifiedDate(modifiedDate); + } + } + + /** + * Returns the primary key of this configurazione. + * + * @return the primary key of this configurazione + */ + @Override + public long getPrimaryKey() { + return _configurazione.getPrimaryKey(); + } + + /** + * Sets the primary key of this configurazione. + * + * @param primaryKey the primary key of this configurazione + */ + @Override + public void setPrimaryKey(long primaryKey) { + _configurazione.setPrimaryKey(primaryKey); + } + + /** + * Returns the configurazione ID of this configurazione. + * + * @return the configurazione ID of this configurazione + */ + @Override + public long getConfigurazioneId() { + return _configurazione.getConfigurazioneId(); + } + + /** + * Sets the configurazione ID of this configurazione. + * + * @param configurazioneId the configurazione ID of this configurazione + */ + @Override + public void setConfigurazioneId(long configurazioneId) { + _configurazione.setConfigurazioneId(configurazioneId); + } + + /** + * Returns the nome of this configurazione. + * + * @return the nome of this configurazione + */ + @Override + public java.lang.String getNome() { + return _configurazione.getNome(); + } + + /** + * Sets the nome of this configurazione. + * + * @param nome the nome of this configurazione + */ + @Override + public void setNome(java.lang.String nome) { + _configurazione.setNome(nome); + } + + /** + * Returns the valore of this configurazione. + * + * @return the valore of this configurazione + */ + @Override + public java.lang.String getValore() { + return _configurazione.getValore(); + } + + /** + * Sets the valore of this configurazione. + * + * @param valore the valore of this configurazione + */ + @Override + public void setValore(java.lang.String valore) { + _configurazione.setValore(valore); + } + + /** + * Returns the company ID of this configurazione. + * + * @return the company ID of this configurazione + */ + @Override + public long getCompanyId() { + return _configurazione.getCompanyId(); + } + + /** + * Sets the company ID of this configurazione. + * + * @param companyId the company ID of this configurazione + */ + @Override + public void setCompanyId(long companyId) { + _configurazione.setCompanyId(companyId); + } + + /** + * Returns the user ID of this configurazione. + * + * @return the user ID of this configurazione + */ + @Override + public long getUserId() { + return _configurazione.getUserId(); + } + + /** + * Sets the user ID of this configurazione. + * + * @param userId the user ID of this configurazione + */ + @Override + public void setUserId(long userId) { + _configurazione.setUserId(userId); + } + + /** + * Returns the user uuid of this configurazione. + * + * @return the user uuid of this configurazione + * @throws SystemException if a system exception occurred + */ + @Override + public java.lang.String getUserUuid() + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazione.getUserUuid(); + } + + /** + * Sets the user uuid of this configurazione. + * + * @param userUuid the user uuid of this configurazione + */ + @Override + public void setUserUuid(java.lang.String userUuid) { + _configurazione.setUserUuid(userUuid); + } + + /** + * Returns the user name of this configurazione. + * + * @return the user name of this configurazione + */ + @Override + public java.lang.String getUserName() { + return _configurazione.getUserName(); + } + + /** + * Sets the user name of this configurazione. + * + * @param userName the user name of this configurazione + */ + @Override + public void setUserName(java.lang.String userName) { + _configurazione.setUserName(userName); + } + + /** + * Returns the create date of this configurazione. + * + * @return the create date of this configurazione + */ + @Override + public java.util.Date getCreateDate() { + return _configurazione.getCreateDate(); + } + + /** + * Sets the create date of this configurazione. + * + * @param createDate the create date of this configurazione + */ + @Override + public void setCreateDate(java.util.Date createDate) { + _configurazione.setCreateDate(createDate); + } + + /** + * Returns the modified date of this configurazione. + * + * @return the modified date of this configurazione + */ + @Override + public java.util.Date getModifiedDate() { + return _configurazione.getModifiedDate(); + } + + /** + * Sets the modified date of this configurazione. + * + * @param modifiedDate the modified date of this configurazione + */ + @Override + public void setModifiedDate(java.util.Date modifiedDate) { + _configurazione.setModifiedDate(modifiedDate); + } + + @Override + public boolean isNew() { + return _configurazione.isNew(); + } + + @Override + public void setNew(boolean n) { + _configurazione.setNew(n); + } + + @Override + public boolean isCachedModel() { + return _configurazione.isCachedModel(); + } + + @Override + public void setCachedModel(boolean cachedModel) { + _configurazione.setCachedModel(cachedModel); + } + + @Override + public boolean isEscapedModel() { + return _configurazione.isEscapedModel(); + } + + @Override + public java.io.Serializable getPrimaryKeyObj() { + return _configurazione.getPrimaryKeyObj(); + } + + @Override + public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) { + _configurazione.setPrimaryKeyObj(primaryKeyObj); + } + + @Override + public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() { + return _configurazione.getExpandoBridge(); + } + + @Override + public void setExpandoBridgeAttributes( + com.liferay.portal.model.BaseModel baseModel) { + _configurazione.setExpandoBridgeAttributes(baseModel); + } + + @Override + public void setExpandoBridgeAttributes( + com.liferay.portlet.expando.model.ExpandoBridge expandoBridge) { + _configurazione.setExpandoBridgeAttributes(expandoBridge); + } + + @Override + public void setExpandoBridgeAttributes( + com.liferay.portal.service.ServiceContext serviceContext) { + _configurazione.setExpandoBridgeAttributes(serviceContext); + } + + @Override + public java.lang.Object clone() { + return new ConfigurazioneWrapper((Configurazione)_configurazione.clone()); + } + + @Override + public int compareTo( + it.mwg.sicilia.login.model.Configurazione configurazione) { + return _configurazione.compareTo(configurazione); + } + + @Override + public int hashCode() { + return _configurazione.hashCode(); + } + + @Override + public com.liferay.portal.model.CacheModel toCacheModel() { + return _configurazione.toCacheModel(); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione toEscapedModel() { + return new ConfigurazioneWrapper(_configurazione.toEscapedModel()); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione toUnescapedModel() { + return new ConfigurazioneWrapper(_configurazione.toUnescapedModel()); + } + + @Override + public java.lang.String toString() { + return _configurazione.toString(); + } + + @Override + public java.lang.String toXmlString() { + return _configurazione.toXmlString(); + } + + @Override + public void persist() + throws com.liferay.portal.kernel.exception.SystemException { + _configurazione.persist(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (!(obj instanceof ConfigurazioneWrapper)) { + return false; + } + + ConfigurazioneWrapper configurazioneWrapper = (ConfigurazioneWrapper)obj; + + if (Validator.equals(_configurazione, + configurazioneWrapper._configurazione)) { + return true; + } + + return false; + } + + /** + * @deprecated As of 6.1.0, replaced by {@link #getWrappedModel} + */ + public Configurazione getWrappedConfigurazione() { + return _configurazione; + } + + @Override + public Configurazione getWrappedModel() { + return _configurazione; + } + + @Override + public void resetOriginalValues() { + _configurazione.resetOriginalValues(); + } + + private Configurazione _configurazione; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ClpSerializer.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ClpSerializer.java new file mode 100644 index 0000000..3dd26a7 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ClpSerializer.java @@ -0,0 +1,289 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service; + +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayInputStream; +import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayOutputStream; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.ClassLoaderObjectInputStream; +import com.liferay.portal.kernel.util.PropsUtil; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.model.BaseModel; + +import it.mwg.sicilia.login.model.ConfigurazioneClp; + +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +import java.lang.reflect.Method; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Manifattura Web Group s.r.l. + */ +public class ClpSerializer { + public static String getServletContextName() { + if (Validator.isNotNull(_servletContextName)) { + return _servletContextName; + } + + synchronized (ClpSerializer.class) { + if (Validator.isNotNull(_servletContextName)) { + return _servletContextName; + } + + try { + ClassLoader classLoader = ClpSerializer.class.getClassLoader(); + + Class portletPropsClass = classLoader.loadClass( + "com.liferay.util.portlet.PortletProps"); + + Method getMethod = portletPropsClass.getMethod("get", + new Class[] { String.class }); + + String portletPropsServletContextName = (String)getMethod.invoke(null, + "sicilia-login-portlet-deployment-context"); + + if (Validator.isNotNull(portletPropsServletContextName)) { + _servletContextName = portletPropsServletContextName; + } + } + catch (Throwable t) { + if (_log.isInfoEnabled()) { + _log.info( + "Unable to locate deployment context from portlet properties"); + } + } + + if (Validator.isNull(_servletContextName)) { + try { + String propsUtilServletContextName = PropsUtil.get( + "sicilia-login-portlet-deployment-context"); + + if (Validator.isNotNull(propsUtilServletContextName)) { + _servletContextName = propsUtilServletContextName; + } + } + catch (Throwable t) { + if (_log.isInfoEnabled()) { + _log.info( + "Unable to locate deployment context from portal properties"); + } + } + } + + if (Validator.isNull(_servletContextName)) { + _servletContextName = "sicilia-login-portlet"; + } + + return _servletContextName; + } + } + + public static Object translateInput(BaseModel oldModel) { + Class oldModelClass = oldModel.getClass(); + + String oldModelClassName = oldModelClass.getName(); + + if (oldModelClassName.equals(ConfigurazioneClp.class.getName())) { + return translateInputConfigurazione(oldModel); + } + + return oldModel; + } + + public static Object translateInput(List oldList) { + List newList = new ArrayList(oldList.size()); + + for (int i = 0; i < oldList.size(); i++) { + Object curObj = oldList.get(i); + + newList.add(translateInput(curObj)); + } + + return newList; + } + + public static Object translateInputConfigurazione(BaseModel oldModel) { + ConfigurazioneClp oldClpModel = (ConfigurazioneClp)oldModel; + + BaseModel newModel = oldClpModel.getConfigurazioneRemoteModel(); + + newModel.setModelAttributes(oldClpModel.getModelAttributes()); + + return newModel; + } + + public static Object translateInput(Object obj) { + if (obj instanceof BaseModel) { + return translateInput((BaseModel)obj); + } + else if (obj instanceof List) { + return translateInput((List)obj); + } + else { + return obj; + } + } + + public static Object translateOutput(BaseModel oldModel) { + Class oldModelClass = oldModel.getClass(); + + String oldModelClassName = oldModelClass.getName(); + + if (oldModelClassName.equals( + "it.mwg.sicilia.login.model.impl.ConfigurazioneImpl")) { + return translateOutputConfigurazione(oldModel); + } + else if (oldModelClassName.endsWith("Clp")) { + try { + ClassLoader classLoader = ClpSerializer.class.getClassLoader(); + + Method getClpSerializerClassMethod = oldModelClass.getMethod( + "getClpSerializerClass"); + + Class oldClpSerializerClass = (Class)getClpSerializerClassMethod.invoke(oldModel); + + Class newClpSerializerClass = classLoader.loadClass(oldClpSerializerClass.getName()); + + Method translateOutputMethod = newClpSerializerClass.getMethod("translateOutput", + BaseModel.class); + + Class oldModelModelClass = oldModel.getModelClass(); + + Method getRemoteModelMethod = oldModelClass.getMethod("get" + + oldModelModelClass.getSimpleName() + "RemoteModel"); + + Object oldRemoteModel = getRemoteModelMethod.invoke(oldModel); + + BaseModel newModel = (BaseModel)translateOutputMethod.invoke(null, + oldRemoteModel); + + return newModel; + } + catch (Throwable t) { + if (_log.isInfoEnabled()) { + _log.info("Unable to translate " + oldModelClassName, t); + } + } + } + + return oldModel; + } + + public static Object translateOutput(List oldList) { + List newList = new ArrayList(oldList.size()); + + for (int i = 0; i < oldList.size(); i++) { + Object curObj = oldList.get(i); + + newList.add(translateOutput(curObj)); + } + + return newList; + } + + public static Object translateOutput(Object obj) { + if (obj instanceof BaseModel) { + return translateOutput((BaseModel)obj); + } + else if (obj instanceof List) { + return translateOutput((List)obj); + } + else { + return obj; + } + } + + public static Throwable translateThrowable(Throwable throwable) { + if (_useReflectionToTranslateThrowable) { + try { + UnsyncByteArrayOutputStream unsyncByteArrayOutputStream = new UnsyncByteArrayOutputStream(); + ObjectOutputStream objectOutputStream = new ObjectOutputStream(unsyncByteArrayOutputStream); + + objectOutputStream.writeObject(throwable); + + objectOutputStream.flush(); + objectOutputStream.close(); + + UnsyncByteArrayInputStream unsyncByteArrayInputStream = new UnsyncByteArrayInputStream(unsyncByteArrayOutputStream.unsafeGetByteArray(), + 0, unsyncByteArrayOutputStream.size()); + + Thread currentThread = Thread.currentThread(); + + ClassLoader contextClassLoader = currentThread.getContextClassLoader(); + + ObjectInputStream objectInputStream = new ClassLoaderObjectInputStream(unsyncByteArrayInputStream, + contextClassLoader); + + throwable = (Throwable)objectInputStream.readObject(); + + objectInputStream.close(); + + return throwable; + } + catch (SecurityException se) { + if (_log.isInfoEnabled()) { + _log.info("Do not use reflection to translate throwable"); + } + + _useReflectionToTranslateThrowable = false; + } + catch (Throwable throwable2) { + _log.error(throwable2, throwable2); + + return throwable2; + } + } + + Class clazz = throwable.getClass(); + + String className = clazz.getName(); + + if (className.equals(PortalException.class.getName())) { + return new PortalException(); + } + + if (className.equals(SystemException.class.getName())) { + return new SystemException(); + } + + if (className.equals( + "it.mwg.sicilia.login.NoSuchConfigurazioneException")) { + return new it.mwg.sicilia.login.NoSuchConfigurazioneException(); + } + + return throwable; + } + + public static Object translateOutputConfigurazione(BaseModel oldModel) { + ConfigurazioneClp newModel = new ConfigurazioneClp(); + + newModel.setModelAttributes(oldModel.getModelAttributes()); + + newModel.setConfigurazioneRemoteModel(oldModel); + + return newModel; + } + + private static Log _log = LogFactoryUtil.getLog(ClpSerializer.class); + private static String _servletContextName; + private static boolean _useReflectionToTranslateThrowable = true; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalService.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalService.java new file mode 100644 index 0000000..e970f76 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalService.java @@ -0,0 +1,291 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service; + +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.search.IndexableType; +import com.liferay.portal.kernel.transaction.Isolation; +import com.liferay.portal.kernel.transaction.Propagation; +import com.liferay.portal.kernel.transaction.Transactional; +import com.liferay.portal.service.BaseLocalService; +import com.liferay.portal.service.InvokableLocalService; +import com.liferay.portal.service.PersistedModelLocalService; + +/** + * Provides the local service interface for Configurazione. Methods of this + * service will not have security checks based on the propagated JAAS + * credentials because this service can only be accessed from within the same + * VM. + * + * @author Manifattura Web Group s.r.l. + * @see ConfigurazioneLocalServiceUtil + * @see it.mwg.sicilia.login.service.base.ConfigurazioneLocalServiceBaseImpl + * @see it.mwg.sicilia.login.service.impl.ConfigurazioneLocalServiceImpl + * @generated + */ +@Transactional(isolation = Isolation.PORTAL, rollbackFor = { + PortalException.class, SystemException.class}) +public interface ConfigurazioneLocalService extends BaseLocalService, + InvokableLocalService, PersistedModelLocalService { + /* + * NOTE FOR DEVELOPERS: + * + * Never modify or reference this interface directly. Always use {@link ConfigurazioneLocalServiceUtil} to access the configurazione local service. Add custom service methods to {@link it.mwg.sicilia.login.service.impl.ConfigurazioneLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. + */ + + /** + * Adds the configurazione to the database. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was added + * @throws SystemException if a system exception occurred + */ + @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) + public it.mwg.sicilia.login.model.Configurazione addConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Creates a new configurazione with the primary key. Does not add the configurazione to the database. + * + * @param configurazioneId the primary key for the new configurazione + * @return the new configurazione + */ + public it.mwg.sicilia.login.model.Configurazione createConfigurazione( + long configurazioneId); + + /** + * Deletes the configurazione with the primary key from the database. Also notifies the appropriate model listeners. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione that was removed + * @throws PortalException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) + public it.mwg.sicilia.login.model.Configurazione deleteConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException; + + /** + * Deletes the configurazione from the database. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was removed + * @throws SystemException if a system exception occurred + */ + @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) + public it.mwg.sicilia.login.model.Configurazione deleteConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException; + + public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery(); + + /** + * Performs a dynamic query on the database and returns the matching rows. + * + * @param dynamicQuery the dynamic query + * @return the matching rows + * @throws SystemException if a system exception occurred + */ + @SuppressWarnings("rawtypes") + public java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Performs a dynamic query on the database and returns a range of the matching rows. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param dynamicQuery the dynamic query + * @param start the lower bound of the range of model instances + * @param end the upper bound of the range of model instances (not inclusive) + * @return the range of matching rows + * @throws SystemException if a system exception occurred + */ + @SuppressWarnings("rawtypes") + public java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, + int end) throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Performs a dynamic query on the database and returns an ordered range of the matching rows. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param dynamicQuery the dynamic query + * @param start the lower bound of the range of model instances + * @param end the upper bound of the range of model instances (not inclusive) + * @param orderByComparator the comparator to order the results by (optionally null) + * @return the ordered range of matching rows + * @throws SystemException if a system exception occurred + */ + @SuppressWarnings("rawtypes") + public java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, + int end, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the number of rows that match the dynamic query. + * + * @param dynamicQuery the dynamic query + * @return the number of rows that match the dynamic query + * @throws SystemException if a system exception occurred + */ + public long dynamicQueryCount( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the number of rows that match the dynamic query. + * + * @param dynamicQuery the dynamic query + * @param projection the projection to apply to the query + * @return the number of rows that match the dynamic query + * @throws SystemException if a system exception occurred + */ + public long dynamicQueryCount( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, + com.liferay.portal.kernel.dao.orm.Projection projection) + throws com.liferay.portal.kernel.exception.SystemException; + + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public it.mwg.sicilia.login.model.Configurazione fetchConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the configurazione with the primary key. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione + * @throws PortalException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public it.mwg.sicilia.login.model.Configurazione getConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException; + + @Override + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public com.liferay.portal.model.PersistedModel getPersistedModel( + java.io.Serializable primaryKeyObj) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns a range of all the configuraziones. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @return the range of configuraziones + * @throws SystemException if a system exception occurred + */ + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public java.util.List getConfiguraziones( + int start, int end) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the number of configuraziones. + * + * @return the number of configuraziones + * @throws SystemException if a system exception occurred + */ + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public int getConfigurazionesCount() + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Updates the configurazione in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was updated + * @throws SystemException if a system exception occurred + */ + @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) + public it.mwg.sicilia.login.model.Configurazione updateConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the Spring bean ID for this bean. + * + * @return the Spring bean ID for this bean + */ + public java.lang.String getBeanIdentifier(); + + /** + * Sets the Spring bean ID for this bean. + * + * @param beanIdentifier the Spring bean ID for this bean + */ + public void setBeanIdentifier(java.lang.String beanIdentifier); + + @Override + public java.lang.Object invokeMethod(java.lang.String name, + java.lang.String[] parameterTypes, java.lang.Object[] arguments) + throws java.lang.Throwable; + + public it.mwg.sicilia.login.model.Configurazione findByCompanyId_Nome( + long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException; + + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public java.lang.String getApiServer(long companyId); + + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public java.lang.String getApiServerKey(); + + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public java.lang.String getApiUsername(long companyId); + + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public java.lang.String getApiUsernameKey(); + + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public java.lang.String getApiPassword(long companyId); + + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public java.lang.String getApiPasswordKey(); + + public void salvaImpostazioni(javax.portlet.ActionRequest request, + javax.portlet.ActionResponse response) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException; + + public void set(long companyId, com.liferay.portal.model.User user, + java.lang.String nome, java.lang.String valore) + throws com.liferay.portal.kernel.exception.SystemException; + + public void setDefaults(long companyId) + throws com.liferay.portal.kernel.exception.SystemException; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalServiceClp.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalServiceClp.java new file mode 100644 index 0000000..aee2260 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalServiceClp.java @@ -0,0 +1,1037 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service; + +import com.liferay.portal.service.InvokableLocalService; + +/** + * @author Manifattura Web Group s.r.l. + * @generated + */ +public class ConfigurazioneLocalServiceClp implements ConfigurazioneLocalService { + public ConfigurazioneLocalServiceClp( + InvokableLocalService invokableLocalService) { + _invokableLocalService = invokableLocalService; + + _methodName0 = "addConfigurazione"; + + _methodParameterTypes0 = new String[] { + "it.mwg.sicilia.login.model.Configurazione" + }; + + _methodName1 = "createConfigurazione"; + + _methodParameterTypes1 = new String[] { "long" }; + + _methodName2 = "deleteConfigurazione"; + + _methodParameterTypes2 = new String[] { "long" }; + + _methodName3 = "deleteConfigurazione"; + + _methodParameterTypes3 = new String[] { + "it.mwg.sicilia.login.model.Configurazione" + }; + + _methodName4 = "dynamicQuery"; + + _methodParameterTypes4 = new String[] { }; + + _methodName5 = "dynamicQuery"; + + _methodParameterTypes5 = new String[] { + "com.liferay.portal.kernel.dao.orm.DynamicQuery" + }; + + _methodName6 = "dynamicQuery"; + + _methodParameterTypes6 = new String[] { + "com.liferay.portal.kernel.dao.orm.DynamicQuery", "int", "int" + }; + + _methodName7 = "dynamicQuery"; + + _methodParameterTypes7 = new String[] { + "com.liferay.portal.kernel.dao.orm.DynamicQuery", "int", "int", + "com.liferay.portal.kernel.util.OrderByComparator" + }; + + _methodName8 = "dynamicQueryCount"; + + _methodParameterTypes8 = new String[] { + "com.liferay.portal.kernel.dao.orm.DynamicQuery" + }; + + _methodName9 = "dynamicQueryCount"; + + _methodParameterTypes9 = new String[] { + "com.liferay.portal.kernel.dao.orm.DynamicQuery", + "com.liferay.portal.kernel.dao.orm.Projection" + }; + + _methodName10 = "fetchConfigurazione"; + + _methodParameterTypes10 = new String[] { "long" }; + + _methodName11 = "getConfigurazione"; + + _methodParameterTypes11 = new String[] { "long" }; + + _methodName12 = "getPersistedModel"; + + _methodParameterTypes12 = new String[] { "java.io.Serializable" }; + + _methodName13 = "getConfiguraziones"; + + _methodParameterTypes13 = new String[] { "int", "int" }; + + _methodName14 = "getConfigurazionesCount"; + + _methodParameterTypes14 = new String[] { }; + + _methodName15 = "updateConfigurazione"; + + _methodParameterTypes15 = new String[] { + "it.mwg.sicilia.login.model.Configurazione" + }; + + _methodName16 = "getBeanIdentifier"; + + _methodParameterTypes16 = new String[] { }; + + _methodName17 = "setBeanIdentifier"; + + _methodParameterTypes17 = new String[] { "java.lang.String" }; + + _methodName19 = "findByCompanyId_Nome"; + + _methodParameterTypes19 = new String[] { "long", "java.lang.String" }; + + _methodName20 = "getApiServer"; + + _methodParameterTypes20 = new String[] { "long" }; + + _methodName21 = "getApiServerKey"; + + _methodParameterTypes21 = new String[] { }; + + _methodName22 = "getApiUsername"; + + _methodParameterTypes22 = new String[] { "long" }; + + _methodName23 = "getApiUsernameKey"; + + _methodParameterTypes23 = new String[] { }; + + _methodName24 = "getApiPassword"; + + _methodParameterTypes24 = new String[] { "long" }; + + _methodName25 = "getApiPasswordKey"; + + _methodParameterTypes25 = new String[] { }; + + _methodName26 = "salvaImpostazioni"; + + _methodParameterTypes26 = new String[] { + "javax.portlet.ActionRequest", "javax.portlet.ActionResponse" + }; + + _methodName27 = "set"; + + _methodParameterTypes27 = new String[] { + "long", "com.liferay.portal.model.User", "java.lang.String", + "java.lang.String" + }; + + _methodName28 = "setDefaults"; + + _methodParameterTypes28 = new String[] { "long" }; + } + + @Override + public it.mwg.sicilia.login.model.Configurazione addConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName0, + _methodParameterTypes0, + new Object[] { ClpSerializer.translateInput(configurazione) }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (it.mwg.sicilia.login.model.Configurazione)ClpSerializer.translateOutput(returnObj); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione createConfigurazione( + long configurazioneId) { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName1, + _methodParameterTypes1, new Object[] { configurazioneId }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (it.mwg.sicilia.login.model.Configurazione)ClpSerializer.translateOutput(returnObj); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione deleteConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName2, + _methodParameterTypes2, new Object[] { configurazioneId }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.PortalException) { + throw (com.liferay.portal.kernel.exception.PortalException)t; + } + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (it.mwg.sicilia.login.model.Configurazione)ClpSerializer.translateOutput(returnObj); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione deleteConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName3, + _methodParameterTypes3, + new Object[] { ClpSerializer.translateInput(configurazione) }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (it.mwg.sicilia.login.model.Configurazione)ClpSerializer.translateOutput(returnObj); + } + + @Override + public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName4, + _methodParameterTypes4, new Object[] { }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (com.liferay.portal.kernel.dao.orm.DynamicQuery)ClpSerializer.translateOutput(returnObj); + } + + @Override + @SuppressWarnings("rawtypes") + public java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName5, + _methodParameterTypes5, + new Object[] { ClpSerializer.translateInput(dynamicQuery) }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.util.List)ClpSerializer.translateOutput(returnObj); + } + + @Override + @SuppressWarnings("rawtypes") + public java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, + int end) throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName6, + _methodParameterTypes6, + new Object[] { + ClpSerializer.translateInput(dynamicQuery), + + start, + + end + }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.util.List)ClpSerializer.translateOutput(returnObj); + } + + @Override + @SuppressWarnings("rawtypes") + public java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, + int end, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName7, + _methodParameterTypes7, + new Object[] { + ClpSerializer.translateInput(dynamicQuery), + + start, + + end, + + ClpSerializer.translateInput(orderByComparator) + }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.util.List)ClpSerializer.translateOutput(returnObj); + } + + @Override + public long dynamicQueryCount( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName8, + _methodParameterTypes8, + new Object[] { ClpSerializer.translateInput(dynamicQuery) }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return ((Long)returnObj).longValue(); + } + + @Override + public long dynamicQueryCount( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, + com.liferay.portal.kernel.dao.orm.Projection projection) + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName9, + _methodParameterTypes9, + new Object[] { + ClpSerializer.translateInput(dynamicQuery), + + ClpSerializer.translateInput(projection) + }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return ((Long)returnObj).longValue(); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione fetchConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName10, + _methodParameterTypes10, new Object[] { configurazioneId }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (it.mwg.sicilia.login.model.Configurazione)ClpSerializer.translateOutput(returnObj); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione getConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName11, + _methodParameterTypes11, new Object[] { configurazioneId }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.PortalException) { + throw (com.liferay.portal.kernel.exception.PortalException)t; + } + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (it.mwg.sicilia.login.model.Configurazione)ClpSerializer.translateOutput(returnObj); + } + + @Override + public com.liferay.portal.model.PersistedModel getPersistedModel( + java.io.Serializable primaryKeyObj) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName12, + _methodParameterTypes12, + new Object[] { ClpSerializer.translateInput(primaryKeyObj) }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.PortalException) { + throw (com.liferay.portal.kernel.exception.PortalException)t; + } + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (com.liferay.portal.model.PersistedModel)ClpSerializer.translateOutput(returnObj); + } + + @Override + public java.util.List getConfiguraziones( + int start, int end) + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName13, + _methodParameterTypes13, new Object[] { start, end }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.util.List)ClpSerializer.translateOutput(returnObj); + } + + @Override + public int getConfigurazionesCount() + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName14, + _methodParameterTypes14, new Object[] { }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return ((Integer)returnObj).intValue(); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione updateConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName15, + _methodParameterTypes15, + new Object[] { ClpSerializer.translateInput(configurazione) }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (it.mwg.sicilia.login.model.Configurazione)ClpSerializer.translateOutput(returnObj); + } + + @Override + public java.lang.String getBeanIdentifier() { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName16, + _methodParameterTypes16, new Object[] { }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.lang.String)ClpSerializer.translateOutput(returnObj); + } + + @Override + public void setBeanIdentifier(java.lang.String beanIdentifier) { + try { + _invokableLocalService.invokeMethod(_methodName17, + _methodParameterTypes17, + new Object[] { ClpSerializer.translateInput(beanIdentifier) }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + } + + @Override + public java.lang.Object invokeMethod(java.lang.String name, + java.lang.String[] parameterTypes, java.lang.Object[] arguments) + throws java.lang.Throwable { + throw new UnsupportedOperationException(); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione findByCompanyId_Nome( + long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName19, + _methodParameterTypes19, + new Object[] { companyId, ClpSerializer.translateInput(nome) }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof it.mwg.sicilia.login.NoSuchConfigurazioneException) { + throw (it.mwg.sicilia.login.NoSuchConfigurazioneException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (it.mwg.sicilia.login.model.Configurazione)ClpSerializer.translateOutput(returnObj); + } + + @Override + public java.lang.String getApiServer(long companyId) { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName20, + _methodParameterTypes20, new Object[] { companyId }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.lang.String)ClpSerializer.translateOutput(returnObj); + } + + @Override + public java.lang.String getApiServerKey() { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName21, + _methodParameterTypes21, new Object[] { }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.lang.String)ClpSerializer.translateOutput(returnObj); + } + + @Override + public java.lang.String getApiUsername(long companyId) { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName22, + _methodParameterTypes22, new Object[] { companyId }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.lang.String)ClpSerializer.translateOutput(returnObj); + } + + @Override + public java.lang.String getApiUsernameKey() { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName23, + _methodParameterTypes23, new Object[] { }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.lang.String)ClpSerializer.translateOutput(returnObj); + } + + @Override + public java.lang.String getApiPassword(long companyId) { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName24, + _methodParameterTypes24, new Object[] { companyId }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.lang.String)ClpSerializer.translateOutput(returnObj); + } + + @Override + public java.lang.String getApiPasswordKey() { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName25, + _methodParameterTypes25, new Object[] { }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return (java.lang.String)ClpSerializer.translateOutput(returnObj); + } + + @Override + public void salvaImpostazioni(javax.portlet.ActionRequest request, + javax.portlet.ActionResponse response) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + try { + _invokableLocalService.invokeMethod(_methodName26, + _methodParameterTypes26, + new Object[] { + ClpSerializer.translateInput(request), + + ClpSerializer.translateInput(response) + }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.PortalException) { + throw (com.liferay.portal.kernel.exception.PortalException)t; + } + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + } + + @Override + public void set(long companyId, com.liferay.portal.model.User user, + java.lang.String nome, java.lang.String valore) + throws com.liferay.portal.kernel.exception.SystemException { + try { + _invokableLocalService.invokeMethod(_methodName27, + _methodParameterTypes27, + new Object[] { + companyId, + + ClpSerializer.translateInput(user), + + ClpSerializer.translateInput(nome), + + ClpSerializer.translateInput(valore) + }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + } + + @Override + public void setDefaults(long companyId) + throws com.liferay.portal.kernel.exception.SystemException { + try { + _invokableLocalService.invokeMethod(_methodName28, + _methodParameterTypes28, new Object[] { companyId }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + } + + private InvokableLocalService _invokableLocalService; + private String _methodName0; + private String[] _methodParameterTypes0; + private String _methodName1; + private String[] _methodParameterTypes1; + private String _methodName2; + private String[] _methodParameterTypes2; + private String _methodName3; + private String[] _methodParameterTypes3; + private String _methodName4; + private String[] _methodParameterTypes4; + private String _methodName5; + private String[] _methodParameterTypes5; + private String _methodName6; + private String[] _methodParameterTypes6; + private String _methodName7; + private String[] _methodParameterTypes7; + private String _methodName8; + private String[] _methodParameterTypes8; + private String _methodName9; + private String[] _methodParameterTypes9; + private String _methodName10; + private String[] _methodParameterTypes10; + private String _methodName11; + private String[] _methodParameterTypes11; + private String _methodName12; + private String[] _methodParameterTypes12; + private String _methodName13; + private String[] _methodParameterTypes13; + private String _methodName14; + private String[] _methodParameterTypes14; + private String _methodName15; + private String[] _methodParameterTypes15; + private String _methodName16; + private String[] _methodParameterTypes16; + private String _methodName17; + private String[] _methodParameterTypes17; + private String _methodName19; + private String[] _methodParameterTypes19; + private String _methodName20; + private String[] _methodParameterTypes20; + private String _methodName21; + private String[] _methodParameterTypes21; + private String _methodName22; + private String[] _methodParameterTypes22; + private String _methodName23; + private String[] _methodParameterTypes23; + private String _methodName24; + private String[] _methodParameterTypes24; + private String _methodName25; + private String[] _methodParameterTypes25; + private String _methodName26; + private String[] _methodParameterTypes26; + private String _methodName27; + private String[] _methodParameterTypes27; + private String _methodName28; + private String[] _methodParameterTypes28; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalServiceUtil.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalServiceUtil.java new file mode 100644 index 0000000..1967204 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalServiceUtil.java @@ -0,0 +1,357 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service; + +import com.liferay.portal.kernel.bean.PortletBeanLocatorUtil; +import com.liferay.portal.kernel.util.ReferenceRegistry; +import com.liferay.portal.service.InvokableLocalService; + +/** + * Provides the local service utility for Configurazione. This utility wraps + * {@link it.mwg.sicilia.login.service.impl.ConfigurazioneLocalServiceImpl} and is the + * primary access point for service operations in application layer code running + * on the local server. Methods of this service will not have security checks + * based on the propagated JAAS credentials because this service can only be + * accessed from within the same VM. + * + * @author Manifattura Web Group s.r.l. + * @see ConfigurazioneLocalService + * @see it.mwg.sicilia.login.service.base.ConfigurazioneLocalServiceBaseImpl + * @see it.mwg.sicilia.login.service.impl.ConfigurazioneLocalServiceImpl + * @generated + */ +public class ConfigurazioneLocalServiceUtil { + /* + * NOTE FOR DEVELOPERS: + * + * Never modify this class directly. Add custom service methods to {@link it.mwg.sicilia.login.service.impl.ConfigurazioneLocalServiceImpl} and rerun ServiceBuilder to regenerate this class. + */ + + /** + * Adds the configurazione to the database. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was added + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione addConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException { + return getService().addConfigurazione(configurazione); + } + + /** + * Creates a new configurazione with the primary key. Does not add the configurazione to the database. + * + * @param configurazioneId the primary key for the new configurazione + * @return the new configurazione + */ + public static it.mwg.sicilia.login.model.Configurazione createConfigurazione( + long configurazioneId) { + return getService().createConfigurazione(configurazioneId); + } + + /** + * Deletes the configurazione with the primary key from the database. Also notifies the appropriate model listeners. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione that was removed + * @throws PortalException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione deleteConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + return getService().deleteConfigurazione(configurazioneId); + } + + /** + * Deletes the configurazione from the database. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was removed + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione deleteConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException { + return getService().deleteConfigurazione(configurazione); + } + + public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { + return getService().dynamicQuery(); + } + + /** + * Performs a dynamic query on the database and returns the matching rows. + * + * @param dynamicQuery the dynamic query + * @return the matching rows + * @throws SystemException if a system exception occurred + */ + @SuppressWarnings("rawtypes") + public static java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) + throws com.liferay.portal.kernel.exception.SystemException { + return getService().dynamicQuery(dynamicQuery); + } + + /** + * Performs a dynamic query on the database and returns a range of the matching rows. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param dynamicQuery the dynamic query + * @param start the lower bound of the range of model instances + * @param end the upper bound of the range of model instances (not inclusive) + * @return the range of matching rows + * @throws SystemException if a system exception occurred + */ + @SuppressWarnings("rawtypes") + public static java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, + int end) throws com.liferay.portal.kernel.exception.SystemException { + return getService().dynamicQuery(dynamicQuery, start, end); + } + + /** + * Performs a dynamic query on the database and returns an ordered range of the matching rows. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param dynamicQuery the dynamic query + * @param start the lower bound of the range of model instances + * @param end the upper bound of the range of model instances (not inclusive) + * @param orderByComparator the comparator to order the results by (optionally null) + * @return the ordered range of matching rows + * @throws SystemException if a system exception occurred + */ + @SuppressWarnings("rawtypes") + public static java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, + int end, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException { + return getService() + .dynamicQuery(dynamicQuery, start, end, orderByComparator); + } + + /** + * Returns the number of rows that match the dynamic query. + * + * @param dynamicQuery the dynamic query + * @return the number of rows that match the dynamic query + * @throws SystemException if a system exception occurred + */ + public static long dynamicQueryCount( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) + throws com.liferay.portal.kernel.exception.SystemException { + return getService().dynamicQueryCount(dynamicQuery); + } + + /** + * Returns the number of rows that match the dynamic query. + * + * @param dynamicQuery the dynamic query + * @param projection the projection to apply to the query + * @return the number of rows that match the dynamic query + * @throws SystemException if a system exception occurred + */ + public static long dynamicQueryCount( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, + com.liferay.portal.kernel.dao.orm.Projection projection) + throws com.liferay.portal.kernel.exception.SystemException { + return getService().dynamicQueryCount(dynamicQuery, projection); + } + + public static it.mwg.sicilia.login.model.Configurazione fetchConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.SystemException { + return getService().fetchConfigurazione(configurazioneId); + } + + /** + * Returns the configurazione with the primary key. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione + * @throws PortalException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione getConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + return getService().getConfigurazione(configurazioneId); + } + + public static com.liferay.portal.model.PersistedModel getPersistedModel( + java.io.Serializable primaryKeyObj) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + return getService().getPersistedModel(primaryKeyObj); + } + + /** + * Returns a range of all the configuraziones. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @return the range of configuraziones + * @throws SystemException if a system exception occurred + */ + public static java.util.List getConfiguraziones( + int start, int end) + throws com.liferay.portal.kernel.exception.SystemException { + return getService().getConfiguraziones(start, end); + } + + /** + * Returns the number of configuraziones. + * + * @return the number of configuraziones + * @throws SystemException if a system exception occurred + */ + public static int getConfigurazionesCount() + throws com.liferay.portal.kernel.exception.SystemException { + return getService().getConfigurazionesCount(); + } + + /** + * Updates the configurazione in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was updated + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione updateConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException { + return getService().updateConfigurazione(configurazione); + } + + /** + * Returns the Spring bean ID for this bean. + * + * @return the Spring bean ID for this bean + */ + public static java.lang.String getBeanIdentifier() { + return getService().getBeanIdentifier(); + } + + /** + * Sets the Spring bean ID for this bean. + * + * @param beanIdentifier the Spring bean ID for this bean + */ + public static void setBeanIdentifier(java.lang.String beanIdentifier) { + getService().setBeanIdentifier(beanIdentifier); + } + + public static java.lang.Object invokeMethod(java.lang.String name, + java.lang.String[] parameterTypes, java.lang.Object[] arguments) + throws java.lang.Throwable { + return getService().invokeMethod(name, parameterTypes, arguments); + } + + public static it.mwg.sicilia.login.model.Configurazione findByCompanyId_Nome( + long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException { + return getService().findByCompanyId_Nome(companyId, nome); + } + + public static java.lang.String getApiServer(long companyId) { + return getService().getApiServer(companyId); + } + + public static java.lang.String getApiServerKey() { + return getService().getApiServerKey(); + } + + public static java.lang.String getApiUsername(long companyId) { + return getService().getApiUsername(companyId); + } + + public static java.lang.String getApiUsernameKey() { + return getService().getApiUsernameKey(); + } + + public static java.lang.String getApiPassword(long companyId) { + return getService().getApiPassword(companyId); + } + + public static java.lang.String getApiPasswordKey() { + return getService().getApiPasswordKey(); + } + + public static void salvaImpostazioni(javax.portlet.ActionRequest request, + javax.portlet.ActionResponse response) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + getService().salvaImpostazioni(request, response); + } + + public static void set(long companyId, com.liferay.portal.model.User user, + java.lang.String nome, java.lang.String valore) + throws com.liferay.portal.kernel.exception.SystemException { + getService().set(companyId, user, nome, valore); + } + + public static void setDefaults(long companyId) + throws com.liferay.portal.kernel.exception.SystemException { + getService().setDefaults(companyId); + } + + public static void clearService() { + _service = null; + } + + public static ConfigurazioneLocalService getService() { + if (_service == null) { + InvokableLocalService invokableLocalService = (InvokableLocalService)PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), + ConfigurazioneLocalService.class.getName()); + + if (invokableLocalService instanceof ConfigurazioneLocalService) { + _service = (ConfigurazioneLocalService)invokableLocalService; + } + else { + _service = new ConfigurazioneLocalServiceClp(invokableLocalService); + } + + ReferenceRegistry.registerReference(ConfigurazioneLocalServiceUtil.class, + "_service"); + } + + return _service; + } + + /** + * @deprecated As of 6.2.0 + */ + public void setService(ConfigurazioneLocalService service) { + } + + private static ConfigurazioneLocalService _service; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalServiceWrapper.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalServiceWrapper.java new file mode 100644 index 0000000..76565b9 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/ConfigurazioneLocalServiceWrapper.java @@ -0,0 +1,377 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service; + +import com.liferay.portal.service.ServiceWrapper; + +/** + * Provides a wrapper for {@link ConfigurazioneLocalService}. + * + * @author Manifattura Web Group s.r.l. + * @see ConfigurazioneLocalService + * @generated + */ +public class ConfigurazioneLocalServiceWrapper + implements ConfigurazioneLocalService, + ServiceWrapper { + public ConfigurazioneLocalServiceWrapper( + ConfigurazioneLocalService configurazioneLocalService) { + _configurazioneLocalService = configurazioneLocalService; + } + + /** + * Adds the configurazione to the database. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was added + * @throws SystemException if a system exception occurred + */ + @Override + public it.mwg.sicilia.login.model.Configurazione addConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.addConfigurazione(configurazione); + } + + /** + * Creates a new configurazione with the primary key. Does not add the configurazione to the database. + * + * @param configurazioneId the primary key for the new configurazione + * @return the new configurazione + */ + @Override + public it.mwg.sicilia.login.model.Configurazione createConfigurazione( + long configurazioneId) { + return _configurazioneLocalService.createConfigurazione(configurazioneId); + } + + /** + * Deletes the configurazione with the primary key from the database. Also notifies the appropriate model listeners. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione that was removed + * @throws PortalException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public it.mwg.sicilia.login.model.Configurazione deleteConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.deleteConfigurazione(configurazioneId); + } + + /** + * Deletes the configurazione from the database. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was removed + * @throws SystemException if a system exception occurred + */ + @Override + public it.mwg.sicilia.login.model.Configurazione deleteConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.deleteConfigurazione(configurazione); + } + + @Override + public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { + return _configurazioneLocalService.dynamicQuery(); + } + + /** + * Performs a dynamic query on the database and returns the matching rows. + * + * @param dynamicQuery the dynamic query + * @return the matching rows + * @throws SystemException if a system exception occurred + */ + @Override + @SuppressWarnings("rawtypes") + public java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.dynamicQuery(dynamicQuery); + } + + /** + * Performs a dynamic query on the database and returns a range of the matching rows. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param dynamicQuery the dynamic query + * @param start the lower bound of the range of model instances + * @param end the upper bound of the range of model instances (not inclusive) + * @return the range of matching rows + * @throws SystemException if a system exception occurred + */ + @Override + @SuppressWarnings("rawtypes") + public java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, + int end) throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.dynamicQuery(dynamicQuery, start, end); + } + + /** + * Performs a dynamic query on the database and returns an ordered range of the matching rows. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param dynamicQuery the dynamic query + * @param start the lower bound of the range of model instances + * @param end the upper bound of the range of model instances (not inclusive) + * @param orderByComparator the comparator to order the results by (optionally null) + * @return the ordered range of matching rows + * @throws SystemException if a system exception occurred + */ + @Override + @SuppressWarnings("rawtypes") + public java.util.List dynamicQuery( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, + int end, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.dynamicQuery(dynamicQuery, start, + end, orderByComparator); + } + + /** + * Returns the number of rows that match the dynamic query. + * + * @param dynamicQuery the dynamic query + * @return the number of rows that match the dynamic query + * @throws SystemException if a system exception occurred + */ + @Override + public long dynamicQueryCount( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.dynamicQueryCount(dynamicQuery); + } + + /** + * Returns the number of rows that match the dynamic query. + * + * @param dynamicQuery the dynamic query + * @param projection the projection to apply to the query + * @return the number of rows that match the dynamic query + * @throws SystemException if a system exception occurred + */ + @Override + public long dynamicQueryCount( + com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, + com.liferay.portal.kernel.dao.orm.Projection projection) + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.dynamicQueryCount(dynamicQuery, + projection); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione fetchConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.fetchConfigurazione(configurazioneId); + } + + /** + * Returns the configurazione with the primary key. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione + * @throws PortalException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public it.mwg.sicilia.login.model.Configurazione getConfigurazione( + long configurazioneId) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.getConfigurazione(configurazioneId); + } + + @Override + public com.liferay.portal.model.PersistedModel getPersistedModel( + java.io.Serializable primaryKeyObj) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.getPersistedModel(primaryKeyObj); + } + + /** + * Returns a range of all the configuraziones. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @return the range of configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public java.util.List getConfiguraziones( + int start, int end) + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.getConfiguraziones(start, end); + } + + /** + * Returns the number of configuraziones. + * + * @return the number of configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public int getConfigurazionesCount() + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.getConfigurazionesCount(); + } + + /** + * Updates the configurazione in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was updated + * @throws SystemException if a system exception occurred + */ + @Override + public it.mwg.sicilia.login.model.Configurazione updateConfigurazione( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException { + return _configurazioneLocalService.updateConfigurazione(configurazione); + } + + /** + * Returns the Spring bean ID for this bean. + * + * @return the Spring bean ID for this bean + */ + @Override + public java.lang.String getBeanIdentifier() { + return _configurazioneLocalService.getBeanIdentifier(); + } + + /** + * Sets the Spring bean ID for this bean. + * + * @param beanIdentifier the Spring bean ID for this bean + */ + @Override + public void setBeanIdentifier(java.lang.String beanIdentifier) { + _configurazioneLocalService.setBeanIdentifier(beanIdentifier); + } + + @Override + public java.lang.Object invokeMethod(java.lang.String name, + java.lang.String[] parameterTypes, java.lang.Object[] arguments) + throws java.lang.Throwable { + return _configurazioneLocalService.invokeMethod(name, parameterTypes, + arguments); + } + + @Override + public it.mwg.sicilia.login.model.Configurazione findByCompanyId_Nome( + long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException { + return _configurazioneLocalService.findByCompanyId_Nome(companyId, nome); + } + + @Override + public java.lang.String getApiServer(long companyId) { + return _configurazioneLocalService.getApiServer(companyId); + } + + @Override + public java.lang.String getApiServerKey() { + return _configurazioneLocalService.getApiServerKey(); + } + + @Override + public java.lang.String getApiUsername(long companyId) { + return _configurazioneLocalService.getApiUsername(companyId); + } + + @Override + public java.lang.String getApiUsernameKey() { + return _configurazioneLocalService.getApiUsernameKey(); + } + + @Override + public java.lang.String getApiPassword(long companyId) { + return _configurazioneLocalService.getApiPassword(companyId); + } + + @Override + public java.lang.String getApiPasswordKey() { + return _configurazioneLocalService.getApiPasswordKey(); + } + + @Override + public void salvaImpostazioni(javax.portlet.ActionRequest request, + javax.portlet.ActionResponse response) + throws com.liferay.portal.kernel.exception.PortalException, + com.liferay.portal.kernel.exception.SystemException { + _configurazioneLocalService.salvaImpostazioni(request, response); + } + + @Override + public void set(long companyId, com.liferay.portal.model.User user, + java.lang.String nome, java.lang.String valore) + throws com.liferay.portal.kernel.exception.SystemException { + _configurazioneLocalService.set(companyId, user, nome, valore); + } + + @Override + public void setDefaults(long companyId) + throws com.liferay.portal.kernel.exception.SystemException { + _configurazioneLocalService.setDefaults(companyId); + } + + /** + * @deprecated As of 6.1.0, replaced by {@link #getWrappedService} + */ + public ConfigurazioneLocalService getWrappedConfigurazioneLocalService() { + return _configurazioneLocalService; + } + + /** + * @deprecated As of 6.1.0, replaced by {@link #setWrappedService} + */ + public void setWrappedConfigurazioneLocalService( + ConfigurazioneLocalService configurazioneLocalService) { + _configurazioneLocalService = configurazioneLocalService; + } + + @Override + public ConfigurazioneLocalService getWrappedService() { + return _configurazioneLocalService; + } + + @Override + public void setWrappedService( + ConfigurazioneLocalService configurazioneLocalService) { + _configurazioneLocalService = configurazioneLocalService; + } + + private ConfigurazioneLocalService _configurazioneLocalService; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/messaging/ClpMessageListener.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/messaging/ClpMessageListener.java new file mode 100644 index 0000000..15329af --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/messaging/ClpMessageListener.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service.messaging; + +import com.liferay.portal.kernel.messaging.BaseMessageListener; +import com.liferay.portal.kernel.messaging.Message; + +import it.mwg.sicilia.login.service.ClpSerializer; +import it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil; + +/** + * @author Manifattura Web Group s.r.l. + */ +public class ClpMessageListener extends BaseMessageListener { + public static String getServletContextName() { + return ClpSerializer.getServletContextName(); + } + + @Override + protected void doReceive(Message message) throws Exception { + String command = message.getString("command"); + String servletContextName = message.getString("servletContextName"); + + if (command.equals("undeploy") && + servletContextName.equals(getServletContextName())) { + ConfigurazioneLocalServiceUtil.clearService(); + } + } +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/persistence/ConfigurazioneActionableDynamicQuery.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/persistence/ConfigurazioneActionableDynamicQuery.java new file mode 100644 index 0000000..9ee2b18 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/persistence/ConfigurazioneActionableDynamicQuery.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service.persistence; + +import com.liferay.portal.kernel.dao.orm.BaseActionableDynamicQuery; +import com.liferay.portal.kernel.exception.SystemException; + +import it.mwg.sicilia.login.model.Configurazione; +import it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil; + +/** + * @author Manifattura Web Group s.r.l. + * @generated + */ +public abstract class ConfigurazioneActionableDynamicQuery + extends BaseActionableDynamicQuery { + public ConfigurazioneActionableDynamicQuery() throws SystemException { + setBaseLocalService(ConfigurazioneLocalServiceUtil.getService()); + setClass(Configurazione.class); + + setClassLoader(it.mwg.sicilia.login.service.ClpSerializer.class.getClassLoader()); + + setPrimaryKeyPropertyName("configurazioneId"); + } +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/persistence/ConfigurazionePersistence.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/persistence/ConfigurazionePersistence.java new file mode 100644 index 0000000..047ca95 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/persistence/ConfigurazionePersistence.java @@ -0,0 +1,366 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service.persistence; + +import com.liferay.portal.service.persistence.BasePersistence; + +import it.mwg.sicilia.login.model.Configurazione; + +/** + * The persistence interface for the configurazione service. + * + *

+ * Caching information and settings can be found in portal.properties + *

+ * + * @author Manifattura Web Group s.r.l. + * @see ConfigurazionePersistenceImpl + * @see ConfigurazioneUtil + * @generated + */ +public interface ConfigurazionePersistence extends BasePersistence { + /* + * NOTE FOR DEVELOPERS: + * + * Never modify or reference this interface directly. Always use {@link ConfigurazioneUtil} to access the configurazione persistence. Modify service.xml and rerun ServiceBuilder to regenerate this interface. + */ + + /** + * Returns all the configuraziones where companyId = ?. + * + * @param companyId the company ID + * @return the matching configuraziones + * @throws SystemException if a system exception occurred + */ + public java.util.List findByCompanyId( + long companyId) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns a range of all the configuraziones where companyId = ?. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param companyId the company ID + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @return the range of matching configuraziones + * @throws SystemException if a system exception occurred + */ + public java.util.List findByCompanyId( + long companyId, int start, int end) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns an ordered range of all the configuraziones where companyId = ?. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param companyId the company ID + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @param orderByComparator the comparator to order the results by (optionally null) + * @return the ordered range of matching configuraziones + * @throws SystemException if a system exception occurred + */ + public java.util.List findByCompanyId( + long companyId, int start, int end, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the first configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the first matching configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione findByCompanyId_First( + long companyId, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException; + + /** + * Returns the first configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the first matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione fetchByCompanyId_First( + long companyId, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the last configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the last matching configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione findByCompanyId_Last( + long companyId, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException; + + /** + * Returns the last configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the last matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione fetchByCompanyId_Last( + long companyId, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the configuraziones before and after the current configurazione in the ordered set where companyId = ?. + * + * @param configurazioneId the primary key of the current configurazione + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the previous, current, and next configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione[] findByCompanyId_PrevAndNext( + long configurazioneId, long companyId, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException; + + /** + * Removes all the configuraziones where companyId = ? from the database. + * + * @param companyId the company ID + * @throws SystemException if a system exception occurred + */ + public void removeByCompanyId(long companyId) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the number of configuraziones where companyId = ?. + * + * @param companyId the company ID + * @return the number of matching configuraziones + * @throws SystemException if a system exception occurred + */ + public int countByCompanyId(long companyId) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the configurazione where companyId = ? and nome = ? or throws a {@link it.mwg.sicilia.login.NoSuchConfigurazioneException} if it could not be found. + * + * @param companyId the company ID + * @param nome the nome + * @return the matching configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione findByCompanyId_Nome( + long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException; + + /** + * Returns the configurazione where companyId = ? and nome = ? or returns null if it could not be found. Uses the finder cache. + * + * @param companyId the company ID + * @param nome the nome + * @return the matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione fetchByCompanyId_Nome( + long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the configurazione where companyId = ? and nome = ? or returns null if it could not be found, optionally using the finder cache. + * + * @param companyId the company ID + * @param nome the nome + * @param retrieveFromCache whether to use the finder cache + * @return the matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione fetchByCompanyId_Nome( + long companyId, java.lang.String nome, boolean retrieveFromCache) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Removes the configurazione where companyId = ? and nome = ? from the database. + * + * @param companyId the company ID + * @param nome the nome + * @return the configurazione that was removed + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione removeByCompanyId_Nome( + long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException; + + /** + * Returns the number of configuraziones where companyId = ? and nome = ?. + * + * @param companyId the company ID + * @param nome the nome + * @return the number of matching configuraziones + * @throws SystemException if a system exception occurred + */ + public int countByCompanyId_Nome(long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Caches the configurazione in the entity cache if it is enabled. + * + * @param configurazione the configurazione + */ + public void cacheResult( + it.mwg.sicilia.login.model.Configurazione configurazione); + + /** + * Caches the configuraziones in the entity cache if it is enabled. + * + * @param configuraziones the configuraziones + */ + public void cacheResult( + java.util.List configuraziones); + + /** + * Creates a new configurazione with the primary key. Does not add the configurazione to the database. + * + * @param configurazioneId the primary key for the new configurazione + * @return the new configurazione + */ + public it.mwg.sicilia.login.model.Configurazione create( + long configurazioneId); + + /** + * Removes the configurazione with the primary key from the database. Also notifies the appropriate model listeners. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione that was removed + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione remove( + long configurazioneId) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException; + + public it.mwg.sicilia.login.model.Configurazione updateImpl( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the configurazione with the primary key or throws a {@link it.mwg.sicilia.login.NoSuchConfigurazioneException} if it could not be found. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione findByPrimaryKey( + long configurazioneId) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException; + + /** + * Returns the configurazione with the primary key or returns null if it could not be found. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione, or null if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + public it.mwg.sicilia.login.model.Configurazione fetchByPrimaryKey( + long configurazioneId) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns all the configuraziones. + * + * @return the configuraziones + * @throws SystemException if a system exception occurred + */ + public java.util.List findAll() + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns a range of all the configuraziones. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @return the range of configuraziones + * @throws SystemException if a system exception occurred + */ + public java.util.List findAll( + int start, int end) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns an ordered range of all the configuraziones. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @param orderByComparator the comparator to order the results by (optionally null) + * @return the ordered range of configuraziones + * @throws SystemException if a system exception occurred + */ + public java.util.List findAll( + int start, int end, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Removes all the configuraziones from the database. + * + * @throws SystemException if a system exception occurred + */ + public void removeAll() + throws com.liferay.portal.kernel.exception.SystemException; + + /** + * Returns the number of configuraziones. + * + * @return the number of configuraziones + * @throws SystemException if a system exception occurred + */ + public int countAll() + throws com.liferay.portal.kernel.exception.SystemException; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/persistence/ConfigurazioneUtil.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/persistence/ConfigurazioneUtil.java new file mode 100644 index 0000000..9493617 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/service/it/mwg/sicilia/login/service/persistence/ConfigurazioneUtil.java @@ -0,0 +1,522 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service.persistence; + +import com.liferay.portal.kernel.bean.PortletBeanLocatorUtil; +import com.liferay.portal.kernel.dao.orm.DynamicQuery; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.util.OrderByComparator; +import com.liferay.portal.kernel.util.ReferenceRegistry; +import com.liferay.portal.service.ServiceContext; + +import it.mwg.sicilia.login.model.Configurazione; + +import java.util.List; + +/** + * The persistence utility for the configurazione service. This utility wraps {@link ConfigurazionePersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class. + * + *

+ * Caching information and settings can be found in portal.properties + *

+ * + * @author Manifattura Web Group s.r.l. + * @see ConfigurazionePersistence + * @see ConfigurazionePersistenceImpl + * @generated + */ +public class ConfigurazioneUtil { + /* + * NOTE FOR DEVELOPERS: + * + * Never modify this class directly. Modify service.xml and rerun ServiceBuilder to regenerate this class. + */ + + /** + * @see com.liferay.portal.service.persistence.BasePersistence#clearCache() + */ + public static void clearCache() { + getPersistence().clearCache(); + } + + /** + * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel) + */ + public static void clearCache(Configurazione configurazione) { + getPersistence().clearCache(configurazione); + } + + /** + * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery) + */ + public static long countWithDynamicQuery(DynamicQuery dynamicQuery) + throws SystemException { + return getPersistence().countWithDynamicQuery(dynamicQuery); + } + + /** + * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery) + */ + public static List findWithDynamicQuery( + DynamicQuery dynamicQuery) throws SystemException { + return getPersistence().findWithDynamicQuery(dynamicQuery); + } + + /** + * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int) + */ + public static List findWithDynamicQuery( + DynamicQuery dynamicQuery, int start, int end) + throws SystemException { + return getPersistence().findWithDynamicQuery(dynamicQuery, start, end); + } + + /** + * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator) + */ + public static List findWithDynamicQuery( + DynamicQuery dynamicQuery, int start, int end, + OrderByComparator orderByComparator) throws SystemException { + return getPersistence() + .findWithDynamicQuery(dynamicQuery, start, end, + orderByComparator); + } + + /** + * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel) + */ + public static Configurazione update(Configurazione configurazione) + throws SystemException { + return getPersistence().update(configurazione); + } + + /** + * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext) + */ + public static Configurazione update(Configurazione configurazione, + ServiceContext serviceContext) throws SystemException { + return getPersistence().update(configurazione, serviceContext); + } + + /** + * Returns all the configuraziones where companyId = ?. + * + * @param companyId the company ID + * @return the matching configuraziones + * @throws SystemException if a system exception occurred + */ + public static java.util.List findByCompanyId( + long companyId) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().findByCompanyId(companyId); + } + + /** + * Returns a range of all the configuraziones where companyId = ?. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param companyId the company ID + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @return the range of matching configuraziones + * @throws SystemException if a system exception occurred + */ + public static java.util.List findByCompanyId( + long companyId, int start, int end) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().findByCompanyId(companyId, start, end); + } + + /** + * Returns an ordered range of all the configuraziones where companyId = ?. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param companyId the company ID + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @param orderByComparator the comparator to order the results by (optionally null) + * @return the ordered range of matching configuraziones + * @throws SystemException if a system exception occurred + */ + public static java.util.List findByCompanyId( + long companyId, int start, int end, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence() + .findByCompanyId(companyId, start, end, orderByComparator); + } + + /** + * Returns the first configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the first matching configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione findByCompanyId_First( + long companyId, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException { + return getPersistence() + .findByCompanyId_First(companyId, orderByComparator); + } + + /** + * Returns the first configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the first matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione fetchByCompanyId_First( + long companyId, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence() + .fetchByCompanyId_First(companyId, orderByComparator); + } + + /** + * Returns the last configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the last matching configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione findByCompanyId_Last( + long companyId, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException { + return getPersistence() + .findByCompanyId_Last(companyId, orderByComparator); + } + + /** + * Returns the last configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the last matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione fetchByCompanyId_Last( + long companyId, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence() + .fetchByCompanyId_Last(companyId, orderByComparator); + } + + /** + * Returns the configuraziones before and after the current configurazione in the ordered set where companyId = ?. + * + * @param configurazioneId the primary key of the current configurazione + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the previous, current, and next configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione[] findByCompanyId_PrevAndNext( + long configurazioneId, long companyId, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException { + return getPersistence() + .findByCompanyId_PrevAndNext(configurazioneId, companyId, + orderByComparator); + } + + /** + * Removes all the configuraziones where companyId = ? from the database. + * + * @param companyId the company ID + * @throws SystemException if a system exception occurred + */ + public static void removeByCompanyId(long companyId) + throws com.liferay.portal.kernel.exception.SystemException { + getPersistence().removeByCompanyId(companyId); + } + + /** + * Returns the number of configuraziones where companyId = ?. + * + * @param companyId the company ID + * @return the number of matching configuraziones + * @throws SystemException if a system exception occurred + */ + public static int countByCompanyId(long companyId) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().countByCompanyId(companyId); + } + + /** + * Returns the configurazione where companyId = ? and nome = ? or throws a {@link it.mwg.sicilia.login.NoSuchConfigurazioneException} if it could not be found. + * + * @param companyId the company ID + * @param nome the nome + * @return the matching configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione findByCompanyId_Nome( + long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException { + return getPersistence().findByCompanyId_Nome(companyId, nome); + } + + /** + * Returns the configurazione where companyId = ? and nome = ? or returns null if it could not be found. Uses the finder cache. + * + * @param companyId the company ID + * @param nome the nome + * @return the matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione fetchByCompanyId_Nome( + long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().fetchByCompanyId_Nome(companyId, nome); + } + + /** + * Returns the configurazione where companyId = ? and nome = ? or returns null if it could not be found, optionally using the finder cache. + * + * @param companyId the company ID + * @param nome the nome + * @param retrieveFromCache whether to use the finder cache + * @return the matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione fetchByCompanyId_Nome( + long companyId, java.lang.String nome, boolean retrieveFromCache) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence() + .fetchByCompanyId_Nome(companyId, nome, retrieveFromCache); + } + + /** + * Removes the configurazione where companyId = ? and nome = ? from the database. + * + * @param companyId the company ID + * @param nome the nome + * @return the configurazione that was removed + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione removeByCompanyId_Nome( + long companyId, java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException { + return getPersistence().removeByCompanyId_Nome(companyId, nome); + } + + /** + * Returns the number of configuraziones where companyId = ? and nome = ?. + * + * @param companyId the company ID + * @param nome the nome + * @return the number of matching configuraziones + * @throws SystemException if a system exception occurred + */ + public static int countByCompanyId_Nome(long companyId, + java.lang.String nome) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().countByCompanyId_Nome(companyId, nome); + } + + /** + * Caches the configurazione in the entity cache if it is enabled. + * + * @param configurazione the configurazione + */ + public static void cacheResult( + it.mwg.sicilia.login.model.Configurazione configurazione) { + getPersistence().cacheResult(configurazione); + } + + /** + * Caches the configuraziones in the entity cache if it is enabled. + * + * @param configuraziones the configuraziones + */ + public static void cacheResult( + java.util.List configuraziones) { + getPersistence().cacheResult(configuraziones); + } + + /** + * Creates a new configurazione with the primary key. Does not add the configurazione to the database. + * + * @param configurazioneId the primary key for the new configurazione + * @return the new configurazione + */ + public static it.mwg.sicilia.login.model.Configurazione create( + long configurazioneId) { + return getPersistence().create(configurazioneId); + } + + /** + * Removes the configurazione with the primary key from the database. Also notifies the appropriate model listeners. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione that was removed + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione remove( + long configurazioneId) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException { + return getPersistence().remove(configurazioneId); + } + + public static it.mwg.sicilia.login.model.Configurazione updateImpl( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().updateImpl(configurazione); + } + + /** + * Returns the configurazione with the primary key or throws a {@link it.mwg.sicilia.login.NoSuchConfigurazioneException} if it could not be found. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione findByPrimaryKey( + long configurazioneId) + throws com.liferay.portal.kernel.exception.SystemException, + it.mwg.sicilia.login.NoSuchConfigurazioneException { + return getPersistence().findByPrimaryKey(configurazioneId); + } + + /** + * Returns the configurazione with the primary key or returns null if it could not be found. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione, or null if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + public static it.mwg.sicilia.login.model.Configurazione fetchByPrimaryKey( + long configurazioneId) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().fetchByPrimaryKey(configurazioneId); + } + + /** + * Returns all the configuraziones. + * + * @return the configuraziones + * @throws SystemException if a system exception occurred + */ + public static java.util.List findAll() + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().findAll(); + } + + /** + * Returns a range of all the configuraziones. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @return the range of configuraziones + * @throws SystemException if a system exception occurred + */ + public static java.util.List findAll( + int start, int end) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().findAll(start, end); + } + + /** + * Returns an ordered range of all the configuraziones. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @param orderByComparator the comparator to order the results by (optionally null) + * @return the ordered range of configuraziones + * @throws SystemException if a system exception occurred + */ + public static java.util.List findAll( + int start, int end, + com.liferay.portal.kernel.util.OrderByComparator orderByComparator) + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().findAll(start, end, orderByComparator); + } + + /** + * Removes all the configuraziones from the database. + * + * @throws SystemException if a system exception occurred + */ + public static void removeAll() + throws com.liferay.portal.kernel.exception.SystemException { + getPersistence().removeAll(); + } + + /** + * Returns the number of configuraziones. + * + * @return the number of configuraziones + * @throws SystemException if a system exception occurred + */ + public static int countAll() + throws com.liferay.portal.kernel.exception.SystemException { + return getPersistence().countAll(); + } + + public static ConfigurazionePersistence getPersistence() { + if (_persistence == null) { + _persistence = (ConfigurazionePersistence)PortletBeanLocatorUtil.locate(it.mwg.sicilia.login.service.ClpSerializer.getServletContextName(), + ConfigurazionePersistence.class.getName()); + + ReferenceRegistry.registerReference(ConfigurazioneUtil.class, + "_persistence"); + } + + return _persistence; + } + + /** + * @deprecated As of 6.2.0 + */ + public void setPersistence(ConfigurazionePersistence persistence) { + } + + private static ConfigurazionePersistence _persistence; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/indexes.properties b/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/indexes.properties new file mode 100644 index 0000000..5bf4125 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/indexes.properties @@ -0,0 +1,2 @@ +IX_B5FCFCE0=sicilia_login_Configurazione.CompanyId +IX_9A236DAD=sicilia_login_Configurazione.CompanyId_Nome \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/indexes.sql b/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/indexes.sql new file mode 100644 index 0000000..a0f740c --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/indexes.sql @@ -0,0 +1,2 @@ +create index IX_B5FCFCE0 on sicilia_login_Configurazione (companyId); +create unique index IX_9A236DAD on sicilia_login_Configurazione (companyId, nome); \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/sequences.sql b/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/sequences.sql new file mode 100644 index 0000000..e69de29 diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/tables.sql b/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/tables.sql new file mode 100644 index 0000000..c7346c1 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/sql/tables.sql @@ -0,0 +1,10 @@ +create table sicilia_login_Configurazione ( + configurazioneId LONG not null primary key, + nome VARCHAR(75) null, + valore VARCHAR(75) null, + companyId LONG, + userId LONG, + userName VARCHAR(75) null, + createDate DATE null, + modifiedDate DATE null +); \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/base-spring.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/base-spring.xml new file mode 100644 index 0000000..8e5edba --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/base-spring.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/cluster-spring.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/cluster-spring.xml new file mode 100644 index 0000000..cd5219b --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/cluster-spring.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/hibernate-spring.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/hibernate-spring.xml new file mode 100644 index 0000000..27564a2 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/hibernate-spring.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/infrastructure-spring.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/infrastructure-spring.xml new file mode 100644 index 0000000..380d697 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/infrastructure-spring.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-hbm.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-hbm.xml new file mode 100644 index 0000000..b6d494e --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-hbm.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-model-hints.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-model-hints.xml new file mode 100644 index 0000000..8404d4a --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-model-hints.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-orm.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-orm.xml new file mode 100644 index 0000000..af52e84 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-orm.xml @@ -0,0 +1,34 @@ + + + + + + + PROPERTY + + + + + + + + + + + + TIMESTAMP + + + TIMESTAMP + + + + + + + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-spring.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-spring.xml new file mode 100644 index 0000000..ff280ca --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/portlet-spring.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/shard-data-source-spring.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/shard-data-source-spring.xml new file mode 100644 index 0000000..fe293f4 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/META-INF/shard-data-source-spring.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/content/Language.properties b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/content/Language.properties new file mode 100644 index 0000000..026a397 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/content/Language.properties @@ -0,0 +1,2 @@ +login-server = URL del server di login +username-without-password = Per modificare il nome utente è necessario specificare anche la password diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/UserNameWithoutPasswordException.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/UserNameWithoutPasswordException.java new file mode 100644 index 0000000..423c40c --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/UserNameWithoutPasswordException.java @@ -0,0 +1,26 @@ +package it.mwg.sicilia.login; + +import com.liferay.portal.kernel.exception.SystemException; + +/** + * @author Manifattura Web Group s.r.l. + */ +@SuppressWarnings("serial") +public class UserNameWithoutPasswordException extends SystemException { + + public UserNameWithoutPasswordException() { + super(); + } + + public UserNameWithoutPasswordException(String msg) { + super(msg); + } + + public UserNameWithoutPasswordException(Throwable cause) { + super(cause); + } + + public UserNameWithoutPasswordException(String msg, Throwable cause) { + super(msg, cause); + } +} diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneBaseImpl.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneBaseImpl.java new file mode 100644 index 0000000..900b245 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneBaseImpl.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.model.impl; + +import com.liferay.portal.kernel.exception.SystemException; + +import it.mwg.sicilia.login.model.Configurazione; +import it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil; + +/** + * The extended model base implementation for the Configurazione service. Represents a row in the "sicilia_login_Configurazione" database table, with each column mapped to a property of this class. + * + *

+ * This class exists only as a container for the default extended model level methods generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ConfigurazioneImpl}. + *

+ * + * @author Manifattura Web Group s.r.l. + * @see ConfigurazioneImpl + * @see it.mwg.sicilia.login.model.Configurazione + * @generated + */ +public abstract class ConfigurazioneBaseImpl extends ConfigurazioneModelImpl + implements Configurazione { + /* + * NOTE FOR DEVELOPERS: + * + * Never modify or reference this class directly. All methods that expect a configurazione model instance should use the {@link Configurazione} interface instead. + */ + @Override + public void persist() throws SystemException { + if (this.isNew()) { + ConfigurazioneLocalServiceUtil.addConfigurazione(this); + } + else { + ConfigurazioneLocalServiceUtil.updateConfigurazione(this); + } + } +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneCacheModel.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneCacheModel.java new file mode 100644 index 0000000..44d9d32 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneCacheModel.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.model.impl; + +import com.liferay.portal.kernel.util.StringBundler; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.model.CacheModel; + +import it.mwg.sicilia.login.model.Configurazione; + +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; + +import java.util.Date; + +/** + * The cache model class for representing Configurazione in entity cache. + * + * @author Manifattura Web Group s.r.l. + * @see Configurazione + * @generated + */ +public class ConfigurazioneCacheModel implements CacheModel, + Externalizable { + @Override + public String toString() { + StringBundler sb = new StringBundler(17); + + sb.append("{configurazioneId="); + sb.append(configurazioneId); + sb.append(", nome="); + sb.append(nome); + sb.append(", valore="); + sb.append(valore); + sb.append(", companyId="); + sb.append(companyId); + sb.append(", userId="); + sb.append(userId); + sb.append(", userName="); + sb.append(userName); + sb.append(", createDate="); + sb.append(createDate); + sb.append(", modifiedDate="); + sb.append(modifiedDate); + sb.append("}"); + + return sb.toString(); + } + + @Override + public Configurazione toEntityModel() { + ConfigurazioneImpl configurazioneImpl = new ConfigurazioneImpl(); + + configurazioneImpl.setConfigurazioneId(configurazioneId); + + if (nome == null) { + configurazioneImpl.setNome(StringPool.BLANK); + } + else { + configurazioneImpl.setNome(nome); + } + + if (valore == null) { + configurazioneImpl.setValore(StringPool.BLANK); + } + else { + configurazioneImpl.setValore(valore); + } + + configurazioneImpl.setCompanyId(companyId); + configurazioneImpl.setUserId(userId); + + if (userName == null) { + configurazioneImpl.setUserName(StringPool.BLANK); + } + else { + configurazioneImpl.setUserName(userName); + } + + if (createDate == Long.MIN_VALUE) { + configurazioneImpl.setCreateDate(null); + } + else { + configurazioneImpl.setCreateDate(new Date(createDate)); + } + + if (modifiedDate == Long.MIN_VALUE) { + configurazioneImpl.setModifiedDate(null); + } + else { + configurazioneImpl.setModifiedDate(new Date(modifiedDate)); + } + + configurazioneImpl.resetOriginalValues(); + + return configurazioneImpl; + } + + @Override + public void readExternal(ObjectInput objectInput) throws IOException { + configurazioneId = objectInput.readLong(); + nome = objectInput.readUTF(); + valore = objectInput.readUTF(); + companyId = objectInput.readLong(); + userId = objectInput.readLong(); + userName = objectInput.readUTF(); + createDate = objectInput.readLong(); + modifiedDate = objectInput.readLong(); + } + + @Override + public void writeExternal(ObjectOutput objectOutput) + throws IOException { + objectOutput.writeLong(configurazioneId); + + if (nome == null) { + objectOutput.writeUTF(StringPool.BLANK); + } + else { + objectOutput.writeUTF(nome); + } + + if (valore == null) { + objectOutput.writeUTF(StringPool.BLANK); + } + else { + objectOutput.writeUTF(valore); + } + + objectOutput.writeLong(companyId); + objectOutput.writeLong(userId); + + if (userName == null) { + objectOutput.writeUTF(StringPool.BLANK); + } + else { + objectOutput.writeUTF(userName); + } + + objectOutput.writeLong(createDate); + objectOutput.writeLong(modifiedDate); + } + + public long configurazioneId; + public String nome; + public String valore; + public long companyId; + public long userId; + public String userName; + public long createDate; + public long modifiedDate; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneImpl.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneImpl.java new file mode 100644 index 0000000..707d933 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneImpl.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.model.impl; + +/** + * The extended model implementation for the Configurazione service. Represents a row in the "sicilia_login_Configurazione" database table, with each column mapped to a property of this class. + * + *

+ * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.mwg.sicilia.login.model.Configurazione} interface. + *

+ * + * @author Manifattura Web Group s.r.l. + */ +public class ConfigurazioneImpl extends ConfigurazioneBaseImpl { + /* + * NOTE FOR DEVELOPERS: + * + * Never reference this class directly. All methods that expect a configurazione model instance should use the {@link it.mwg.sicilia.login.model.Configurazione} interface instead. + */ + public ConfigurazioneImpl() { + } +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneModelImpl.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneModelImpl.java new file mode 100644 index 0000000..dc31640 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/model/impl/ConfigurazioneModelImpl.java @@ -0,0 +1,566 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.model.impl; + +import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.util.GetterUtil; +import com.liferay.portal.kernel.util.ProxyUtil; +import com.liferay.portal.kernel.util.StringBundler; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.model.CacheModel; +import com.liferay.portal.model.impl.BaseModelImpl; +import com.liferay.portal.service.ServiceContext; +import com.liferay.portal.util.PortalUtil; + +import com.liferay.portlet.expando.model.ExpandoBridge; +import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil; + +import it.mwg.sicilia.login.model.Configurazione; +import it.mwg.sicilia.login.model.ConfigurazioneModel; + +import java.io.Serializable; + +import java.sql.Types; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * The base model implementation for the Configurazione service. Represents a row in the "sicilia_login_Configurazione" database table, with each column mapped to a property of this class. + * + *

+ * This implementation and its corresponding interface {@link it.mwg.sicilia.login.model.ConfigurazioneModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ConfigurazioneImpl}. + *

+ * + * @author Manifattura Web Group s.r.l. + * @see ConfigurazioneImpl + * @see it.mwg.sicilia.login.model.Configurazione + * @see it.mwg.sicilia.login.model.ConfigurazioneModel + * @generated + */ +public class ConfigurazioneModelImpl extends BaseModelImpl + implements ConfigurazioneModel { + /* + * NOTE FOR DEVELOPERS: + * + * Never modify or reference this class directly. All methods that expect a configurazione model instance should use the {@link it.mwg.sicilia.login.model.Configurazione} interface instead. + */ + public static final String TABLE_NAME = "sicilia_login_Configurazione"; + public static final Object[][] TABLE_COLUMNS = { + { "configurazioneId", Types.BIGINT }, + { "nome", Types.VARCHAR }, + { "valore", Types.VARCHAR }, + { "companyId", Types.BIGINT }, + { "userId", Types.BIGINT }, + { "userName", Types.VARCHAR }, + { "createDate", Types.TIMESTAMP }, + { "modifiedDate", Types.TIMESTAMP } + }; + public static final String TABLE_SQL_CREATE = "create table sicilia_login_Configurazione (configurazioneId LONG not null primary key,nome VARCHAR(75) null,valore VARCHAR(75) null,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null)"; + public static final String TABLE_SQL_DROP = "drop table sicilia_login_Configurazione"; + public static final String ORDER_BY_JPQL = " ORDER BY configurazione.configurazioneId ASC"; + public static final String ORDER_BY_SQL = " ORDER BY sicilia_login_Configurazione.configurazioneId ASC"; + public static final String DATA_SOURCE = "liferayDataSource"; + public static final String SESSION_FACTORY = "liferaySessionFactory"; + public static final String TX_MANAGER = "liferayTransactionManager"; + public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( + "value.object.entity.cache.enabled.it.mwg.sicilia.login.model.Configurazione"), + true); + public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( + "value.object.finder.cache.enabled.it.mwg.sicilia.login.model.Configurazione"), + true); + public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( + "value.object.column.bitmask.enabled.it.mwg.sicilia.login.model.Configurazione"), + true); + public static long COMPANYID_COLUMN_BITMASK = 1L; + public static long NOME_COLUMN_BITMASK = 2L; + public static long CONFIGURAZIONEID_COLUMN_BITMASK = 4L; + public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get( + "lock.expiration.time.it.mwg.sicilia.login.model.Configurazione")); + + public ConfigurazioneModelImpl() { + } + + @Override + public long getPrimaryKey() { + return _configurazioneId; + } + + @Override + public void setPrimaryKey(long primaryKey) { + setConfigurazioneId(primaryKey); + } + + @Override + public Serializable getPrimaryKeyObj() { + return _configurazioneId; + } + + @Override + public void setPrimaryKeyObj(Serializable primaryKeyObj) { + setPrimaryKey(((Long)primaryKeyObj).longValue()); + } + + @Override + public Class getModelClass() { + return Configurazione.class; + } + + @Override + public String getModelClassName() { + return Configurazione.class.getName(); + } + + @Override + public Map getModelAttributes() { + Map attributes = new HashMap(); + + attributes.put("configurazioneId", getConfigurazioneId()); + attributes.put("nome", getNome()); + attributes.put("valore", getValore()); + attributes.put("companyId", getCompanyId()); + attributes.put("userId", getUserId()); + attributes.put("userName", getUserName()); + attributes.put("createDate", getCreateDate()); + attributes.put("modifiedDate", getModifiedDate()); + + return attributes; + } + + @Override + public void setModelAttributes(Map attributes) { + Long configurazioneId = (Long)attributes.get("configurazioneId"); + + if (configurazioneId != null) { + setConfigurazioneId(configurazioneId); + } + + String nome = (String)attributes.get("nome"); + + if (nome != null) { + setNome(nome); + } + + String valore = (String)attributes.get("valore"); + + if (valore != null) { + setValore(valore); + } + + Long companyId = (Long)attributes.get("companyId"); + + if (companyId != null) { + setCompanyId(companyId); + } + + Long userId = (Long)attributes.get("userId"); + + if (userId != null) { + setUserId(userId); + } + + String userName = (String)attributes.get("userName"); + + if (userName != null) { + setUserName(userName); + } + + Date createDate = (Date)attributes.get("createDate"); + + if (createDate != null) { + setCreateDate(createDate); + } + + Date modifiedDate = (Date)attributes.get("modifiedDate"); + + if (modifiedDate != null) { + setModifiedDate(modifiedDate); + } + } + + @Override + public long getConfigurazioneId() { + return _configurazioneId; + } + + @Override + public void setConfigurazioneId(long configurazioneId) { + _configurazioneId = configurazioneId; + } + + @Override + public String getNome() { + if (_nome == null) { + return StringPool.BLANK; + } + else { + return _nome; + } + } + + @Override + public void setNome(String nome) { + _columnBitmask |= NOME_COLUMN_BITMASK; + + if (_originalNome == null) { + _originalNome = _nome; + } + + _nome = nome; + } + + public String getOriginalNome() { + return GetterUtil.getString(_originalNome); + } + + @Override + public String getValore() { + if (_valore == null) { + return StringPool.BLANK; + } + else { + return _valore; + } + } + + @Override + public void setValore(String valore) { + _valore = valore; + } + + @Override + public long getCompanyId() { + return _companyId; + } + + @Override + public void setCompanyId(long companyId) { + _columnBitmask |= COMPANYID_COLUMN_BITMASK; + + if (!_setOriginalCompanyId) { + _setOriginalCompanyId = true; + + _originalCompanyId = _companyId; + } + + _companyId = companyId; + } + + public long getOriginalCompanyId() { + return _originalCompanyId; + } + + @Override + public long getUserId() { + return _userId; + } + + @Override + public void setUserId(long userId) { + _userId = userId; + } + + @Override + public String getUserUuid() throws SystemException { + return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid); + } + + @Override + public void setUserUuid(String userUuid) { + _userUuid = userUuid; + } + + @Override + public String getUserName() { + if (_userName == null) { + return StringPool.BLANK; + } + else { + return _userName; + } + } + + @Override + public void setUserName(String userName) { + _userName = userName; + } + + @Override + public Date getCreateDate() { + return _createDate; + } + + @Override + public void setCreateDate(Date createDate) { + _createDate = createDate; + } + + @Override + public Date getModifiedDate() { + return _modifiedDate; + } + + @Override + public void setModifiedDate(Date modifiedDate) { + _modifiedDate = modifiedDate; + } + + public long getColumnBitmask() { + return _columnBitmask; + } + + @Override + public ExpandoBridge getExpandoBridge() { + return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(), + Configurazione.class.getName(), getPrimaryKey()); + } + + @Override + public void setExpandoBridgeAttributes(ServiceContext serviceContext) { + ExpandoBridge expandoBridge = getExpandoBridge(); + + expandoBridge.setAttributes(serviceContext); + } + + @Override + public Configurazione toEscapedModel() { + if (_escapedModel == null) { + _escapedModel = (Configurazione)ProxyUtil.newProxyInstance(_classLoader, + _escapedModelInterfaces, new AutoEscapeBeanHandler(this)); + } + + return _escapedModel; + } + + @Override + public Object clone() { + ConfigurazioneImpl configurazioneImpl = new ConfigurazioneImpl(); + + configurazioneImpl.setConfigurazioneId(getConfigurazioneId()); + configurazioneImpl.setNome(getNome()); + configurazioneImpl.setValore(getValore()); + configurazioneImpl.setCompanyId(getCompanyId()); + configurazioneImpl.setUserId(getUserId()); + configurazioneImpl.setUserName(getUserName()); + configurazioneImpl.setCreateDate(getCreateDate()); + configurazioneImpl.setModifiedDate(getModifiedDate()); + + configurazioneImpl.resetOriginalValues(); + + return configurazioneImpl; + } + + @Override + public int compareTo(Configurazione configurazione) { + long primaryKey = configurazione.getPrimaryKey(); + + if (getPrimaryKey() < primaryKey) { + return -1; + } + else if (getPrimaryKey() > primaryKey) { + return 1; + } + else { + return 0; + } + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (!(obj instanceof Configurazione)) { + return false; + } + + Configurazione configurazione = (Configurazione)obj; + + long primaryKey = configurazione.getPrimaryKey(); + + if (getPrimaryKey() == primaryKey) { + return true; + } + else { + return false; + } + } + + @Override + public int hashCode() { + return (int)getPrimaryKey(); + } + + @Override + public void resetOriginalValues() { + ConfigurazioneModelImpl configurazioneModelImpl = this; + + configurazioneModelImpl._originalNome = configurazioneModelImpl._nome; + + configurazioneModelImpl._originalCompanyId = configurazioneModelImpl._companyId; + + configurazioneModelImpl._setOriginalCompanyId = false; + + configurazioneModelImpl._columnBitmask = 0; + } + + @Override + public CacheModel toCacheModel() { + ConfigurazioneCacheModel configurazioneCacheModel = new ConfigurazioneCacheModel(); + + configurazioneCacheModel.configurazioneId = getConfigurazioneId(); + + configurazioneCacheModel.nome = getNome(); + + String nome = configurazioneCacheModel.nome; + + if ((nome != null) && (nome.length() == 0)) { + configurazioneCacheModel.nome = null; + } + + configurazioneCacheModel.valore = getValore(); + + String valore = configurazioneCacheModel.valore; + + if ((valore != null) && (valore.length() == 0)) { + configurazioneCacheModel.valore = null; + } + + configurazioneCacheModel.companyId = getCompanyId(); + + configurazioneCacheModel.userId = getUserId(); + + configurazioneCacheModel.userName = getUserName(); + + String userName = configurazioneCacheModel.userName; + + if ((userName != null) && (userName.length() == 0)) { + configurazioneCacheModel.userName = null; + } + + Date createDate = getCreateDate(); + + if (createDate != null) { + configurazioneCacheModel.createDate = createDate.getTime(); + } + else { + configurazioneCacheModel.createDate = Long.MIN_VALUE; + } + + Date modifiedDate = getModifiedDate(); + + if (modifiedDate != null) { + configurazioneCacheModel.modifiedDate = modifiedDate.getTime(); + } + else { + configurazioneCacheModel.modifiedDate = Long.MIN_VALUE; + } + + return configurazioneCacheModel; + } + + @Override + public String toString() { + StringBundler sb = new StringBundler(17); + + sb.append("{configurazioneId="); + sb.append(getConfigurazioneId()); + sb.append(", nome="); + sb.append(getNome()); + sb.append(", valore="); + sb.append(getValore()); + sb.append(", companyId="); + sb.append(getCompanyId()); + sb.append(", userId="); + sb.append(getUserId()); + sb.append(", userName="); + sb.append(getUserName()); + sb.append(", createDate="); + sb.append(getCreateDate()); + sb.append(", modifiedDate="); + sb.append(getModifiedDate()); + sb.append("}"); + + return sb.toString(); + } + + @Override + public String toXmlString() { + StringBundler sb = new StringBundler(28); + + sb.append(""); + sb.append("it.mwg.sicilia.login.model.Configurazione"); + sb.append(""); + + sb.append( + "configurazioneId"); + sb.append( + "nome"); + sb.append( + "valore"); + sb.append( + "companyId"); + sb.append( + "userId"); + sb.append( + "userName"); + sb.append( + "createDate"); + sb.append( + "modifiedDate"); + + sb.append(""); + + return sb.toString(); + } + + private static ClassLoader _classLoader = Configurazione.class.getClassLoader(); + private static Class[] _escapedModelInterfaces = new Class[] { + Configurazione.class + }; + private long _configurazioneId; + private String _nome; + private String _originalNome; + private String _valore; + private long _companyId; + private long _originalCompanyId; + private boolean _setOriginalCompanyId; + private long _userId; + private String _userUuid; + private String _userName; + private Date _createDate; + private Date _modifiedDate; + private long _columnBitmask; + private Configurazione _escapedModel; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/portlet/ConfigurazioneLogin.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/portlet/ConfigurazioneLogin.java new file mode 100644 index 0000000..a8eb61e --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/portlet/ConfigurazioneLogin.java @@ -0,0 +1,19 @@ +package it.mwg.sicilia.login.portlet; + +import it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil; + +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; + +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.util.bridges.mvc.MVCPortlet; + +public class ConfigurazioneLogin extends MVCPortlet { + + public void salvaImpostazioni(ActionRequest request, ActionResponse response) throws PortalException, + SystemException { + + ConfigurazioneLocalServiceUtil.salvaImpostazioni(request, response); + } +} diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/base/ConfigurazioneLocalServiceBaseImpl.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/base/ConfigurazioneLocalServiceBaseImpl.java new file mode 100644 index 0000000..6eaab13 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/base/ConfigurazioneLocalServiceBaseImpl.java @@ -0,0 +1,514 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service.base; + +import com.liferay.portal.kernel.bean.BeanReference; +import com.liferay.portal.kernel.bean.IdentifiableBean; +import com.liferay.portal.kernel.dao.jdbc.SqlUpdate; +import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil; +import com.liferay.portal.kernel.dao.orm.DynamicQuery; +import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; +import com.liferay.portal.kernel.dao.orm.Projection; +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.search.Indexable; +import com.liferay.portal.kernel.search.IndexableType; +import com.liferay.portal.kernel.util.OrderByComparator; +import com.liferay.portal.model.PersistedModel; +import com.liferay.portal.service.BaseLocalServiceImpl; +import com.liferay.portal.service.PersistedModelLocalServiceRegistryUtil; +import com.liferay.portal.service.persistence.UserPersistence; + +import it.mwg.sicilia.login.model.Configurazione; +import it.mwg.sicilia.login.service.ConfigurazioneLocalService; +import it.mwg.sicilia.login.service.persistence.ConfigurazionePersistence; + +import java.io.Serializable; + +import java.util.List; + +import javax.sql.DataSource; + +/** + * Provides the base implementation for the configurazione local service. + * + *

+ * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link it.mwg.sicilia.login.service.impl.ConfigurazioneLocalServiceImpl}. + *

+ * + * @author Manifattura Web Group s.r.l. + * @see it.mwg.sicilia.login.service.impl.ConfigurazioneLocalServiceImpl + * @see it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil + * @generated + */ +public abstract class ConfigurazioneLocalServiceBaseImpl + extends BaseLocalServiceImpl implements ConfigurazioneLocalService, + IdentifiableBean { + /* + * NOTE FOR DEVELOPERS: + * + * Never modify or reference this class directly. Always use {@link it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil} to access the configurazione local service. + */ + + /** + * Adds the configurazione to the database. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was added + * @throws SystemException if a system exception occurred + */ + @Indexable(type = IndexableType.REINDEX) + @Override + public Configurazione addConfigurazione(Configurazione configurazione) + throws SystemException { + configurazione.setNew(true); + + return configurazionePersistence.update(configurazione); + } + + /** + * Creates a new configurazione with the primary key. Does not add the configurazione to the database. + * + * @param configurazioneId the primary key for the new configurazione + * @return the new configurazione + */ + @Override + public Configurazione createConfigurazione(long configurazioneId) { + return configurazionePersistence.create(configurazioneId); + } + + /** + * Deletes the configurazione with the primary key from the database. Also notifies the appropriate model listeners. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione that was removed + * @throws PortalException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Indexable(type = IndexableType.DELETE) + @Override + public Configurazione deleteConfigurazione(long configurazioneId) + throws PortalException, SystemException { + return configurazionePersistence.remove(configurazioneId); + } + + /** + * Deletes the configurazione from the database. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was removed + * @throws SystemException if a system exception occurred + */ + @Indexable(type = IndexableType.DELETE) + @Override + public Configurazione deleteConfigurazione(Configurazione configurazione) + throws SystemException { + return configurazionePersistence.remove(configurazione); + } + + @Override + public DynamicQuery dynamicQuery() { + Class clazz = getClass(); + + return DynamicQueryFactoryUtil.forClass(Configurazione.class, + clazz.getClassLoader()); + } + + /** + * Performs a dynamic query on the database and returns the matching rows. + * + * @param dynamicQuery the dynamic query + * @return the matching rows + * @throws SystemException if a system exception occurred + */ + @Override + @SuppressWarnings("rawtypes") + public List dynamicQuery(DynamicQuery dynamicQuery) + throws SystemException { + return configurazionePersistence.findWithDynamicQuery(dynamicQuery); + } + + /** + * Performs a dynamic query on the database and returns a range of the matching rows. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param dynamicQuery the dynamic query + * @param start the lower bound of the range of model instances + * @param end the upper bound of the range of model instances (not inclusive) + * @return the range of matching rows + * @throws SystemException if a system exception occurred + */ + @Override + @SuppressWarnings("rawtypes") + public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end) + throws SystemException { + return configurazionePersistence.findWithDynamicQuery(dynamicQuery, + start, end); + } + + /** + * Performs a dynamic query on the database and returns an ordered range of the matching rows. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param dynamicQuery the dynamic query + * @param start the lower bound of the range of model instances + * @param end the upper bound of the range of model instances (not inclusive) + * @param orderByComparator the comparator to order the results by (optionally null) + * @return the ordered range of matching rows + * @throws SystemException if a system exception occurred + */ + @Override + @SuppressWarnings("rawtypes") + public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end, + OrderByComparator orderByComparator) throws SystemException { + return configurazionePersistence.findWithDynamicQuery(dynamicQuery, + start, end, orderByComparator); + } + + /** + * Returns the number of rows that match the dynamic query. + * + * @param dynamicQuery the dynamic query + * @return the number of rows that match the dynamic query + * @throws SystemException if a system exception occurred + */ + @Override + public long dynamicQueryCount(DynamicQuery dynamicQuery) + throws SystemException { + return configurazionePersistence.countWithDynamicQuery(dynamicQuery); + } + + /** + * Returns the number of rows that match the dynamic query. + * + * @param dynamicQuery the dynamic query + * @param projection the projection to apply to the query + * @return the number of rows that match the dynamic query + * @throws SystemException if a system exception occurred + */ + @Override + public long dynamicQueryCount(DynamicQuery dynamicQuery, + Projection projection) throws SystemException { + return configurazionePersistence.countWithDynamicQuery(dynamicQuery, + projection); + } + + @Override + public Configurazione fetchConfigurazione(long configurazioneId) + throws SystemException { + return configurazionePersistence.fetchByPrimaryKey(configurazioneId); + } + + /** + * Returns the configurazione with the primary key. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione + * @throws PortalException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione getConfigurazione(long configurazioneId) + throws PortalException, SystemException { + return configurazionePersistence.findByPrimaryKey(configurazioneId); + } + + @Override + public PersistedModel getPersistedModel(Serializable primaryKeyObj) + throws PortalException, SystemException { + return configurazionePersistence.findByPrimaryKey(primaryKeyObj); + } + + /** + * Returns a range of all the configuraziones. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @return the range of configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public List getConfiguraziones(int start, int end) + throws SystemException { + return configurazionePersistence.findAll(start, end); + } + + /** + * Returns the number of configuraziones. + * + * @return the number of configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public int getConfigurazionesCount() throws SystemException { + return configurazionePersistence.countAll(); + } + + /** + * Updates the configurazione in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. + * + * @param configurazione the configurazione + * @return the configurazione that was updated + * @throws SystemException if a system exception occurred + */ + @Indexable(type = IndexableType.REINDEX) + @Override + public Configurazione updateConfigurazione(Configurazione configurazione) + throws SystemException { + return configurazionePersistence.update(configurazione); + } + + /** + * Returns the configurazione local service. + * + * @return the configurazione local service + */ + public it.mwg.sicilia.login.service.ConfigurazioneLocalService getConfigurazioneLocalService() { + return configurazioneLocalService; + } + + /** + * Sets the configurazione local service. + * + * @param configurazioneLocalService the configurazione local service + */ + public void setConfigurazioneLocalService( + it.mwg.sicilia.login.service.ConfigurazioneLocalService configurazioneLocalService) { + this.configurazioneLocalService = configurazioneLocalService; + } + + /** + * Returns the configurazione persistence. + * + * @return the configurazione persistence + */ + public ConfigurazionePersistence getConfigurazionePersistence() { + return configurazionePersistence; + } + + /** + * Sets the configurazione persistence. + * + * @param configurazionePersistence the configurazione persistence + */ + public void setConfigurazionePersistence( + ConfigurazionePersistence configurazionePersistence) { + this.configurazionePersistence = configurazionePersistence; + } + + /** + * Returns the counter local service. + * + * @return the counter local service + */ + public com.liferay.counter.service.CounterLocalService getCounterLocalService() { + return counterLocalService; + } + + /** + * Sets the counter local service. + * + * @param counterLocalService the counter local service + */ + public void setCounterLocalService( + com.liferay.counter.service.CounterLocalService counterLocalService) { + this.counterLocalService = counterLocalService; + } + + /** + * Returns the resource local service. + * + * @return the resource local service + */ + public com.liferay.portal.service.ResourceLocalService getResourceLocalService() { + return resourceLocalService; + } + + /** + * Sets the resource local service. + * + * @param resourceLocalService the resource local service + */ + public void setResourceLocalService( + com.liferay.portal.service.ResourceLocalService resourceLocalService) { + this.resourceLocalService = resourceLocalService; + } + + /** + * Returns the user local service. + * + * @return the user local service + */ + public com.liferay.portal.service.UserLocalService getUserLocalService() { + return userLocalService; + } + + /** + * Sets the user local service. + * + * @param userLocalService the user local service + */ + public void setUserLocalService( + com.liferay.portal.service.UserLocalService userLocalService) { + this.userLocalService = userLocalService; + } + + /** + * Returns the user remote service. + * + * @return the user remote service + */ + public com.liferay.portal.service.UserService getUserService() { + return userService; + } + + /** + * Sets the user remote service. + * + * @param userService the user remote service + */ + public void setUserService( + com.liferay.portal.service.UserService userService) { + this.userService = userService; + } + + /** + * Returns the user persistence. + * + * @return the user persistence + */ + public UserPersistence getUserPersistence() { + return userPersistence; + } + + /** + * Sets the user persistence. + * + * @param userPersistence the user persistence + */ + public void setUserPersistence(UserPersistence userPersistence) { + this.userPersistence = userPersistence; + } + + public void afterPropertiesSet() { + Class clazz = getClass(); + + _classLoader = clazz.getClassLoader(); + + PersistedModelLocalServiceRegistryUtil.register("it.mwg.sicilia.login.model.Configurazione", + configurazioneLocalService); + } + + public void destroy() { + PersistedModelLocalServiceRegistryUtil.unregister( + "it.mwg.sicilia.login.model.Configurazione"); + } + + /** + * Returns the Spring bean ID for this bean. + * + * @return the Spring bean ID for this bean + */ + @Override + public String getBeanIdentifier() { + return _beanIdentifier; + } + + /** + * Sets the Spring bean ID for this bean. + * + * @param beanIdentifier the Spring bean ID for this bean + */ + @Override + public void setBeanIdentifier(String beanIdentifier) { + _beanIdentifier = beanIdentifier; + } + + @Override + public Object invokeMethod(String name, String[] parameterTypes, + Object[] arguments) throws Throwable { + Thread currentThread = Thread.currentThread(); + + ClassLoader contextClassLoader = currentThread.getContextClassLoader(); + + if (contextClassLoader != _classLoader) { + currentThread.setContextClassLoader(_classLoader); + } + + try { + return _clpInvoker.invokeMethod(name, parameterTypes, arguments); + } + finally { + if (contextClassLoader != _classLoader) { + currentThread.setContextClassLoader(contextClassLoader); + } + } + } + + protected Class getModelClass() { + return Configurazione.class; + } + + protected String getModelClassName() { + return Configurazione.class.getName(); + } + + /** + * Performs an SQL query. + * + * @param sql the sql query + */ + protected void runSQL(String sql) throws SystemException { + try { + DataSource dataSource = configurazionePersistence.getDataSource(); + + SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource, + sql, new int[0]); + + sqlUpdate.update(); + } + catch (Exception e) { + throw new SystemException(e); + } + } + + @BeanReference(type = it.mwg.sicilia.login.service.ConfigurazioneLocalService.class) + protected it.mwg.sicilia.login.service.ConfigurazioneLocalService configurazioneLocalService; + @BeanReference(type = ConfigurazionePersistence.class) + protected ConfigurazionePersistence configurazionePersistence; + @BeanReference(type = com.liferay.counter.service.CounterLocalService.class) + protected com.liferay.counter.service.CounterLocalService counterLocalService; + @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class) + protected com.liferay.portal.service.ResourceLocalService resourceLocalService; + @BeanReference(type = com.liferay.portal.service.UserLocalService.class) + protected com.liferay.portal.service.UserLocalService userLocalService; + @BeanReference(type = com.liferay.portal.service.UserService.class) + protected com.liferay.portal.service.UserService userService; + @BeanReference(type = UserPersistence.class) + protected UserPersistence userPersistence; + private String _beanIdentifier; + private ClassLoader _classLoader; + private ConfigurazioneLocalServiceClpInvoker _clpInvoker = new ConfigurazioneLocalServiceClpInvoker(); +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/base/ConfigurazioneLocalServiceClpInvoker.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/base/ConfigurazioneLocalServiceClpInvoker.java new file mode 100644 index 0000000..ec23772 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/base/ConfigurazioneLocalServiceClpInvoker.java @@ -0,0 +1,383 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service.base; + +import it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil; + +import java.util.Arrays; + +/** + * @author Manifattura Web Group s.r.l. + * @generated + */ +public class ConfigurazioneLocalServiceClpInvoker { + public ConfigurazioneLocalServiceClpInvoker() { + _methodName0 = "addConfigurazione"; + + _methodParameterTypes0 = new String[] { + "it.mwg.sicilia.login.model.Configurazione" + }; + + _methodName1 = "createConfigurazione"; + + _methodParameterTypes1 = new String[] { "long" }; + + _methodName2 = "deleteConfigurazione"; + + _methodParameterTypes2 = new String[] { "long" }; + + _methodName3 = "deleteConfigurazione"; + + _methodParameterTypes3 = new String[] { + "it.mwg.sicilia.login.model.Configurazione" + }; + + _methodName4 = "dynamicQuery"; + + _methodParameterTypes4 = new String[] { }; + + _methodName5 = "dynamicQuery"; + + _methodParameterTypes5 = new String[] { + "com.liferay.portal.kernel.dao.orm.DynamicQuery" + }; + + _methodName6 = "dynamicQuery"; + + _methodParameterTypes6 = new String[] { + "com.liferay.portal.kernel.dao.orm.DynamicQuery", "int", "int" + }; + + _methodName7 = "dynamicQuery"; + + _methodParameterTypes7 = new String[] { + "com.liferay.portal.kernel.dao.orm.DynamicQuery", "int", "int", + "com.liferay.portal.kernel.util.OrderByComparator" + }; + + _methodName8 = "dynamicQueryCount"; + + _methodParameterTypes8 = new String[] { + "com.liferay.portal.kernel.dao.orm.DynamicQuery" + }; + + _methodName9 = "dynamicQueryCount"; + + _methodParameterTypes9 = new String[] { + "com.liferay.portal.kernel.dao.orm.DynamicQuery", + "com.liferay.portal.kernel.dao.orm.Projection" + }; + + _methodName10 = "fetchConfigurazione"; + + _methodParameterTypes10 = new String[] { "long" }; + + _methodName11 = "getConfigurazione"; + + _methodParameterTypes11 = new String[] { "long" }; + + _methodName12 = "getPersistedModel"; + + _methodParameterTypes12 = new String[] { "java.io.Serializable" }; + + _methodName13 = "getConfiguraziones"; + + _methodParameterTypes13 = new String[] { "int", "int" }; + + _methodName14 = "getConfigurazionesCount"; + + _methodParameterTypes14 = new String[] { }; + + _methodName15 = "updateConfigurazione"; + + _methodParameterTypes15 = new String[] { + "it.mwg.sicilia.login.model.Configurazione" + }; + + _methodName32 = "getBeanIdentifier"; + + _methodParameterTypes32 = new String[] { }; + + _methodName33 = "setBeanIdentifier"; + + _methodParameterTypes33 = new String[] { "java.lang.String" }; + + _methodName38 = "findByCompanyId_Nome"; + + _methodParameterTypes38 = new String[] { "long", "java.lang.String" }; + + _methodName40 = "getApiServer"; + + _methodParameterTypes40 = new String[] { "long" }; + + _methodName41 = "getApiServerKey"; + + _methodParameterTypes41 = new String[] { }; + + _methodName42 = "getApiUsername"; + + _methodParameterTypes42 = new String[] { "long" }; + + _methodName43 = "getApiUsernameKey"; + + _methodParameterTypes43 = new String[] { }; + + _methodName44 = "getApiPassword"; + + _methodParameterTypes44 = new String[] { "long" }; + + _methodName45 = "getApiPasswordKey"; + + _methodParameterTypes45 = new String[] { }; + + _methodName46 = "salvaImpostazioni"; + + _methodParameterTypes46 = new String[] { + "javax.portlet.ActionRequest", "javax.portlet.ActionResponse" + }; + + _methodName47 = "set"; + + _methodParameterTypes47 = new String[] { + "long", "com.liferay.portal.model.User", "java.lang.String", + "java.lang.String" + }; + + _methodName48 = "setDefaults"; + + _methodParameterTypes48 = new String[] { "long" }; + } + + public Object invokeMethod(String name, String[] parameterTypes, + Object[] arguments) throws Throwable { + if (_methodName0.equals(name) && + Arrays.deepEquals(_methodParameterTypes0, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.addConfigurazione((it.mwg.sicilia.login.model.Configurazione)arguments[0]); + } + + if (_methodName1.equals(name) && + Arrays.deepEquals(_methodParameterTypes1, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.createConfigurazione(((Long)arguments[0]).longValue()); + } + + if (_methodName2.equals(name) && + Arrays.deepEquals(_methodParameterTypes2, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.deleteConfigurazione(((Long)arguments[0]).longValue()); + } + + if (_methodName3.equals(name) && + Arrays.deepEquals(_methodParameterTypes3, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.deleteConfigurazione((it.mwg.sicilia.login.model.Configurazione)arguments[0]); + } + + if (_methodName4.equals(name) && + Arrays.deepEquals(_methodParameterTypes4, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.dynamicQuery(); + } + + if (_methodName5.equals(name) && + Arrays.deepEquals(_methodParameterTypes5, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.dynamicQuery((com.liferay.portal.kernel.dao.orm.DynamicQuery)arguments[0]); + } + + if (_methodName6.equals(name) && + Arrays.deepEquals(_methodParameterTypes6, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.dynamicQuery((com.liferay.portal.kernel.dao.orm.DynamicQuery)arguments[0], + ((Integer)arguments[1]).intValue(), + ((Integer)arguments[2]).intValue()); + } + + if (_methodName7.equals(name) && + Arrays.deepEquals(_methodParameterTypes7, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.dynamicQuery((com.liferay.portal.kernel.dao.orm.DynamicQuery)arguments[0], + ((Integer)arguments[1]).intValue(), + ((Integer)arguments[2]).intValue(), + (com.liferay.portal.kernel.util.OrderByComparator)arguments[3]); + } + + if (_methodName8.equals(name) && + Arrays.deepEquals(_methodParameterTypes8, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.dynamicQueryCount((com.liferay.portal.kernel.dao.orm.DynamicQuery)arguments[0]); + } + + if (_methodName9.equals(name) && + Arrays.deepEquals(_methodParameterTypes9, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.dynamicQueryCount((com.liferay.portal.kernel.dao.orm.DynamicQuery)arguments[0], + (com.liferay.portal.kernel.dao.orm.Projection)arguments[1]); + } + + if (_methodName10.equals(name) && + Arrays.deepEquals(_methodParameterTypes10, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.fetchConfigurazione(((Long)arguments[0]).longValue()); + } + + if (_methodName11.equals(name) && + Arrays.deepEquals(_methodParameterTypes11, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getConfigurazione(((Long)arguments[0]).longValue()); + } + + if (_methodName12.equals(name) && + Arrays.deepEquals(_methodParameterTypes12, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getPersistedModel((java.io.Serializable)arguments[0]); + } + + if (_methodName13.equals(name) && + Arrays.deepEquals(_methodParameterTypes13, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getConfiguraziones(((Integer)arguments[0]).intValue(), + ((Integer)arguments[1]).intValue()); + } + + if (_methodName14.equals(name) && + Arrays.deepEquals(_methodParameterTypes14, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getConfigurazionesCount(); + } + + if (_methodName15.equals(name) && + Arrays.deepEquals(_methodParameterTypes15, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.updateConfigurazione((it.mwg.sicilia.login.model.Configurazione)arguments[0]); + } + + if (_methodName32.equals(name) && + Arrays.deepEquals(_methodParameterTypes32, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getBeanIdentifier(); + } + + if (_methodName33.equals(name) && + Arrays.deepEquals(_methodParameterTypes33, parameterTypes)) { + ConfigurazioneLocalServiceUtil.setBeanIdentifier((java.lang.String)arguments[0]); + + return null; + } + + if (_methodName38.equals(name) && + Arrays.deepEquals(_methodParameterTypes38, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.findByCompanyId_Nome(((Long)arguments[0]).longValue(), + (java.lang.String)arguments[1]); + } + + if (_methodName40.equals(name) && + Arrays.deepEquals(_methodParameterTypes40, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getApiServer(((Long)arguments[0]).longValue()); + } + + if (_methodName41.equals(name) && + Arrays.deepEquals(_methodParameterTypes41, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getApiServerKey(); + } + + if (_methodName42.equals(name) && + Arrays.deepEquals(_methodParameterTypes42, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getApiUsername(((Long)arguments[0]).longValue()); + } + + if (_methodName43.equals(name) && + Arrays.deepEquals(_methodParameterTypes43, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getApiUsernameKey(); + } + + if (_methodName44.equals(name) && + Arrays.deepEquals(_methodParameterTypes44, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getApiPassword(((Long)arguments[0]).longValue()); + } + + if (_methodName45.equals(name) && + Arrays.deepEquals(_methodParameterTypes45, parameterTypes)) { + return ConfigurazioneLocalServiceUtil.getApiPasswordKey(); + } + + if (_methodName46.equals(name) && + Arrays.deepEquals(_methodParameterTypes46, parameterTypes)) { + ConfigurazioneLocalServiceUtil.salvaImpostazioni((javax.portlet.ActionRequest)arguments[0], + (javax.portlet.ActionResponse)arguments[1]); + + return null; + } + + if (_methodName47.equals(name) && + Arrays.deepEquals(_methodParameterTypes47, parameterTypes)) { + ConfigurazioneLocalServiceUtil.set(((Long)arguments[0]).longValue(), + (com.liferay.portal.model.User)arguments[1], + (java.lang.String)arguments[2], (java.lang.String)arguments[3]); + + return null; + } + + if (_methodName48.equals(name) && + Arrays.deepEquals(_methodParameterTypes48, parameterTypes)) { + ConfigurazioneLocalServiceUtil.setDefaults(((Long)arguments[0]).longValue()); + + return null; + } + + throw new UnsupportedOperationException(); + } + + private String _methodName0; + private String[] _methodParameterTypes0; + private String _methodName1; + private String[] _methodParameterTypes1; + private String _methodName2; + private String[] _methodParameterTypes2; + private String _methodName3; + private String[] _methodParameterTypes3; + private String _methodName4; + private String[] _methodParameterTypes4; + private String _methodName5; + private String[] _methodParameterTypes5; + private String _methodName6; + private String[] _methodParameterTypes6; + private String _methodName7; + private String[] _methodParameterTypes7; + private String _methodName8; + private String[] _methodParameterTypes8; + private String _methodName9; + private String[] _methodParameterTypes9; + private String _methodName10; + private String[] _methodParameterTypes10; + private String _methodName11; + private String[] _methodParameterTypes11; + private String _methodName12; + private String[] _methodParameterTypes12; + private String _methodName13; + private String[] _methodParameterTypes13; + private String _methodName14; + private String[] _methodParameterTypes14; + private String _methodName15; + private String[] _methodParameterTypes15; + private String _methodName32; + private String[] _methodParameterTypes32; + private String _methodName33; + private String[] _methodParameterTypes33; + private String _methodName38; + private String[] _methodParameterTypes38; + private String _methodName40; + private String[] _methodParameterTypes40; + private String _methodName41; + private String[] _methodParameterTypes41; + private String _methodName42; + private String[] _methodParameterTypes42; + private String _methodName43; + private String[] _methodParameterTypes43; + private String _methodName44; + private String[] _methodParameterTypes44; + private String _methodName45; + private String[] _methodParameterTypes45; + private String _methodName46; + private String[] _methodParameterTypes46; + private String _methodName47; + private String[] _methodParameterTypes47; + private String _methodName48; + private String[] _methodParameterTypes48; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/impl/ConfigurazioneLocalServiceImpl.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/impl/ConfigurazioneLocalServiceImpl.java new file mode 100644 index 0000000..c5af7c4 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/impl/ConfigurazioneLocalServiceImpl.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + */ + +package it.mwg.sicilia.login.service.impl; + +import it.mwg.sicilia.login.NoSuchConfigurazioneException; +import it.mwg.sicilia.login.model.Configurazione; +import it.mwg.sicilia.login.service.base.ConfigurazioneLocalServiceBaseImpl; + +import java.util.Date; + +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; + +import org.apache.commons.codec.digest.DigestUtils; + +import com.liferay.counter.service.CounterLocalServiceUtil; +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.servlet.SessionErrors; +import com.liferay.portal.kernel.util.ParamUtil; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.model.User; +import com.liferay.portal.service.ServiceContext; +import com.liferay.portal.service.ServiceContextFactory; +import com.liferay.portal.service.UserLocalServiceUtil; + +/** + * The implementation of the configurazione local service. + *

+ * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy + * their definitions into the {@link it.mwg.sicilia.login.service.ConfigurazioneLocalService} interface. + *

+ * This is a local service. Methods of this service will not have security checks based on the propagated JAAS + * credentials because this service can only be accessed from within the same VM. + *

+ * + * @author Manifattura Web Group s.r.l. + * @see it.mwg.sicilia.login.service.base.ConfigurazioneLocalServiceBaseImpl + * @see it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil + */ +public class ConfigurazioneLocalServiceImpl extends ConfigurazioneLocalServiceBaseImpl { + /* + * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link + * it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil} to access the configurazione local service. + */ + + private static final String API_SERVER = "loginServer"; + private static final String API_USERNAME = "username"; + private static final String API_PASSWORD = "password"; + + private static final String DEFAULT_API_SERVER = "https://autenticazione.lavoripubblici.sicilia.it/"; + + @Override + public Configurazione findByCompanyId_Nome(long companyId, String nome) throws NoSuchConfigurazioneException, + SystemException { + + return configurazionePersistence.findByCompanyId_Nome(companyId, nome); + } + + private String get(long companyId, String nome) { + + Configurazione configurazione; + try { + configurazione = configurazionePersistence.findByCompanyId_Nome(companyId, nome); + } catch (NoSuchConfigurazioneException | SystemException e) { + return null; + } + return configurazione.getValore(); + } + + @Override + public String getApiServer(long companyId) { + + return get(companyId, API_SERVER); + } + + @Override + public String getApiServerKey() { + + return API_SERVER; + } + + @Override + public String getApiUsername(long companyId) { + + return get(companyId, API_USERNAME); + } + + @Override + public String getApiUsernameKey() { + + return API_USERNAME; + } + + @Override + public String getApiPassword(long companyId) { + + return get(companyId, API_PASSWORD); + } + + @Override + public String getApiPasswordKey() { + + return API_PASSWORD; + } + + @Override + public void salvaImpostazioni(ActionRequest request, ActionResponse response) throws PortalException, + SystemException { + + // 4Tr-D%fO!sli5 + ServiceContext serviceContext = ServiceContextFactory.getInstance(request); + long companyId = serviceContext.getCompanyId(); + String username = ParamUtil.getString(request, API_USERNAME); + String oldUsername = getApiUsername(companyId); + String password = ParamUtil.getString(request, API_PASSWORD); + if (username.equals(oldUsername) || Validator.isNotNull(password)) { + User user = UserLocalServiceUtil.getUser(serviceContext.getUserId()); + set(companyId, user, API_SERVER, ParamUtil.getString(request, API_SERVER)); + set(companyId, user, API_USERNAME, username); + if (Validator.isNotNull(password)) { + set(companyId, user, API_PASSWORD, DigestUtils.sha256Hex(username + password)); + } + } else { + SessionErrors.add(request, "username-without-password"); + } + } + + @Override + public void set(long companyId, User user, String nome, String valore) throws SystemException { + + Date date = new Date(); + Configurazione configurazione; + try { + configurazione = configurazionePersistence.findByCompanyId_Nome(companyId, nome); + } catch (NoSuchConfigurazioneException e) { + configurazione = configurazionePersistence.create(CounterLocalServiceUtil.increment(Configurazione.class + .getName())); + configurazione.setNome(nome); + configurazione.setCompanyId(companyId); + configurazione.setCreateDate(date); + } + if (!configurazione.getValore().equals(valore)) { + configurazione.setValore(valore); + configurazione.setModifiedDate(date); + if (Validator.isNull(user)) { + configurazione.setUserId(0); + configurazione.setUserName(StringPool.BLANK); + } else { + configurazione.setUserId(user.getUserId()); + configurazione.setUserName(user.getFullName()); + } + configurazione.persist(); + } + } + + @Override + public void setDefaults(long companyId) throws SystemException { + + try { + configurazionePersistence.findByCompanyId_Nome(companyId, API_SERVER); + } catch (NoSuchConfigurazioneException e) { + set(companyId, null, API_SERVER, DEFAULT_API_SERVER); + } + } +} diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/persistence/ConfigurazionePersistenceImpl.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/persistence/ConfigurazionePersistenceImpl.java new file mode 100644 index 0000000..537ee3b --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/service/persistence/ConfigurazionePersistenceImpl.java @@ -0,0 +1,1520 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package it.mwg.sicilia.login.service.persistence; + +import com.liferay.portal.kernel.cache.CacheRegistryUtil; +import com.liferay.portal.kernel.dao.orm.EntityCacheUtil; +import com.liferay.portal.kernel.dao.orm.FinderCacheUtil; +import com.liferay.portal.kernel.dao.orm.FinderPath; +import com.liferay.portal.kernel.dao.orm.Query; +import com.liferay.portal.kernel.dao.orm.QueryPos; +import com.liferay.portal.kernel.dao.orm.QueryUtil; +import com.liferay.portal.kernel.dao.orm.Session; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.GetterUtil; +import com.liferay.portal.kernel.util.InstanceFactory; +import com.liferay.portal.kernel.util.OrderByComparator; +import com.liferay.portal.kernel.util.PropsKeys; +import com.liferay.portal.kernel.util.PropsUtil; +import com.liferay.portal.kernel.util.StringBundler; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.StringUtil; +import com.liferay.portal.kernel.util.UnmodifiableList; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.model.CacheModel; +import com.liferay.portal.model.ModelListener; +import com.liferay.portal.service.persistence.impl.BasePersistenceImpl; + +import it.mwg.sicilia.login.NoSuchConfigurazioneException; +import it.mwg.sicilia.login.model.Configurazione; +import it.mwg.sicilia.login.model.impl.ConfigurazioneImpl; +import it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl; +import it.mwg.sicilia.login.service.persistence.ConfigurazionePersistence; + +import java.io.Serializable; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * The persistence implementation for the configurazione service. + * + *

+ * Caching information and settings can be found in portal.properties + *

+ * + * @author Manifattura Web Group s.r.l. + * @see ConfigurazionePersistence + * @see ConfigurazioneUtil + * @generated + */ +public class ConfigurazionePersistenceImpl extends BasePersistenceImpl + implements ConfigurazionePersistence { + /* + * NOTE FOR DEVELOPERS: + * + * Never modify or reference this class directly. Always use {@link ConfigurazioneUtil} to access the configurazione persistence. Modify service.xml and rerun ServiceBuilder to regenerate this class. + */ + public static final String FINDER_CLASS_NAME_ENTITY = ConfigurazioneImpl.class.getName(); + public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY + + ".List1"; + public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY + + ".List2"; + public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneModelImpl.FINDER_CACHE_ENABLED, + ConfigurazioneImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, + "findAll", new String[0]); + public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneModelImpl.FINDER_CACHE_ENABLED, + ConfigurazioneImpl.class, + FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]); + public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneModelImpl.FINDER_CACHE_ENABLED, Long.class, + FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]); + public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID = + new FinderPath(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneModelImpl.FINDER_CACHE_ENABLED, + ConfigurazioneImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, + "findByCompanyId", + new String[] { + Long.class.getName(), + + Integer.class.getName(), Integer.class.getName(), + OrderByComparator.class.getName() + }); + public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID = + new FinderPath(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneModelImpl.FINDER_CACHE_ENABLED, + ConfigurazioneImpl.class, + FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId", + new String[] { Long.class.getName() }, + ConfigurazioneModelImpl.COMPANYID_COLUMN_BITMASK); + public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneModelImpl.FINDER_CACHE_ENABLED, Long.class, + FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId", + new String[] { Long.class.getName() }); + + /** + * Returns all the configuraziones where companyId = ?. + * + * @param companyId the company ID + * @return the matching configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public List findByCompanyId(long companyId) + throws SystemException { + return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, + null); + } + + /** + * Returns a range of all the configuraziones where companyId = ?. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param companyId the company ID + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @return the range of matching configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public List findByCompanyId(long companyId, int start, + int end) throws SystemException { + return findByCompanyId(companyId, start, end, null); + } + + /** + * Returns an ordered range of all the configuraziones where companyId = ?. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param companyId the company ID + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @param orderByComparator the comparator to order the results by (optionally null) + * @return the ordered range of matching configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public List findByCompanyId(long companyId, int start, + int end, OrderByComparator orderByComparator) throws SystemException { + boolean pagination = true; + FinderPath finderPath = null; + Object[] finderArgs = null; + + if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && + (orderByComparator == null)) { + pagination = false; + finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID; + finderArgs = new Object[] { companyId }; + } + else { + finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID; + finderArgs = new Object[] { companyId, start, end, orderByComparator }; + } + + List list = (List)FinderCacheUtil.getResult(finderPath, + finderArgs, this); + + if ((list != null) && !list.isEmpty()) { + for (Configurazione configurazione : list) { + if ((companyId != configurazione.getCompanyId())) { + list = null; + + break; + } + } + } + + if (list == null) { + StringBundler query = null; + + if (orderByComparator != null) { + query = new StringBundler(3 + + (orderByComparator.getOrderByFields().length * 3)); + } + else { + query = new StringBundler(3); + } + + query.append(_SQL_SELECT_CONFIGURAZIONE_WHERE); + + query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2); + + if (orderByComparator != null) { + appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, + orderByComparator); + } + else + if (pagination) { + query.append(ConfigurazioneModelImpl.ORDER_BY_JPQL); + } + + String sql = query.toString(); + + Session session = null; + + try { + session = openSession(); + + Query q = session.createQuery(sql); + + QueryPos qPos = QueryPos.getInstance(q); + + qPos.add(companyId); + + if (!pagination) { + list = (List)QueryUtil.list(q, + getDialect(), start, end, false); + + Collections.sort(list); + + list = new UnmodifiableList(list); + } + else { + list = (List)QueryUtil.list(q, + getDialect(), start, end); + } + + cacheResult(list); + + FinderCacheUtil.putResult(finderPath, finderArgs, list); + } + catch (Exception e) { + FinderCacheUtil.removeResult(finderPath, finderArgs); + + throw processException(e); + } + finally { + closeSession(session); + } + } + + return list; + } + + /** + * Returns the first configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the first matching configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione findByCompanyId_First(long companyId, + OrderByComparator orderByComparator) + throws NoSuchConfigurazioneException, SystemException { + Configurazione configurazione = fetchByCompanyId_First(companyId, + orderByComparator); + + if (configurazione != null) { + return configurazione; + } + + StringBundler msg = new StringBundler(4); + + msg.append(_NO_SUCH_ENTITY_WITH_KEY); + + msg.append("companyId="); + msg.append(companyId); + + msg.append(StringPool.CLOSE_CURLY_BRACE); + + throw new NoSuchConfigurazioneException(msg.toString()); + } + + /** + * Returns the first configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the first matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione fetchByCompanyId_First(long companyId, + OrderByComparator orderByComparator) throws SystemException { + List list = findByCompanyId(companyId, 0, 1, + orderByComparator); + + if (!list.isEmpty()) { + return list.get(0); + } + + return null; + } + + /** + * Returns the last configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the last matching configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione findByCompanyId_Last(long companyId, + OrderByComparator orderByComparator) + throws NoSuchConfigurazioneException, SystemException { + Configurazione configurazione = fetchByCompanyId_Last(companyId, + orderByComparator); + + if (configurazione != null) { + return configurazione; + } + + StringBundler msg = new StringBundler(4); + + msg.append(_NO_SUCH_ENTITY_WITH_KEY); + + msg.append("companyId="); + msg.append(companyId); + + msg.append(StringPool.CLOSE_CURLY_BRACE); + + throw new NoSuchConfigurazioneException(msg.toString()); + } + + /** + * Returns the last configurazione in the ordered set where companyId = ?. + * + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the last matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione fetchByCompanyId_Last(long companyId, + OrderByComparator orderByComparator) throws SystemException { + int count = countByCompanyId(companyId); + + if (count == 0) { + return null; + } + + List list = findByCompanyId(companyId, count - 1, + count, orderByComparator); + + if (!list.isEmpty()) { + return list.get(0); + } + + return null; + } + + /** + * Returns the configuraziones before and after the current configurazione in the ordered set where companyId = ?. + * + * @param configurazioneId the primary key of the current configurazione + * @param companyId the company ID + * @param orderByComparator the comparator to order the set by (optionally null) + * @return the previous, current, and next configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione[] findByCompanyId_PrevAndNext(long configurazioneId, + long companyId, OrderByComparator orderByComparator) + throws NoSuchConfigurazioneException, SystemException { + Configurazione configurazione = findByPrimaryKey(configurazioneId); + + Session session = null; + + try { + session = openSession(); + + Configurazione[] array = new ConfigurazioneImpl[3]; + + array[0] = getByCompanyId_PrevAndNext(session, configurazione, + companyId, orderByComparator, true); + + array[1] = configurazione; + + array[2] = getByCompanyId_PrevAndNext(session, configurazione, + companyId, orderByComparator, false); + + return array; + } + catch (Exception e) { + throw processException(e); + } + finally { + closeSession(session); + } + } + + protected Configurazione getByCompanyId_PrevAndNext(Session session, + Configurazione configurazione, long companyId, + OrderByComparator orderByComparator, boolean previous) { + StringBundler query = null; + + if (orderByComparator != null) { + query = new StringBundler(6 + + (orderByComparator.getOrderByFields().length * 6)); + } + else { + query = new StringBundler(3); + } + + query.append(_SQL_SELECT_CONFIGURAZIONE_WHERE); + + query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2); + + if (orderByComparator != null) { + String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); + + if (orderByConditionFields.length > 0) { + query.append(WHERE_AND); + } + + for (int i = 0; i < orderByConditionFields.length; i++) { + query.append(_ORDER_BY_ENTITY_ALIAS); + query.append(orderByConditionFields[i]); + + if ((i + 1) < orderByConditionFields.length) { + if (orderByComparator.isAscending() ^ previous) { + query.append(WHERE_GREATER_THAN_HAS_NEXT); + } + else { + query.append(WHERE_LESSER_THAN_HAS_NEXT); + } + } + else { + if (orderByComparator.isAscending() ^ previous) { + query.append(WHERE_GREATER_THAN); + } + else { + query.append(WHERE_LESSER_THAN); + } + } + } + + query.append(ORDER_BY_CLAUSE); + + String[] orderByFields = orderByComparator.getOrderByFields(); + + for (int i = 0; i < orderByFields.length; i++) { + query.append(_ORDER_BY_ENTITY_ALIAS); + query.append(orderByFields[i]); + + if ((i + 1) < orderByFields.length) { + if (orderByComparator.isAscending() ^ previous) { + query.append(ORDER_BY_ASC_HAS_NEXT); + } + else { + query.append(ORDER_BY_DESC_HAS_NEXT); + } + } + else { + if (orderByComparator.isAscending() ^ previous) { + query.append(ORDER_BY_ASC); + } + else { + query.append(ORDER_BY_DESC); + } + } + } + } + else { + query.append(ConfigurazioneModelImpl.ORDER_BY_JPQL); + } + + String sql = query.toString(); + + Query q = session.createQuery(sql); + + q.setFirstResult(0); + q.setMaxResults(2); + + QueryPos qPos = QueryPos.getInstance(q); + + qPos.add(companyId); + + if (orderByComparator != null) { + Object[] values = orderByComparator.getOrderByConditionValues(configurazione); + + for (Object value : values) { + qPos.add(value); + } + } + + List list = q.list(); + + if (list.size() == 2) { + return list.get(1); + } + else { + return null; + } + } + + /** + * Removes all the configuraziones where companyId = ? from the database. + * + * @param companyId the company ID + * @throws SystemException if a system exception occurred + */ + @Override + public void removeByCompanyId(long companyId) throws SystemException { + for (Configurazione configurazione : findByCompanyId(companyId, + QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { + remove(configurazione); + } + } + + /** + * Returns the number of configuraziones where companyId = ?. + * + * @param companyId the company ID + * @return the number of matching configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public int countByCompanyId(long companyId) throws SystemException { + FinderPath finderPath = FINDER_PATH_COUNT_BY_COMPANYID; + + Object[] finderArgs = new Object[] { companyId }; + + Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs, + this); + + if (count == null) { + StringBundler query = new StringBundler(2); + + query.append(_SQL_COUNT_CONFIGURAZIONE_WHERE); + + query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2); + + String sql = query.toString(); + + Session session = null; + + try { + session = openSession(); + + Query q = session.createQuery(sql); + + QueryPos qPos = QueryPos.getInstance(q); + + qPos.add(companyId); + + count = (Long)q.uniqueResult(); + + FinderCacheUtil.putResult(finderPath, finderArgs, count); + } + catch (Exception e) { + FinderCacheUtil.removeResult(finderPath, finderArgs); + + throw processException(e); + } + finally { + closeSession(session); + } + } + + return count.intValue(); + } + + private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "configurazione.companyId = ?"; + public static final FinderPath FINDER_PATH_FETCH_BY_COMPANYID_NOME = new FinderPath(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneModelImpl.FINDER_CACHE_ENABLED, + ConfigurazioneImpl.class, FINDER_CLASS_NAME_ENTITY, + "fetchByCompanyId_Nome", + new String[] { Long.class.getName(), String.class.getName() }, + ConfigurazioneModelImpl.COMPANYID_COLUMN_BITMASK | + ConfigurazioneModelImpl.NOME_COLUMN_BITMASK); + public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID_NOME = new FinderPath(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneModelImpl.FINDER_CACHE_ENABLED, Long.class, + FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId_Nome", + new String[] { Long.class.getName(), String.class.getName() }); + + /** + * Returns the configurazione where companyId = ? and nome = ? or throws a {@link it.mwg.sicilia.login.NoSuchConfigurazioneException} if it could not be found. + * + * @param companyId the company ID + * @param nome the nome + * @return the matching configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione findByCompanyId_Nome(long companyId, String nome) + throws NoSuchConfigurazioneException, SystemException { + Configurazione configurazione = fetchByCompanyId_Nome(companyId, nome); + + if (configurazione == null) { + StringBundler msg = new StringBundler(6); + + msg.append(_NO_SUCH_ENTITY_WITH_KEY); + + msg.append("companyId="); + msg.append(companyId); + + msg.append(", nome="); + msg.append(nome); + + msg.append(StringPool.CLOSE_CURLY_BRACE); + + if (_log.isWarnEnabled()) { + _log.warn(msg.toString()); + } + + throw new NoSuchConfigurazioneException(msg.toString()); + } + + return configurazione; + } + + /** + * Returns the configurazione where companyId = ? and nome = ? or returns null if it could not be found. Uses the finder cache. + * + * @param companyId the company ID + * @param nome the nome + * @return the matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione fetchByCompanyId_Nome(long companyId, String nome) + throws SystemException { + return fetchByCompanyId_Nome(companyId, nome, true); + } + + /** + * Returns the configurazione where companyId = ? and nome = ? or returns null if it could not be found, optionally using the finder cache. + * + * @param companyId the company ID + * @param nome the nome + * @param retrieveFromCache whether to use the finder cache + * @return the matching configurazione, or null if a matching configurazione could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione fetchByCompanyId_Nome(long companyId, String nome, + boolean retrieveFromCache) throws SystemException { + Object[] finderArgs = new Object[] { companyId, nome }; + + Object result = null; + + if (retrieveFromCache) { + result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_COMPANYID_NOME, + finderArgs, this); + } + + if (result instanceof Configurazione) { + Configurazione configurazione = (Configurazione)result; + + if ((companyId != configurazione.getCompanyId()) || + !Validator.equals(nome, configurazione.getNome())) { + result = null; + } + } + + if (result == null) { + StringBundler query = new StringBundler(4); + + query.append(_SQL_SELECT_CONFIGURAZIONE_WHERE); + + query.append(_FINDER_COLUMN_COMPANYID_NOME_COMPANYID_2); + + boolean bindNome = false; + + if (nome == null) { + query.append(_FINDER_COLUMN_COMPANYID_NOME_NOME_1); + } + else if (nome.equals(StringPool.BLANK)) { + query.append(_FINDER_COLUMN_COMPANYID_NOME_NOME_3); + } + else { + bindNome = true; + + query.append(_FINDER_COLUMN_COMPANYID_NOME_NOME_2); + } + + String sql = query.toString(); + + Session session = null; + + try { + session = openSession(); + + Query q = session.createQuery(sql); + + QueryPos qPos = QueryPos.getInstance(q); + + qPos.add(companyId); + + if (bindNome) { + qPos.add(nome); + } + + List list = q.list(); + + if (list.isEmpty()) { + FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_COMPANYID_NOME, + finderArgs, list); + } + else { + Configurazione configurazione = list.get(0); + + result = configurazione; + + cacheResult(configurazione); + + if ((configurazione.getCompanyId() != companyId) || + (configurazione.getNome() == null) || + !configurazione.getNome().equals(nome)) { + FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_COMPANYID_NOME, + finderArgs, configurazione); + } + } + } + catch (Exception e) { + FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_COMPANYID_NOME, + finderArgs); + + throw processException(e); + } + finally { + closeSession(session); + } + } + + if (result instanceof List) { + return null; + } + else { + return (Configurazione)result; + } + } + + /** + * Removes the configurazione where companyId = ? and nome = ? from the database. + * + * @param companyId the company ID + * @param nome the nome + * @return the configurazione that was removed + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione removeByCompanyId_Nome(long companyId, String nome) + throws NoSuchConfigurazioneException, SystemException { + Configurazione configurazione = findByCompanyId_Nome(companyId, nome); + + return remove(configurazione); + } + + /** + * Returns the number of configuraziones where companyId = ? and nome = ?. + * + * @param companyId the company ID + * @param nome the nome + * @return the number of matching configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public int countByCompanyId_Nome(long companyId, String nome) + throws SystemException { + FinderPath finderPath = FINDER_PATH_COUNT_BY_COMPANYID_NOME; + + Object[] finderArgs = new Object[] { companyId, nome }; + + Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs, + this); + + if (count == null) { + StringBundler query = new StringBundler(3); + + query.append(_SQL_COUNT_CONFIGURAZIONE_WHERE); + + query.append(_FINDER_COLUMN_COMPANYID_NOME_COMPANYID_2); + + boolean bindNome = false; + + if (nome == null) { + query.append(_FINDER_COLUMN_COMPANYID_NOME_NOME_1); + } + else if (nome.equals(StringPool.BLANK)) { + query.append(_FINDER_COLUMN_COMPANYID_NOME_NOME_3); + } + else { + bindNome = true; + + query.append(_FINDER_COLUMN_COMPANYID_NOME_NOME_2); + } + + String sql = query.toString(); + + Session session = null; + + try { + session = openSession(); + + Query q = session.createQuery(sql); + + QueryPos qPos = QueryPos.getInstance(q); + + qPos.add(companyId); + + if (bindNome) { + qPos.add(nome); + } + + count = (Long)q.uniqueResult(); + + FinderCacheUtil.putResult(finderPath, finderArgs, count); + } + catch (Exception e) { + FinderCacheUtil.removeResult(finderPath, finderArgs); + + throw processException(e); + } + finally { + closeSession(session); + } + } + + return count.intValue(); + } + + private static final String _FINDER_COLUMN_COMPANYID_NOME_COMPANYID_2 = "configurazione.companyId = ? AND "; + private static final String _FINDER_COLUMN_COMPANYID_NOME_NOME_1 = "configurazione.nome IS NULL"; + private static final String _FINDER_COLUMN_COMPANYID_NOME_NOME_2 = "configurazione.nome = ?"; + private static final String _FINDER_COLUMN_COMPANYID_NOME_NOME_3 = "(configurazione.nome IS NULL OR configurazione.nome = '')"; + + public ConfigurazionePersistenceImpl() { + setModelClass(Configurazione.class); + } + + /** + * Caches the configurazione in the entity cache if it is enabled. + * + * @param configurazione the configurazione + */ + @Override + public void cacheResult(Configurazione configurazione) { + EntityCacheUtil.putResult(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneImpl.class, configurazione.getPrimaryKey(), + configurazione); + + FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_COMPANYID_NOME, + new Object[] { configurazione.getCompanyId(), configurazione.getNome() }, + configurazione); + + configurazione.resetOriginalValues(); + } + + /** + * Caches the configuraziones in the entity cache if it is enabled. + * + * @param configuraziones the configuraziones + */ + @Override + public void cacheResult(List configuraziones) { + for (Configurazione configurazione : configuraziones) { + if (EntityCacheUtil.getResult( + ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneImpl.class, configurazione.getPrimaryKey()) == null) { + cacheResult(configurazione); + } + else { + configurazione.resetOriginalValues(); + } + } + } + + /** + * Clears the cache for all configuraziones. + * + *

+ * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method. + *

+ */ + @Override + public void clearCache() { + if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) { + CacheRegistryUtil.clear(ConfigurazioneImpl.class.getName()); + } + + EntityCacheUtil.clearCache(ConfigurazioneImpl.class.getName()); + + FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY); + FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); + FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); + } + + /** + * Clears the cache for the configurazione. + * + *

+ * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method. + *

+ */ + @Override + public void clearCache(Configurazione configurazione) { + EntityCacheUtil.removeResult(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneImpl.class, configurazione.getPrimaryKey()); + + FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); + FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); + + clearUniqueFindersCache(configurazione); + } + + @Override + public void clearCache(List configuraziones) { + FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); + FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); + + for (Configurazione configurazione : configuraziones) { + EntityCacheUtil.removeResult(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneImpl.class, configurazione.getPrimaryKey()); + + clearUniqueFindersCache(configurazione); + } + } + + protected void cacheUniqueFindersCache(Configurazione configurazione) { + if (configurazione.isNew()) { + Object[] args = new Object[] { + configurazione.getCompanyId(), configurazione.getNome() + }; + + FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID_NOME, + args, Long.valueOf(1)); + FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_COMPANYID_NOME, + args, configurazione); + } + else { + ConfigurazioneModelImpl configurazioneModelImpl = (ConfigurazioneModelImpl)configurazione; + + if ((configurazioneModelImpl.getColumnBitmask() & + FINDER_PATH_FETCH_BY_COMPANYID_NOME.getColumnBitmask()) != 0) { + Object[] args = new Object[] { + configurazione.getCompanyId(), configurazione.getNome() + }; + + FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID_NOME, + args, Long.valueOf(1)); + FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_COMPANYID_NOME, + args, configurazione); + } + } + } + + protected void clearUniqueFindersCache(Configurazione configurazione) { + ConfigurazioneModelImpl configurazioneModelImpl = (ConfigurazioneModelImpl)configurazione; + + Object[] args = new Object[] { + configurazione.getCompanyId(), configurazione.getNome() + }; + + FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID_NOME, args); + FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_COMPANYID_NOME, args); + + if ((configurazioneModelImpl.getColumnBitmask() & + FINDER_PATH_FETCH_BY_COMPANYID_NOME.getColumnBitmask()) != 0) { + args = new Object[] { + configurazioneModelImpl.getOriginalCompanyId(), + configurazioneModelImpl.getOriginalNome() + }; + + FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID_NOME, + args); + FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_COMPANYID_NOME, + args); + } + } + + /** + * Creates a new configurazione with the primary key. Does not add the configurazione to the database. + * + * @param configurazioneId the primary key for the new configurazione + * @return the new configurazione + */ + @Override + public Configurazione create(long configurazioneId) { + Configurazione configurazione = new ConfigurazioneImpl(); + + configurazione.setNew(true); + configurazione.setPrimaryKey(configurazioneId); + + return configurazione; + } + + /** + * Removes the configurazione with the primary key from the database. Also notifies the appropriate model listeners. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione that was removed + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione remove(long configurazioneId) + throws NoSuchConfigurazioneException, SystemException { + return remove((Serializable)configurazioneId); + } + + /** + * Removes the configurazione with the primary key from the database. Also notifies the appropriate model listeners. + * + * @param primaryKey the primary key of the configurazione + * @return the configurazione that was removed + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione remove(Serializable primaryKey) + throws NoSuchConfigurazioneException, SystemException { + Session session = null; + + try { + session = openSession(); + + Configurazione configurazione = (Configurazione)session.get(ConfigurazioneImpl.class, + primaryKey); + + if (configurazione == null) { + if (_log.isWarnEnabled()) { + _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); + } + + throw new NoSuchConfigurazioneException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + + primaryKey); + } + + return remove(configurazione); + } + catch (NoSuchConfigurazioneException nsee) { + throw nsee; + } + catch (Exception e) { + throw processException(e); + } + finally { + closeSession(session); + } + } + + @Override + protected Configurazione removeImpl(Configurazione configurazione) + throws SystemException { + configurazione = toUnwrappedModel(configurazione); + + Session session = null; + + try { + session = openSession(); + + if (!session.contains(configurazione)) { + configurazione = (Configurazione)session.get(ConfigurazioneImpl.class, + configurazione.getPrimaryKeyObj()); + } + + if (configurazione != null) { + session.delete(configurazione); + } + } + catch (Exception e) { + throw processException(e); + } + finally { + closeSession(session); + } + + if (configurazione != null) { + clearCache(configurazione); + } + + return configurazione; + } + + @Override + public Configurazione updateImpl( + it.mwg.sicilia.login.model.Configurazione configurazione) + throws SystemException { + configurazione = toUnwrappedModel(configurazione); + + boolean isNew = configurazione.isNew(); + + ConfigurazioneModelImpl configurazioneModelImpl = (ConfigurazioneModelImpl)configurazione; + + Session session = null; + + try { + session = openSession(); + + if (configurazione.isNew()) { + session.save(configurazione); + + configurazione.setNew(false); + } + else { + session.merge(configurazione); + } + } + catch (Exception e) { + throw processException(e); + } + finally { + closeSession(session); + } + + FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); + + if (isNew || !ConfigurazioneModelImpl.COLUMN_BITMASK_ENABLED) { + FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); + } + + else { + if ((configurazioneModelImpl.getColumnBitmask() & + FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) { + Object[] args = new Object[] { + configurazioneModelImpl.getOriginalCompanyId() + }; + + FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID, + args); + FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID, + args); + + args = new Object[] { configurazioneModelImpl.getCompanyId() }; + + FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID, + args); + FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID, + args); + } + } + + EntityCacheUtil.putResult(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneImpl.class, configurazione.getPrimaryKey(), + configurazione); + + clearUniqueFindersCache(configurazione); + cacheUniqueFindersCache(configurazione); + + return configurazione; + } + + protected Configurazione toUnwrappedModel(Configurazione configurazione) { + if (configurazione instanceof ConfigurazioneImpl) { + return configurazione; + } + + ConfigurazioneImpl configurazioneImpl = new ConfigurazioneImpl(); + + configurazioneImpl.setNew(configurazione.isNew()); + configurazioneImpl.setPrimaryKey(configurazione.getPrimaryKey()); + + configurazioneImpl.setConfigurazioneId(configurazione.getConfigurazioneId()); + configurazioneImpl.setNome(configurazione.getNome()); + configurazioneImpl.setValore(configurazione.getValore()); + configurazioneImpl.setCompanyId(configurazione.getCompanyId()); + configurazioneImpl.setUserId(configurazione.getUserId()); + configurazioneImpl.setUserName(configurazione.getUserName()); + configurazioneImpl.setCreateDate(configurazione.getCreateDate()); + configurazioneImpl.setModifiedDate(configurazione.getModifiedDate()); + + return configurazioneImpl; + } + + /** + * Returns the configurazione with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found. + * + * @param primaryKey the primary key of the configurazione + * @return the configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione findByPrimaryKey(Serializable primaryKey) + throws NoSuchConfigurazioneException, SystemException { + Configurazione configurazione = fetchByPrimaryKey(primaryKey); + + if (configurazione == null) { + if (_log.isWarnEnabled()) { + _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); + } + + throw new NoSuchConfigurazioneException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + + primaryKey); + } + + return configurazione; + } + + /** + * Returns the configurazione with the primary key or throws a {@link it.mwg.sicilia.login.NoSuchConfigurazioneException} if it could not be found. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione + * @throws it.mwg.sicilia.login.NoSuchConfigurazioneException if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione findByPrimaryKey(long configurazioneId) + throws NoSuchConfigurazioneException, SystemException { + return findByPrimaryKey((Serializable)configurazioneId); + } + + /** + * Returns the configurazione with the primary key or returns null if it could not be found. + * + * @param primaryKey the primary key of the configurazione + * @return the configurazione, or null if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione fetchByPrimaryKey(Serializable primaryKey) + throws SystemException { + Configurazione configurazione = (Configurazione)EntityCacheUtil.getResult(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneImpl.class, primaryKey); + + if (configurazione == _nullConfigurazione) { + return null; + } + + if (configurazione == null) { + Session session = null; + + try { + session = openSession(); + + configurazione = (Configurazione)session.get(ConfigurazioneImpl.class, + primaryKey); + + if (configurazione != null) { + cacheResult(configurazione); + } + else { + EntityCacheUtil.putResult(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneImpl.class, primaryKey, + _nullConfigurazione); + } + } + catch (Exception e) { + EntityCacheUtil.removeResult(ConfigurazioneModelImpl.ENTITY_CACHE_ENABLED, + ConfigurazioneImpl.class, primaryKey); + + throw processException(e); + } + finally { + closeSession(session); + } + } + + return configurazione; + } + + /** + * Returns the configurazione with the primary key or returns null if it could not be found. + * + * @param configurazioneId the primary key of the configurazione + * @return the configurazione, or null if a configurazione with the primary key could not be found + * @throws SystemException if a system exception occurred + */ + @Override + public Configurazione fetchByPrimaryKey(long configurazioneId) + throws SystemException { + return fetchByPrimaryKey((Serializable)configurazioneId); + } + + /** + * Returns all the configuraziones. + * + * @return the configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public List findAll() throws SystemException { + return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); + } + + /** + * Returns a range of all the configuraziones. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @return the range of configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public List findAll(int start, int end) + throws SystemException { + return findAll(start, end, null); + } + + /** + * Returns an ordered range of all the configuraziones. + * + *

+ * Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.mwg.sicilia.login.model.impl.ConfigurazioneModelImpl}. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. + *

+ * + * @param start the lower bound of the range of configuraziones + * @param end the upper bound of the range of configuraziones (not inclusive) + * @param orderByComparator the comparator to order the results by (optionally null) + * @return the ordered range of configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public List findAll(int start, int end, + OrderByComparator orderByComparator) throws SystemException { + boolean pagination = true; + FinderPath finderPath = null; + Object[] finderArgs = null; + + if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && + (orderByComparator == null)) { + pagination = false; + finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL; + finderArgs = FINDER_ARGS_EMPTY; + } + else { + finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL; + finderArgs = new Object[] { start, end, orderByComparator }; + } + + List list = (List)FinderCacheUtil.getResult(finderPath, + finderArgs, this); + + if (list == null) { + StringBundler query = null; + String sql = null; + + if (orderByComparator != null) { + query = new StringBundler(2 + + (orderByComparator.getOrderByFields().length * 3)); + + query.append(_SQL_SELECT_CONFIGURAZIONE); + + appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, + orderByComparator); + + sql = query.toString(); + } + else { + sql = _SQL_SELECT_CONFIGURAZIONE; + + if (pagination) { + sql = sql.concat(ConfigurazioneModelImpl.ORDER_BY_JPQL); + } + } + + Session session = null; + + try { + session = openSession(); + + Query q = session.createQuery(sql); + + if (!pagination) { + list = (List)QueryUtil.list(q, + getDialect(), start, end, false); + + Collections.sort(list); + + list = new UnmodifiableList(list); + } + else { + list = (List)QueryUtil.list(q, + getDialect(), start, end); + } + + cacheResult(list); + + FinderCacheUtil.putResult(finderPath, finderArgs, list); + } + catch (Exception e) { + FinderCacheUtil.removeResult(finderPath, finderArgs); + + throw processException(e); + } + finally { + closeSession(session); + } + } + + return list; + } + + /** + * Removes all the configuraziones from the database. + * + * @throws SystemException if a system exception occurred + */ + @Override + public void removeAll() throws SystemException { + for (Configurazione configurazione : findAll()) { + remove(configurazione); + } + } + + /** + * Returns the number of configuraziones. + * + * @return the number of configuraziones + * @throws SystemException if a system exception occurred + */ + @Override + public int countAll() throws SystemException { + Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, + FINDER_ARGS_EMPTY, this); + + if (count == null) { + Session session = null; + + try { + session = openSession(); + + Query q = session.createQuery(_SQL_COUNT_CONFIGURAZIONE); + + count = (Long)q.uniqueResult(); + + FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, + FINDER_ARGS_EMPTY, count); + } + catch (Exception e) { + FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL, + FINDER_ARGS_EMPTY); + + throw processException(e); + } + finally { + closeSession(session); + } + } + + return count.intValue(); + } + + /** + * Initializes the configurazione persistence. + */ + public void afterPropertiesSet() { + String[] listenerClassNames = StringUtil.split(GetterUtil.getString( + com.liferay.util.service.ServiceProps.get( + "value.object.listener.it.mwg.sicilia.login.model.Configurazione"))); + + if (listenerClassNames.length > 0) { + try { + List> listenersList = new ArrayList>(); + + for (String listenerClassName : listenerClassNames) { + listenersList.add((ModelListener)InstanceFactory.newInstance( + getClassLoader(), listenerClassName)); + } + + listeners = listenersList.toArray(new ModelListener[listenersList.size()]); + } + catch (Exception e) { + _log.error(e); + } + } + } + + public void destroy() { + EntityCacheUtil.removeCache(ConfigurazioneImpl.class.getName()); + FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY); + FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); + FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); + } + + private static final String _SQL_SELECT_CONFIGURAZIONE = "SELECT configurazione FROM Configurazione configurazione"; + private static final String _SQL_SELECT_CONFIGURAZIONE_WHERE = "SELECT configurazione FROM Configurazione configurazione WHERE "; + private static final String _SQL_COUNT_CONFIGURAZIONE = "SELECT COUNT(configurazione) FROM Configurazione configurazione"; + private static final String _SQL_COUNT_CONFIGURAZIONE_WHERE = "SELECT COUNT(configurazione) FROM Configurazione configurazione WHERE "; + private static final String _ORDER_BY_ENTITY_ALIAS = "configurazione."; + private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Configurazione exists with the primary key "; + private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Configurazione exists with the key {"; + private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = GetterUtil.getBoolean(PropsUtil.get( + PropsKeys.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE)); + private static Log _log = LogFactoryUtil.getLog(ConfigurazionePersistenceImpl.class); + private static Configurazione _nullConfigurazione = new ConfigurazioneImpl() { + @Override + public Object clone() { + return this; + } + + @Override + public CacheModel toCacheModel() { + return _nullConfigurazioneCacheModel; + } + }; + + private static CacheModel _nullConfigurazioneCacheModel = new CacheModel() { + @Override + public Configurazione toEntityModel() { + return _nullConfigurazione; + } + }; +} \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/startup/SetDefaultsAction.java b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/startup/SetDefaultsAction.java new file mode 100644 index 0000000..41fb27e --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/it/mwg/sicilia/login/startup/SetDefaultsAction.java @@ -0,0 +1,23 @@ +package it.mwg.sicilia.login.startup; + +import it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil; + +import com.liferay.portal.kernel.events.ActionException; +import com.liferay.portal.kernel.events.SimpleAction; +import com.liferay.portal.kernel.exception.SystemException; + +public class SetDefaultsAction extends SimpleAction { + + @Override + public void run(String[] ids) throws ActionException { + + for (String id : ids) { + long companyId = Long.parseLong(id); + try { + ConfigurazioneLocalServiceUtil.setDefaults(companyId); + } catch (SystemException e) { + throw new ActionException(e); + } + } + } +} diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/portal.properties b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/portal.properties new file mode 100644 index 0000000..daf2b12 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/portal.properties @@ -0,0 +1 @@ +application.startup.events=it.mwg.sicilia.login.startup.SetDefaultsAction diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/src/service.properties b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/service.properties new file mode 100644 index 0000000..3448b2e --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/src/service.properties @@ -0,0 +1,41 @@ +## +## Properties Override +## + + # + # Specify where to get the overridden properties. Updates should not be made + # on this file but on the overridden version of this file. + # + include-and-override=${base.path}/service-ext.properties + +## +## Build +## + + build.namespace=sicilia_login + build.number=26 + build.date=1635416156895 + build.auto.upgrade=true + +## +## Spring +## + + # + # Input a list of comma delimited Spring configurations. These will be + # loaded after the bean definitions specified in the + # portalContextConfigLocation parameter in web.xml. + # + spring.configs=\ + WEB-INF/classes/META-INF/base-spring.xml,\ + \ + WEB-INF/classes/META-INF/hibernate-spring.xml,\ + WEB-INF/classes/META-INF/infrastructure-spring.xml,\ + \ + WEB-INF/classes/META-INF/cluster-spring.xml,\ + \ + WEB-INF/classes/META-INF/portlet-spring.xml,\ + \ + WEB-INF/classes/META-INF/shard-data-source-spring.xml,\ + \ + WEB-INF/classes/META-INF/ext-spring.xml \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/aui.tld b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/aui.tld new file mode 100644 index 0000000..1eeac88 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/aui.tld @@ -0,0 +1,2568 @@ + + + + aui:.]]> + 1.0 + aui + http://alloy.liferay.com/tld/aui + + + button-item + com.liferay.taglib.aui.ButtonItemTag + JSP + + ]]> + activeState + false + true + boolean + + + ]]> + boundingBox + false + true + java.lang.String + + + ]]> + classNames + false + true + java.lang.Object + + + ]]> + contentBox + false + true + java.lang.String + + + boundingBox.]]> + cssClass + false + true + java.lang.String + + + ]]> + defaultState + false + true + boolean + + + ]]> + depth + false + true + java.lang.Object + + + ]]> + destroyed + false + true + boolean + + + ]]> + disabled + false + true + boolean + + + ]]> + focused + false + true + boolean + + + {fn: // The function to execute + context: // The context to execute the function in + type: // The type of event to listen for (defaults to "click") + }]]> + handler + false + true + java.lang.Object + + + ]]> + height + false + true + java.lang.Object + + + boundingBox when + visible is set to + false.]]> + hideClass + false + true + java.lang.String + + + ]]> + hoverState + false + true + boolean + + + ]]> + icon + false + true + java.lang.String + + + aui-button-icon.]]> + iconNode + false + true + java.lang.String + + + ]]> + buttonitemId + false + true + java.lang.String + + + ]]> + index + false + true + java.lang.Object + + + ]]> + initialized + false + true + boolean + + + ]]> + label + false + true + java.lang.String + + + aui-button-label.]]> + labelNode + false + true + java.lang.String + + + ]]> + buttonitemParent + false + true + java.lang.Object + + + true the render phase will be autimatically invoked + preventing the .render() manual call.]]> + render + false + true + java.lang.Object + + + ]]> + rendered + false + true + boolean + + + ]]> + root + false + true + java.lang.Object + + + +
0
(Default) Not selected
+
1
Fully selected
+
2
Partially selected
+ ]]>
+ selected + false + true + java.lang.Object +
+ + ]]> + srcNode + false + true + java.lang.String + + + ]]> + strings + false + true + java.lang.Object + + + ]]> + tabIndex + false + true + java.lang.Object + + + ]]> + title + false + true + java.lang.String + + + ]]> + type + false + true + java.lang.String + + + ]]> + useARIA + false + true + boolean + + + ]]> + visible + false + true + boolean + + + ]]> + width + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterActiveStateChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterBoundingBoxChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterClassNamesChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterContentBoxChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterCssClassChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterDefaultStateChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterDepthChange + false + true + java.lang.Object + + + + Lifecycle event for the destroy phase, + fired prior to destruction. Invoking the preventDefault + method on the event object provided to subscribers will + prevent destruction from proceeding. +

+

+ Subscribers to the "after" moment of this event, will be notified + after destruction is complete (and as a result cannot prevent + destruction). +

]]>
+ afterDestroy + false + true + java.lang.Object +
+ + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterDestroyedChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterDisabledChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterFocusedChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterHandlerChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterHeightChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterHideClassChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterHoverStateChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterIconChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterIconNodeChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterIdChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterIndexChange + false + true + java.lang.Object + + + + Lifecycle event for the init phase, fired prior to initialization. + Invoking the preventDefault() method on the event object provided + to subscribers will prevent initialization from occuring. +

+

+ Subscribers to the "after" momemt of this event, will be notified + after initialization of the object is complete (and therefore + cannot prevent initialization). +

]]>
+ afterInit + false + true + java.lang.Object +
+ + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterInitializedChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterLabelChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterLabelNodeChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterParentChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterRenderChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterRenderedChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterRootChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterSelectedChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterSrcNodeChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterStringsChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterTabIndexChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterTitleChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterTypeChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterUseARIAChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterVisibleChange + false + true + java.lang.Object + + + ]]> + afterContentUpdate + false + true + java.lang.Object + + + + Subscribers to the "on" moment of this event, will be notified + before the widget is rendered. +

+

+ Subscribers to the "after" moment of this event, will be notified + after rendering is complete. +

]]>
+ afterRender + false + true + java.lang.Object +
+ + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + afterWidthChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onActiveStateChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onBoundingBoxChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onClassNamesChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onContentBoxChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onCssClassChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onDefaultStateChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onDepthChange + false + true + java.lang.Object + + + + Lifecycle event for the destroy phase, + fired prior to destruction. Invoking the preventDefault + method on the event object provided to subscribers will + prevent destruction from proceeding. +

+

+ Subscribers to the "after" moment of this event, will be notified + after destruction is complete (and as a result cannot prevent + destruction). +

]]>
+ onDestroy + false + true + java.lang.Object +
+ + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onDestroyedChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onDisabledChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onFocusedChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onHandlerChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onHeightChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onHideClassChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onHoverStateChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onIconChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onIconNodeChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onIdChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onIndexChange + false + true + java.lang.Object + + + + Lifecycle event for the init phase, fired prior to initialization. + Invoking the preventDefault() method on the event object provided + to subscribers will prevent initialization from occuring. +

+

+ Subscribers to the "after" momemt of this event, will be notified + after initialization of the object is complete (and therefore + cannot prevent initialization). +

]]>
+ onInit + false + true + java.lang.Object +
+ + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onInitializedChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onLabelChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onLabelNodeChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onParentChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onRenderChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onRenderedChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onRootChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onSelectedChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onSrcNodeChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onStringsChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onTabIndexChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onTitleChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onTypeChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onUseARIAChange + false + true + java.lang.Object + + + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onVisibleChange + false + true + java.lang.Object + + + ]]> + onContentUpdate + false + true + java.lang.Object + + + + Subscribers to the "on" moment of this event, will be notified + before the widget is rendered. +

+

+ Subscribers to the "after" moment of this event, will be notified + after rendering is complete. +

]]>
+ onRender + false + true + java.lang.Object +
+ + on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.]]> + onWidthChange + false + true + java.lang.Object + + true +
+ + + a + com.liferay.taglib.aui.ATag + JSP + + <p> tag could be used for something other than a paragraph.]]> + ariaRole + false + true + java.lang.String + + + + cssClass + false + true + java.lang.String + + + HashMap<"class-name", foo> would render as the attribute data-class-name = foo;.]]> + data + false + true + java.util.Map + + + + href + true + true + java.lang.String + + + + id + false + true + java.lang.String + + + + label + false + true + java.lang.String + + + + lang + false + true + java.lang.String + + + + onClick + false + true + java.lang.String + + + self. Possible values are blank, self, parent, top, and a unique frame's name.]]> + target + false + true + java.lang.String + + + + title + false + true + java.lang.String + + true + + + button + com.liferay.taglib.aui.ButtonTag + JSP + + primary attribute.]]> + cssClass + false + true + java.lang.String + + + HashMap<"class-name", foo> would render as the attribute data-class-name = foo;.]]> + data + false + true + java.lang.Object + + + false.]]> + disabled + false + true + boolean + + + + href + false + true + java.lang.String + + + here.]]> + icon + false + true + java.lang.String + + + left.]]> + iconAlign + false + true + java.lang.String + + + + name + false + true + java.lang.String + + + + onClick + false + true + java.lang.String + + + type attribute is set to submit, this value is set to true. For all other types, the value is set to false by default.]]> + primary + false + true + java.lang.Object + + + button, submit, cancel and reset. The default value is button.]]> + type + false + true + java.lang.String + + + href location when a user clicks the button. The default value is false.]]> + useDialog + false + true + boolean + + + value + false + true + java.lang.String + + true + + + <div> tag to wrap <aui:button> components and offer additional styling.]]> + button-row + com.liferay.taglib.aui.ButtonRowTag + JSP + + + cssClass + false + true + java.lang.String + + + + id + false + true + java.lang.String + + true + + + <aui:row> component.]]> + col + com.liferay.taglib.aui.ColTag + JSP + + + cssClass + false + true + java.lang.String + + + + id + false + true + java.lang.String + + + offset + false + true + int + + + offsetWidth + false + true + int + + + 12. For example, a span of 4 would result in a column width 4/12 (or 1/3) of the total width of the containing row.]]> + span + false + true + int + + + span attribute. The width is then converted to a span expressed as ((width/100) x 12), rounded to the nearest whole number. For example, a width of 33 would be converted to 3.96, which would be rounded up to a span value of 4.]]> + width + false + true + int + + true + + + aui:col.]]> + column + com.liferay.taglib.aui.ColumnTag + JSP + + 20 would be 20%. The default value is 0.]]> + columnWidth + false + true + int + + + + cssClass + false + true + java.lang.String + + + false.]]> + first + false + true + boolean + + + + id + false + true + java.lang.String + + + false.]]> + last + false + true + boolean + + true + + + component + com.liferay.taglib.aui.ComponentTag + JSP + + defineVar + false + true + boolean + + + excludeAttributes + false + true + java.lang.String + + + javaScriptAttributes + false + true + java.lang.String + + + module + false + true + java.lang.String + + + name + false + true + java.lang.String + + + options + false + true + java.util.Map + + + scriptPosition + false + true + java.lang.String + + + tagPageContext + true + true + javax.servlet.jsp.JspContext + + + useJavaScript + false + true + java.io.Serializable + + + var + false + true + java.lang.String + + true + + + <div> tag to wrap <aui:row> components and offer additional styling.]]> + container + com.liferay.taglib.aui.ContainerTag + JSP + + + cssClass + false + true + java.lang.String + + + true.]]> + fluid + false + true + boolean + + + + id + false + true + java.lang.String + + true + + + <div> tag to wrap form fields and offer additional styling.]]> + field-wrapper + com.liferay.taglib.aui.FieldWrapperTag + JSP + + + cssClass + false + true + java.lang.String + + + HashMap<"class-name", foo> would render as the attribute data-class-name = foo;.]]> + data + false + true + java.lang.Object + + + false.]]> + first + false + true + boolean + + + + helpMessage + false + true + java.lang.String + + + false.]]> + inlineField + false + true + boolean + + + right and left.]]> + inlineLabel + false + true + java.lang.String + + + + label + false + true + java.lang.String + + + false.]]> + last + false + true + boolean + + + + name + false + true + java.lang.String + + + + required + false + true + boolean + + + + <div> tag to group related form elements and offer additional styling.]]> + fieldset + com.liferay.taglib.aui.FieldsetTag + JSP + + + column + false + true + boolean + + + + cssClass + false + true + java.lang.String + + + + helpMessage + false + true + java.lang.String + + + + id + false + true + java.lang.String + + + + label + false + true + java.lang.String + + true + + + + form + com.liferay.taglib.aui.FormTag + JSP + + + action + false + true + java.lang.String + + + + cssClass + false + true + java.lang.String + + + true.]]> + escapeXml + false + true + boolean + + + false.]]> + inlineLabels + false + true + boolean + + + post. Possible values are get and post.]]> + method + false + true + java.lang.String + + + fm.]]> + name + false + true + java.lang.String + + + + onSubmit + false + true + java.lang.String + + + + portletNamespace + false + true + java.lang.String + + + true.]]> + useNamespace + false + true + boolean + + true + + + + icon + com.liferay.taglib.aui.IconTag + JSP + + image attribute.]]> + cssClass + false + true + java.lang.String + + + HashMap<"class-name", foo> would render as the attribute data-class-name = foo;.]]> + data + false + true + java.util.Map + + + + id + false + true + java.lang.String + + + icon-edit CSS class by setting the value edit. If an icon image is referenced for cssClass and image, both icons are shown in the component.]]> + image + false + true + java.lang.String + + + + label + false + true + java.lang.String + + + self. Possible values are blank, self, parent, top, and a unique frame's name.]]> + target + false + true + java.lang.String + + + + url + false + true + java.lang.String + + true + + + + input + com.liferay.taglib.aui.InputTag + JSP + + + autoFocus + false + true + boolean + + + + autoSize + false + true + boolean + + + + bean + false + true + java.lang.Object + + + false.]]> + changesContext + false + true + boolean + + + type is radio or checkbox.]]> + checked + false + true + boolean + + + 0.]]> + classPK + false + true + long + + + + cssClass + false + true + java.lang.String + + + HashMap<"class-name", foo> would render as the attribute data-class-name = foo;.]]> + data + false + true + java.lang.Object + + + dateTogglerCheckboxLabel + false + true + java.lang.String + + + + defaultLanguageId + false + true + java.lang.String + + + false.]]> + disabled + false + true + boolean + + + field + false + true + java.lang.String + + + field of the component.]]> + fieldParam + false + true + java.lang.String + + + + first + false + true + boolean + + + + formName + false + true + java.lang.String + + + + helpMessage + false + true + java.lang.String + + + input-group-addon.]]> + helpTextCssClass + false + true + java.lang.String + + + + id + false + true + java.lang.String + + + false.]]> + ignoreRequestValue + false + true + boolean + + + false.]]> + inlineField + false + true + boolean + + + right and left.]]> + inlineLabel + false + true + java.lang.String + + + name attribute's value.]]> + label + false + true + java.lang.String + + + languageId + false + true + java.lang.String + + + + last + false + true + boolean + + + false.]]> + localized + false + true + boolean + + + type is number or range. Note that the max value is inclusive if the input's type is range.]]> + max + false + true + java.lang.Object + + + + model + false + true + java.lang.Class + + + type is number or range. Note that the min value is inclusive if the input's type is range.]]> + min + false + true + java.lang.Object + + + multiple + false + true + boolean + + + + name + true + true + java.lang.String + + + + onChange + false + true + java.lang.String + + + + onClick + false + true + java.lang.String + + + + placeholder + false + true + java.lang.String + + + + prefix + false + true + java.lang.String + + + + required + false + true + boolean + + + textarea.]]> + resizable + false + true + boolean + + + + showRequiredLabel + false + true + boolean + + + + suffix + false + true + java.lang.String + + + + title + false + true + java.lang.String + + + text, hidden, assetCategories, assetTags, textarea, timeZone, password, checkbox, radio, submit, button, color, email, number, range, resource, url, and an empty value. If an empty value or no value is set, the input's type is obtained automatically from the input component's bean.]]> + type + false + true + java.lang.String + + + true.]]> + useNamespace + false + true + boolean + + + + value + false + true + java.lang.Object + + + div that wraps the input component.]]> + wrapperCssClass + false + true + java.lang.String + + true + + + + layout + com.liferay.taglib.aui.LayoutTag + JSP + + + cssClass + false + true + java.lang.String + + true + + + + model-context + com.liferay.taglib.aui.ModelContextTag + JSP + + + bean + false + true + java.lang.Object + + + + defaultLanguageId + false + true + java.lang.String + + + + model + false + true + java.lang.Class + + + + <nav:item> components for an <aui:nav-bar> component.]]> + nav + com.liferay.taglib.aui.NavTag + JSP + + + ariaLabel + false + true + java.lang.String + + + <p> tag could be used for something other than a paragraph.]]> + ariaRole + false + true + java.lang.String + + + collapsible + false + true + boolean + + + + cssClass + false + true + java.lang.String + + + icon + false + true + java.lang.String + + + + id + false + true + java.lang.String + + + true.]]> + useNamespace + false + true + boolean + + true + + + + nav-bar + com.liferay.taglib.aui.NavBarTag + JSP + + + cssClass + false + true + java.lang.String + + + + id + false + true + java.lang.String + + true + + + <aui:nav-bar> component.]]> + nav-bar-search + com.liferay.taglib.aui.NavBarSearchTag + JSP + + + cssClass + false + true + java.lang.String + + + + id + false + true + java.lang.String + + + file + false + true + java.lang.String + + + + searchContainer + false + true + com.liferay.portal.kernel.dao.search.SearchContainer + + true + + + <aui:nav> component.]]> + nav-item + com.liferay.taglib.aui.NavItemTag + JSP + + href attribute.]]> + anchorCssClass + false + true + java.lang.String + + + HashMap<"class-name", foo> would render as the attribute data-class-name = foo;.]]> + anchorData + false + true + java.lang.Object + + + href attribute.]]> + anchorId + false + true + java.lang.String + + + + ariaLabel + false + true + java.lang.String + + + <p> tag could be used for something other than a paragraph.]]> + ariaRole + false + true + java.lang.String + + + + cssClass + false + true + java.lang.String + + + HashMap<"class-name", foo> would render as the attribute data-class-name = foo;.]]> + data + false + true + java.lang.Object + + + false.]]> + dropdown + false + true + boolean + + + + href + false + true + java.lang.Object + + + + iconCssClass + false + true + java.lang.String + + + + id + false + true + java.lang.String + + + + label + false + true + java.lang.String + + + localizeLabel + false + true + boolean + + + false.]]> + selected + false + true + boolean + + + state + false + true + java.lang.String + + + + title + false + true + java.lang.String + + + toggle + false + true + boolean + + + href location when a user clicks the navigation item. The default value is false.]]> + useDialog + false + true + boolean + + + drop-down-menu class. The default value is true.]]> + wrapDropDownMenu + false + true + boolean + + true + + + <aui:select> component.]]> + option + com.liferay.taglib.aui.OptionTag + JSP + + + cssClass + false + true + java.lang.String + + + HashMap<"class-name", foo> would render as the attribute data-class-name = foo;.]]> + data + false + true + java.util.Map + + + false.]]> + disabled + false + true + boolean + + + + label + false + true + java.lang.Object + + + false.]]> + selected + false + true + boolean + + + text-align:right;.]]> + style + false + true + java.lang.String + + + useModelValue + false + true + boolean + + + label attribute.]]> + value + false + true + java.lang.Object + + true + + + panel + com.liferay.taglib.aui.PanelTag + JSP + + collapsed + false + true + boolean + + + collapsible + false + true + boolean + + + id + false + true + java.lang.String + + + label + false + true + java.lang.String + + + + <aui:col> components.]]> + row + com.liferay.taglib.aui.RowTag + JSP + + + cssClass + false + true + java.lang.String + + + row-fluid CSS class to the row. The default value is true. If set to false, the row CSS class is assigned.]]> + fluid + false + true + boolean + + + + id + false + true + java.lang.String + + true + + + + script + com.liferay.taglib.aui.ScriptTag + JSP + + + position + false + true + java.lang.String + + + + use + false + true + java.lang.String + + + + <aui:option> components.]]> + select + com.liferay.taglib.aui.SelectTag + JSP + + + bean + false + true + java.lang.Object + + + false.]]> + changesContext + false + true + boolean + + + + cssClass + false + true + java.lang.String + + + HashMap<"class-name", "foo"> would render as the attribute data-class-name = "foo";.]]> + data + false + true + java.util.Map + + + false.]]> + disabled + false + true + boolean + + + false.]]> + first + false + true + boolean + + + + helpMessage + false + true + java.lang.String + + + + id + false + true + java.lang.String + + + ignoreRequestValue + false + true + boolean + + + false.]]> + inlineField + false + true + boolean + + + right and left.]]> + inlineLabel + false + true + java.lang.String + + + + label + false + true + java.lang.String + + + false.]]> + last + false + true + boolean + + + ListTypeImpl.java.]]> + listType + false + true + java.lang.String + + + listTypeFieldName + false + true + java.lang.String + + + true, the select field expands to allow for multiple selections. The default value is false.]]> + multiple + false + true + boolean + + + label attribute and takes the place of the label.]]> + name + true + true + java.lang.String + + + + onChange + false + true + java.lang.String + + + + onClick + false + true + java.lang.String + + + + prefix + false + true + java.lang.String + + + false.]]> + required + false + true + boolean + + + false.]]> + showEmptyOption + false + true + boolean + + + required attribute is set to true. The default value is false.]]> + showRequiredLabel + false + true + boolean + + + + suffix + false + true + java.lang.String + + + + title + false + true + java.lang.String + + + true.]]> + useNamespace + false + true + boolean + + true + + + + spacer + com.liferay.taglib.aui.SpacerTag + JSP + + + + translation-manager + com.liferay.taglib.aui.TranslationManagerTag + JSP + + + availableLocales + false + true + java.util.Locale[] + + + + defaultLanguageId + false + true + java.lang.String + + + editingLanguageId + false + true + java.lang.String + + + + id + false + true + java.lang.String + + + true. If this is set to false, the translation manager will not work entirely.]]> + initialize + false + true + boolean + + + false.]]> + readOnly + false + true + boolean + + + + + validator + com.liferay.taglib.aui.ValidatorTagImpl + JSP + + true.]]> + customValidatorRequired + false + true + boolean + + + + errorMessage + false + true + java.lang.String + + + acceptFiles, alpha, alphanum, date, digits, email, equalTo, iri, max, maxLength, min, minLength, number, required, and url.]]> + name + true + true + java.lang.String + + + + + workflow-status + com.liferay.taglib.aui.WorkflowStatusTag + JSP + + + bean + false + true + java.lang.Object + + + + helpMessage + false + true + java.lang.String + + + + id + false + true + java.lang.String + + + + model + false + true + java.lang.Class + + + true.]]> + showIcon + false + true + boolean + + + true.]]> + showLabel + false + true + boolean + + + 0 (Approved), 1 (Pending), 2 (Draft), 3 (Expired), 4 (Denied), 5 (Inactive), 6 (Incomplete), 7 (Scheduled), and 8 (In-Trash). Any other value defaults to status (Any).]]> + status + false + true + java.lang.Integer + + + + statusMessage + false + true + java.lang.String + + + + version + false + true + java.lang.String + + +
\ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-portlet-ext.tld b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-portlet-ext.tld new file mode 100644 index 0000000..7c04664 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-portlet-ext.tld @@ -0,0 +1,538 @@ + + + + + 1.0 + 1.1 + liferay-portlet + http://liferay.com/tld/portlet + + + + + actionURL + com.liferay.taglib.portlet.ActionURLTag + com.liferay.taglib.portlet.ActionURLTei + JSP + + allowEmptyParam + false + true + + + anchor + false + true + + + copyCurrentRenderParameters + false + true + + + doAsGroupId + false + true + + + doAsUserId + false + true + + + encrypt + false + true + + + escapeXml + false + true + + + name + false + true + + + plid + false + true + + + portletConfiguration + false + true + + + portletMode + false + true + + + portletName + false + true + + + refererGroupId + false + true + + + refererPlid + false + true + + + secure + false + true + + + var + false + true + + + varImpl + false + true + + + windowState + false + true + + + + icon-back + com.liferay.taglib.portletext.IconBackTag + JSP + + + icon-close + com.liferay.taglib.portletext.IconCloseTag + JSP + + + icon-configuration + com.liferay.taglib.portletext.IconConfigurationTag + JSP + + + icon-edit + com.liferay.taglib.portletext.IconEditTag + JSP + + + icon-edit-defaults + com.liferay.taglib.portletext.IconEditDefaultsTag + JSP + + + icon-edit-guest + com.liferay.taglib.portletext.IconEditGuestTag + JSP + + + icon-export-import + com.liferay.taglib.portletext.IconExportImportTag + JSP + + + icon-help + com.liferay.taglib.portletext.IconHelpTag + JSP + + + icon-maximize + com.liferay.taglib.portletext.IconMaximizeTag + JSP + + + icon-minimize + com.liferay.taglib.portletext.IconMinimizeTag + JSP + + + icon-options + com.liferay.taglib.portletext.IconOptionsTag + JSP + + + icon-portlet + com.liferay.taglib.portletext.IconPortletTag + JSP + + ariaRole + false + true + + + id + false + true + + + label + false + true + + + portlet + false + true + + + url + false + true + + + + icon-portlet-css + com.liferay.taglib.portletext.IconPortletCssTag + JSP + + + icon-print + com.liferay.taglib.portletext.IconPrintTag + JSP + + + icon-refresh + com.liferay.taglib.portletext.IconRefreshTag + JSP + + + param + com.liferay.taglib.util.ParamTag + empty + + name + true + true + + + value + true + true + + + + preview + com.liferay.taglib.portletext.PreviewTag + JSP + + portletName + true + true + + + queryString + false + true + + + showBorders + false + true + + + width + false + true + + + + + + + renderURL + com.liferay.taglib.portlet.RenderURLTag + com.liferay.taglib.portlet.RenderURLTei + JSP + + allowEmptyParam + false + true + + + anchor + false + true + + + copyCurrentRenderParameters + false + true + + + doAsGroupId + false + true + + + doAsUserId + false + true + + + encrypt + false + true + + + escapeXml + false + true + + + plid + false + true + + + portletConfiguration + false + true + + + portletMode + false + true + + + portletName + false + true + + + refererGroupId + false + true + + + refererPlid + false + true + + + secure + false + true + + + var + false + true + + + varImpl + false + true + + + windowState + false + true + + + + renderURLParams + com.liferay.taglib.portlet.RenderURLParamsTag + JSP + + varImpl + true + true + + + + + + + resourceURL + com.liferay.taglib.portlet.ResourceURLTag + com.liferay.taglib.portlet.ResourceURLTei + JSP + + anchor + false + true + + + copyCurrentRenderParameters + false + true + + + doAsGroupId + false + true + + + doAsUserId + false + true + + + encrypt + false + true + + + escapeXml + false + true + + + id + false + true + + + plid + false + true + + + portletConfiguration + false + true + + + portletMode + false + true + + + portletName + false + true + + + refererGroupId + false + true + + + refererPlid + false + true + + + secure + false + true + + + var + false + true + + + varImpl + false + true + + + windowState + false + true + + + + runtime + com.liferay.taglib.portletext.RuntimeTag + JSP + + defaultPreferences + false + true + + + portletName + true + true + + + queryString + false + true + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-portlet.tld b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-portlet.tld new file mode 100644 index 0000000..a7cd2fd --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-portlet.tld @@ -0,0 +1,158 @@ + + + + + 1.0 + 1.1 + portlet + http://java.sun.com/portlet + + actionURL + com.liferay.taglib.portlet.ActionURLTag + com.liferay.taglib.portlet.ActionURLTei + JSP + + copyCurrentRenderParameters + false + true + + + escapeXml + false + true + + + name + false + true + + + portletMode + false + true + + + secure + false + true + + + var + false + true + + + windowState + false + true + + + + defineObjects + com.liferay.taglib.portlet.DefineObjectsTag + com.liferay.taglib.portlet.DefineObjectsTei + empty + + + namespace + com.liferay.taglib.portlet.NamespaceTag + empty + + + param + com.liferay.taglib.util.ParamTag + empty + + name + true + true + + + value + true + true + + + + property + com.liferay.taglib.util.PropertyTag + empty + + name + true + true + + + value + true + true + + + + renderURL + com.liferay.taglib.portlet.RenderURLTag + com.liferay.taglib.portlet.RenderURLTei + JSP + + copyCurrentRenderParameters + false + true + + + escapeXml + false + true + + + portletMode + false + true + + + secure + false + true + + + var + false + true + + + windowState + false + true + + + + resourceURL + com.liferay.taglib.portlet.ResourceURLTag + com.liferay.taglib.portlet.ResourceURLTei + JSP + + cacheability + false + true + + + escapeXml + false + true + + + id + false + true + + + secure + false + true + + + var + false + true + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-security.tld b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-security.tld new file mode 100644 index 0000000..f8e6f6d --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-security.tld @@ -0,0 +1,106 @@ + + + + + 1.0 + 1.1 + liferay-security + http://liferay.com/tld/security + + doAsURL + com.liferay.taglib.security.DoAsURLTag + com.liferay.taglib.security.DoAsURLTei + JSP + + doAsUserId + false + true + + + var + false + true + + + + encrypt + com.liferay.taglib.security.EncryptTag + JSP + + className + false + true + + + protocol + true + true + + + style + false + true + + + target + false + true + + + unencryptedParams + false + true + + + url + true + true + + + + permissionsURL + com.liferay.taglib.security.PermissionsURLTag + com.liferay.taglib.security.PermissionsURLTei + JSP + + modelResource + true + true + + + modelResourceDescription + true + true + + + redirect + false + true + + + resourceGroupId + false + true + + + resourcePrimKey + true + true + + + roleTypes + false + true + + + var + false + true + + + windowState + false + true + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-theme.tld b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-theme.tld new file mode 100644 index 0000000..90ac81d --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-theme.tld @@ -0,0 +1,65 @@ + + + + + 1.0 + 1.1 + theme + http://liferay.com/tld/theme + + defineObjects + com.liferay.taglib.theme.DefineObjectsTag + com.liferay.taglib.theme.DefineObjectsTei + empty + + + include + com.liferay.taglib.theme.IncludeTag + JSP + + page + true + true + + + + layout-icon + com.liferay.taglib.theme.LayoutIconTag + JSP + + layout + true + true + + + + meta-tags + com.liferay.taglib.theme.MetaTagsTag + JSP + + + param + com.liferay.taglib.util.ParamTag + JSP + + name + true + true + + + value + true + true + + + + wrap-portlet + com.liferay.taglib.theme.WrapPortletTag + JSP + + page + true + true + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-ui.tld b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-ui.tld new file mode 100644 index 0000000..daa2c53 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-ui.tld @@ -0,0 +1,4696 @@ + + + + Provides the Liferay UI component tags, prefixed with liferay-ui:]]>. + 1.0 + liferay-ui + http://liferay.com/tld/ui + + app-view-display-style + com.liferay.taglib.ui.AppViewDisplayStyleTag + empty + + displayStyle + true + true + + + displayStyles + true + true + + + requestParams + true + true + + + + Creates a component for displaying entry items such as images, documents, folders, etc. in a concise but informative manner. Items are displayed in a similar fashion to entries in the file system of most operating systems. + app-view-entry + com.liferay.taglib.ui.AppViewEntryTag + empty + + The path to an action JSP page. + actionJsp + false + true + + + The Java class name for any categories added to the entry. + assetCategoryClassName + false + true + + + The Java class primary key for any categories added to the entry. This is a Java long]]>. + assetCategoryClassPK + false + true + + + The Java class name for any tags added to the entry. + assetTagClassName + false + true + + + The Java class primary key for any tags added to the entry. This is a Java long]]>. + assetTagClassPK + false + true + + + The name of the entry's author. + author + false + true + + + The date the entry was created. + createDate + false + true + + + A CSS class for styling this component. + cssClass + false + true + + + Miscellaneous data to be stored via a map. This data is not shared with the browser. The map holds key value pairs of type <String, Object>]]>. + data + false + true + java.util.Map + + + A description of the entry. + description + false + true + + + A date to display the entry. + displayDate + false + true + + + A display style for the component. Options are list]]>, icon]]>, and descriptive]]>. + displayStyle + true + true + + + A date for the entry to expire and be automatically deleted. + expirationDate + false + true + + + Whether the entry is a folder. The default is false]]>. + folder + false + true + boolean + + + The group ID of the entry. This is a Java long]]>. + groupId + false + true + + + The version number of the most recently published copy of the entry. + latestApprovedVersion + false + true + + + The author of the most recently published version of the entry. + latestApprovedVersionAuthor + false + true + + + Whether the entry is locked. The default value is false]]>. + locked + false + true + boolean + + + The date of the most recent modification to the entry. + modifiedDate + false + true + + + The date the entry was reviewed. + reviewDate + false + true + + + A checkbox input ID to be used for the entry row checker. + rowCheckerId + false + true + + + A name for the entry row checker. + rowCheckerName + false + true + + + Whether to show a shortcut icon link to the entry. The default value is false]]>. + shortcut + false + true + boolean + + + Whether the entry is selectable. An actual checkbox is used when the display style is icon]]> or descriptive]]>. The default value is false]]>. + showCheckbox + true + true + boolean + + + Whether to show the link title. The default value is true]]>. + showLinkTitle + false + true + boolean + + + The current status of the entry, as represented by an integer. Options are -1: STATUS_ANY]]>, 0: STATUS_APPROVED]]>, 1: ACTION_PUBLISH]]>, 2: STATUS_DRAFT]]>, and 4: STATUS_DENIED]]>. The default value is -1]]>. + status + false + true + int + + + A CSS style to be applied to the div containing the thumbnail for the entry. + thumbnailDivStyle + false + true + + + The source URL for an entry thumbnail image. + thumbnailSrc + true + true + + + A CSS style to be applied to the thumbnail for the entry. + thumbnailStyle + false + true + + + A title for the entry. + title + true + true + + + The current version of the entry. + version + false + true + + + A URL to view the full entry. + url + false + true + + + + Creates a navigation list item component for navigating app view entries. + app-view-navigation-entry + com.liferay.taglib.ui.AppViewNavigationEntryTag + empty + + The path for an action JSP page. + actionJsp + false + true + + + A CSS class for styling this component. + cssClass + false + true + + + Data to be applied to the component link and stored via a map. This data is not shared with the browser. The map holds key value pairs of type <String, Object>]]>. + dataView + false + true + java.util.Map + + + A title for the component. + entryTitle + true + true + + + A CSS class for setting the icon of the component. + iconImage + false + true + + + iconSrc + false + true + + + Whether the entry is selected. + selected + false + true + boolean + + + A URL to view the entry. + viewURL + true + true + + + + Creates a toolbar for viewing items in app view. + app-view-toolbar + com.liferay.taglib.ui.AppViewToolbarTag + JSP + + Whether to include the option to choose a display style for component items. If the value is true]]>, a list of display style options is rendered. The default value is false]]>. + includeDisplayStyle + false + true + boolean + + + Whether to include an option to select all component items. The default value is false]]>. + includeSelectAll + false + true + boolean + + + The file path for a search JSP page. + searchJsp + false + true + + + + Creates a component for displaying search results of entries in app view. + app-view-search-entry + com.liferay.taglib.ui.AppViewSearchEntryTag + empty + + The file path for an action JSP page. + actionJsp + false + true + + + containerIcon + false + true + + + The name of the container that the entry is in, such as the name of a folder. + containerName + false + true + + + containerSrc + false + true + + + The type of container the entry is in, such as Folder]]>. + containerType + false + true + + + A CSS class for styling this component. + cssClass + false + true + + + A description of the entry. + description + true + true + + + A list of objects containing information such as content, user ID, and titles of the entry file attachments. + fileEntryTuples + false + true + + + Whether the entry is locked. The default value is false]]>. + locked + false + true + boolean + + + A list of objects containing information such as content, author, and status of entry messages. An example would be a comment made by one user on another user's blog post. + mbMessages + false + true + + + Query terms of the search. + queryTerms + true + true + + + A checkbox input ID to be used for the entry row checker. This is a Java long]]>. + rowCheckerId + false + true + + + A name to be used for the entry row checker. + rowCheckerName + false + true + + + Whether the entry is selectable via a checkbox. The default value is true]]>. + showCheckbox + false + true + boolean + + + The current status of the entry as represented by an integer. Options are -1: STATUS_ANY]]>, 0: STATUS_APPROVED]]>, 1: ACTION_PUBLISH]]>, 2: STATUS_DRAFT]]>, and 4: STATUS_DENIED]]>. + status + false + true + + + The URL for an entry thumbnail image. + thumbnailSrc + false + true + + + A title for the entry. + title + true + true + + + A URL used to view the full entry. + url + true + true + + + The current and past versions of the entry. + versions + false + true + + + + asset-categories-error + com.liferay.taglib.ui.AssetCategoriesErrorTag + JSP + + + asset-categories-navigation + com.liferay.taglib.ui.AssetCategoriesNavigationTag + JSP + + hidePortletWhenEmpty + false + true + + + vocabularyIds + false + true + + + + asset-categories-selector + com.liferay.taglib.ui.AssetCategoriesSelectorTag + JSP + + className + false + true + + + classPK + false + true + + + contentCallback + false + true + + + curCategoryIds + false + true + + + groupIds + false + true + + + hiddenInput + false + true + + + ignoreRequestValue + false + true + + + + asset-categories-summary + com.liferay.taglib.ui.AssetCategoriesSummaryTag + JSP + + className + true + true + + + classPK + true + true + + + message + false + true + + + portletURL + false + true + + + + asset-links + com.liferay.taglib.ui.AssetLinksTag + JSP + + assetEntryId + false + true + + + className + false + true + + + classPK + false + true + + + + Creates a liferay-ui:error]]> component to display tag-related error messages. + asset-tags-error + com.liferay.taglib.ui.AssetTagsErrorTag + JSP + + + asset-tags-navigation + com.liferay.taglib.ui.AssetTagsNavigationTag + JSP + + classNameId + false + true + + + displayStyle + false + true + + + hidePortletWhenEmpty + false + true + + + maxAssetTags + false + true + + + showAssetCount + false + true + + + showZeroAssetCount + false + true + + + + Creates a Liferay.AssetTagsSelector]]> component to create and select tags to add to an asset, such as a blog entry, bookmark, or wiki page. + asset-tags-selector + com.liferay.taglib.ui.AssetTagsSelectorTag + JSP + + Whether to automatically focus the tag input field. The default value is false]]>. + autoFocus + false + true + boolean + + + The Java class of the asset. + className + false + true + + + The Java class primary key of an asset to associate with the tags. This is a Java long]]>. + classPK + false + true + + + A function to get tag suggestions based on the asset's content. + contentCallback + false + true + + + The current selected tags. + curTags + false + true + + + The group IDs of the asset tags. + groupIds + false + true + + + The name of the hidden input for passing in the asset's current tags. + hiddenInput + false + true + + + An ID for the component instance. + id + false + true + + + ignoreRequestValue + false + true + + + + Creates a component to display all the tags associated with an asset, such as a blog entry, wiki page, or message boards message. + asset-tags-summary + com.liferay.taglib.ui.AssetTagsSummaryTag + JSP + + An array of the asset tag names. + assetTagNames + false + true + + + The Java class of the asset. + className + true + true + + + The Java class primary key of an asset. This is a Java long]]>. + classPK + true + true + + + A message to display before the tag labels. A standard example is tags]]>, which renders as Tags:]]>. + message + false + true + + + The URL of a portlet to display the tags. + portletURL + false + true + + + + breadcrumb + com.liferay.taglib.ui.BreadcrumbTag + JSP + + displayStyle + false + true + + + portletURL + false + true + + + selLayout + false + true + + + selLayoutParam + false + true + + + showCurrentGroup + false + true + + + showCurrentPortlet + false + true + + + showGuestGroup + false + true + + + showLayout + false + true + + + showParentGroups + false + true + + + showPortletBreadcrumb + false + true + + + + Creates a calendar with configurable events. + calendar + com.liferay.taglib.ui.CalendarTag + JSP + + A given set of integers, corresponding to a day of the chosen month, and to mark with a dot. + data + false + true + java.util.Set + + + A day of the month to highlight in the calendar. + day + false + true + int + + + A format for the header. + headerFormat + false + true + java.text.Format + + + A pattern for the calendar header. A possible value is MMM/dd/yyyy]]>. + headerPattern + false + true + + + A month of the year to display at the top of the calendar. + month + true + true + int + + + Whether to display up to six calendar weeks relative to the set day. If the set day of the month is in the latter part of the month, the current month's weeks will be displayed and up to two weeks of the next month will be displayed. The default value is false]]>. + showAllPotentialWeeks + false + true + boolean + + + A year to display at the top of the calendar. + year + true + true + int + + + + Creates an image CAPTCHA with a corresponding verification input. + captcha + com.liferay.taglib.ui.CaptchaTag + JSP + + The source URL for the image CAPTCHA. + url + true + true + + + + categorization-filter + com.liferay.taglib.ui.CategorizationFilterTag + JSP + + assetType + false + true + + + portletURL + false + true + + + + custom-attribute + com.liferay.taglib.ui.CustomAttributeTag + JSP + + className + true + true + + + classPK + true + true + + + editable + false + true + + + label + false + true + + + name + true + true + + + + custom-attribute-list + com.liferay.taglib.ui.CustomAttributeListTag + JSP + + className + true + true + + + classPK + true + true + + + editable + false + true + + + ignoreAttributeNames + false + true + + + label + false + true + + + + custom-attributes-available + com.liferay.taglib.ui.CustomAttributesAvailableTag + JSP + + className + true + true + + + classPK + false + true + + + companyId + false + true + + + ignoreAttributeNames + false + true + + + editable + false + true + + + + ddm-template-selector + com.liferay.taglib.ui.DDMTemplateSelectorTag + JSP + + classNameId + true + true + + + displayStyle + true + true + + + displayStyleGroupId + true + true + + + displayStyles + false + true + + + icon + false + true + + + label + false + true + + + refreshURL + false + true + + + showEmptyOption + false + true + + + + diff + com.liferay.taglib.ui.DiffTag + JSP + + diffResults + true + true + + + sourceName + true + true + + + targetName + true + true + + + + diff-html + com.liferay.taglib.ui.DiffHtmlTag + JSP + + diffHtmlResults + true + true + + + + discussion + com.liferay.taglib.ui.DiscussionTag + JSP + + assetEntryVisible + false + true + + + className + true + true + + + classPK + true + true + + + formAction + true + true + + + formName + false + true + + + hideControls + false + true + + + permissionClassName + false + true + + + permissionClassPK + false + true + + + ratingsEnabled + false + true + + + redirect + false + true + + + Deprecated as of 6.2.0, with no direct replacement + subject + false + true + + + userId + true + true + + + + Creates an error message to display to the user. + error + com.liferay.taglib.ui.ErrorTag + com.liferay.taglib.ui.ErrorTei + JSP + + A class for the exception. + exception + false + true + + + The name of a field on which to focus the error message. + focusField + false + true + + + A key to place in the SessionErrors]]> object to trigger the error message. + key + false + true + + + Explicit message text or a language key name from which to derive text for the message. + message + false + true + + + rowBreak + false + true + + + Whether to translate the message into the user's language. The default value is true]]>. + translateMessage + false + true + boolean + + + + error-marker + com.liferay.taglib.ui.ErrorMarkerTag + JSP + + key + false + true + + + value + false + true + + + + Creates a flag icon that lets users report inappropriate content. + flags + com.liferay.taglib.ui.FlagsTag + JSP + + The flagged asset's Java class name. + className + true + true + + + The flagged asset's entry ID. + classPK + true + true + + + The flagged asset's title. + contentTitle + true + true + + + Whether to show message text as a label next to the flag icon or as a tooltip. The default value is true]]>. + label + false + true + boolean + + + Text to display next to the flag icon. The default text is Flag]]>. + message + false + true + + + The user ID of the user who flagged the asset. + reportedUserId + true + true + + + + flash + com.liferay.taglib.ui.FlashTag + JSP + + align + false + true + + + allowFullScreen + false + true + + + allowScriptAccess + false + true + + + base + false + true + + + bgcolor + false + true + + + devicefont + false + true + + + flashvars + false + true + + + height + false + true + + + id + false + true + + + loop + false + true + + + menu + false + true + + + movie + true + true + + + play + false + true + + + quality + false + true + + + salign + false + true + + + scale + false + true + + + swliveconnect + false + true + + + version + false + true + + + width + false + true + + + wmode + false + true + + + + Creates a navigable form for multiple section forms. It's default navigation is a side navigation box with links to each section. But the navigation can be configured as a progressive step navigation positioned above the form or as vertically stacked accordion style sections that expand when clicked. + form-navigator + com.liferay.taglib.ui.FormNavigatorTag + JSP + + A URL for the form's cancel button. + backURL + false + true + + + The name of each category in the form. + categoryNames + true + true + + + The name of each section within a category. + categorySections + true + true + + + A type of navigation to be used. Options are steps]]> and panel]]>. The default display style is side navigation. + displayStyle + false + true + + + A name for the form. + formName + false + true + + + HTML to append to the navigator. Examples include alternate form buttons, form instructions, or information about the form. + htmlBottom + false + true + + + HTML to prepend to the navigator. + htmlTop + false + true + + + A path to the formSection.jsp]]> file's folder /path/to/jsp/folder/]]>. + jspPath + false + true + + + Whether to show the Submit]]> and Cancel]]> buttons. The default value is true]]>. + showButtons + false + true + boolean + + + + group-search + com.liferay.taglib.ui.GroupSearchTag + JSP + + groupParams + true + true + + + portletURL + true + true + + + rowChecker + false + true + + + + Creates a header that displays its text above a horizontal rule accompanied by a configurable back URL button. + header + com.liferay.taglib.ui.HeaderTag + JSP + + Text to display on mouse over of the back URL. The default value is Back]]>. + backLabel + false + true + + + A URL for navigating back to. + backURL + false + true + + + A CSS class for styling the header component. + cssClass + false + true + + + Whether to escape the header's XML tags. The default value is true]]>. + escapeXml + false + true + boolean + + + Whether to translate the header's title]]> into the localized language. The default value is true]]>. + localizeTitle + false + true + boolean + + + Whether to display the back URL. The default value is true]]>. + showBackURL + false + true + boolean + + + A title to display as the header text. + title + true + true + + + + Creates a fully configurable icon that provides access to current Liferay theme icons. + icon + com.liferay.taglib.ui.IconTag + JSP + + A value for the alt]]> attribute of the embedded img]]> tag. + alt + false + true + + + A role for assistive technologies to interpret for HTML elements that have been used for something other than their intended purpose. For example, the <p>]]> tag could be used for something other than a paragraph. + ariaRole + false + true + + + A CSS class for styling the component. + cssClass + false + true + + + Miscellaneous data to be stored via a map. This data is not shared with the browser. The map holds key value pairs of type <String, Object>]]>. + data + false + true + java.util.Map + + + An icon from a Bootstrap icon CSS Class. Note that any image for the image]]> attribute takes precedence. Icon CSS classes to specify for this attribute can be found at http://marcoceppi.github.io/bootstrap-glyphicons/]]>. + iconCssClass + false + true + + + An ID for the component instance. + id + false + true + + + An image for the icon, from the current theme. The value can be the filename prefix of any image file in the theme's common]]> image folder. This image takes precedence over any icon value set via the iconCssClass]]> attribute. + image + false + true + + + An icon to display on mouse over of the component. The icon image comes from the current theme. The value can be the filename prefix of any image file in the theme's common]]> image folder. + imageHover + false + true + + + Whether to display the message]]> attribute's value as the icon's label. + label + false + true + boolean + + + A language to associate with the icon, to assist search engines and web browsers in finding and rendering the icon appropriately. + lang + false + true + + + A CSS class for styling the icon's URL. + linkCssClass + false + true + + + Whether to translate the icon's message]]> into the user's language. + localizeMessage + false + true + boolean + + + Text to be displayed for the icon on mouse over. + message + false + true + + + An HTTP request method. Possible values are get]]> and post]]>. + method + false + true + + + A function to be called on a user clicking the icon. + onClick + false + true + + + The location of an image file to use in the icon. + src + false + true + + + The location of an image file to use on mouse over of the icon. This value takes precedence over the imageHover]]> attribute. This image takes precedence over icons set with the imageHover]]> attribute. + srcHover + false + true + + + A target window in which to open the URL. The default value is self]]>. Possible values are blank]]>, self]]>, parent]]>, top]]>, and a unique frame's name. + target + false + true + + + Whether to use a tooltip. The default value is true]]>. + toolTip + false + true + boolean + + + A URL to navigate to when the icon is clicked. + url + false + true + + + Whether to open the URL in a dialog window. The default value is false]]>. + useDialog + false + true + boolean + + + + Creates an icon to associate with deactivating an item. + icon-deactivate + com.liferay.taglib.ui.IconDeactivateTag + JSP + + Whether to display a message on the icon's label on mouse over of the icon. The default value is false]]>. + label + false + true + boolean + + + A URL navigated to when the icon is clicked. + url + true + true + + + + Creates a configurable icon to associate with deleting or removing an item. + icon-delete + com.liferay.taglib.ui.IconDeleteTag + JSP + + Text to use in place of the text from the default deletion confirmation message language key are-you-sure-you-want-to-delete-this]]>. If the trash]]> attribute is set to true]]>, no confirmation message is shown. + confirmation + false + true + + + A CSS class for styling the component. + cssClass + false + true + + + An ID for the component instance. + id + false + true + + + An image for the icon, from the current theme. The value can be the filename prefix of any image file in the theme's common]]> image folder. The image takes precedence over any default icon images. + image + false + true + + + Whether to display the message]]> attribute's value as the icon's label. The default value is false]]>. + label + false + true + boolean + + + Text to display on mouse over of the icon. + message + false + true + + + An HTTP request method to invoke. Possible values are get]]> and post]]>. + method + false + true + + + Whether to use the trash icon instead of the remove icon. The default value isfalse]]>. + trash + false + true + boolean + + + A URL navigated to when the icon is clicked. + url + true + true + + + + Creates a help icon that displays a custom message as a tooltip on mouse over of the help icon. + icon-help + com.liferay.taglib.ui.IconHelpTag + JSP + + Text to be displayed on mouse over of the icon. + message + true + true + + + + Creates a list of icons from a list of child components. + icon-list + com.liferay.taglib.ui.IconListTag + JSP + + Whether to render the icon list when there is only one child component. The default value is false]]>. + showWhenSingleIcon + false + true + boolean + + + + Creates an icon menu from a list of child components. + icon-menu + com.liferay.taglib.ui.IconMenuTag + JSP + + A CSS class for styling the component. + cssClass + false + true + + + A position from which to pop up the icon menu dialog in relation to the trigger. The default direction is left]]>. Possible values are up]]>, down]]>, left]]> or right]]>. + direction + false + true + + + Whether to disable the icon menu. + disabled + false + true + boolean + + + Whether to extend the icon menu trigger by wrapping it in a button. The default value is true]]>. + extended + false + true + boolean + + + The location of an image file to use in the icon. + icon + false + true + + + An ID for the component instance. + id + false + true + + + Whether to translate the message to the user's language. The default value is true]]>. + localizeMessage + false + true + boolean + + + The number of items to show in the icon menu before scrolling. The default value is 15. + maxDisplayItems + false + true + int + + + Text to display next to the icon menu trigger. The default value is actions]]>. + message + false + true + + + Whether to add the select]]> CSS class to the icon menu. If set to true]]>, the selected icon is added to the icon menu's trigger when the icon is selected. The default value is false]]>. + select + false + true + boolean + + + Whether to extend the icon menu by default. The default value is false]]>. + showExpanded + false + true + boolean + + + Whether to show an arrow, indicating a popup dialog, next to the icon menu's trigger icon. The default value is true]]>. + showArrow + false + true + boolean + + + Whether to show the icon menu when there is only one icon. The default value is false]]>. + showWhenSingleIcon + false + true + boolean + + + A CSS class for styling the trigger for the icon menu. The default value is btn btn-default]]>. + triggerCssClass + false + true + + + Whether the icon menu drop-down caret points to the direction set by the direction]]> attribute. + useIconCaret + false + true + boolean + + + + input-asset-links + com.liferay.taglib.ui.InputAssetLinksTag + JSP + + assetEntryId + false + true + + + className + false + true + + + classPK + false + true + + + + Creates a configurable input checkbox. + input-checkbox + com.liferay.taglib.ui.InputCheckBoxTag + JSP + + A CSS class for styling the component. + cssClass + false + true + + + Whether the checkbox is selected by default. + defaultValue + false + true + boolean + + + Whether the checkbox is disabled. + disabled + false + true + boolean + + + A name for the checkbox's form. + formName + false + true + + + An ID for the component instance. + id + false + true + + + A function to be called on a user clicking the checkbox. + onClick + false + true + + + A variable name for the component. + param + true + true + + + + Creates a date input field that displays a calendar for date selection. + input-date + com.liferay.taglib.ui.InputDateTag + JSP + + Whether the date field gets focus by default. The default value is false]]>. + autoFocus + false + true + boolean + + + A CSS class for styling the component. + cssClass + false + true + + + A variable name to refer to the day of the component. + dayParam + false + true + + + A day value to display in the input field. + dayValue + false + true + int + + + Whether to disable the namespace for the component. The default value is false]]>. + disableNamespace + false + true + boolean + + + Whether to disable the input field. The default value is false]]>. + disabled + false + true + boolean + + + A day to set as the first day of the week. The default value is Calendar.SUNDAY - 2]]>. + firstDayOfWeek + false + true + int + + + A name for the date input's form. + formName + false + true + + + A variable name to refer to the combined month and year of the component. + monthAndYearParam + false + true + + + A variable name to refer to the month of the component. + monthParam + false + true + + + The numerical value for a month to display in the input field. Integer values for the month start with 0]]>. + monthValue + false + true + int + + + A name for the date input. + name + false + true + + + Whether the component's values can be set to null. + nullable + false + true + + + A variable name to refer to the year of the component. + yearParam + false + true + + + A year value to display in the input field. + yearValue + false + true + int + + + + Creates an input field for editing rich text. + input-editor + com.liferay.taglib.ui.InputEditorTag + JSP + + A map of configuration parameters. The map holds key value pairs of type <String, String>]]>. + configParams + false + true + java.util.Map + + + The ID of a language for the input editor's text. + contentsLanguageId + false + true + + + A CSS class for styling the component. + cssClass + false + true + + + editorImpl + false + true + + + inlineEdit + false + true + + + inlineEditSaveURL + false + true + + + A map of configuration parameters. The map holds key value pairs of <String, String>]]>. + fileBrowserParams + false + true + java.util.Map + + + height + false + true + + + initMethod + false + true + + + A name for the input editor. The default value is editor]]>. + name + false + true + + + A function to be called when the input editor loses focus. + onBlurMethod + false + true + + + A function to be called on a change in the input editor. + onChangeMethod + false + true + + + A function to be called when the input editor gets focus. + onFocusMethod + false + true + + + Whether the field for the input editor is resizable. The default value is true]]>. + resizable + false + true + boolean + + + Whether to skip loading resources necessary for the CKEditor. The default value is false]]>. + skipEditorLoading + false + true + boolean + + + A toolbar for the input editor. The default value is liferay]]>. Possible values are bbcode]]>, creole]]>, editInPlace]]>, email]]>, liferay]]>, liferayArticle]]>, phone]]>, simple]]>, and tablet]]>. + toolbarSet + false + true + + + width + false + true + + + + input-field + com.liferay.taglib.ui.InputFieldTag + JSP + + autoComplete + false + true + + + autoFocus + false + true + + + autoSize + false + true + + + bean + false + true + + + cssClass + false + true + + + dateTogglerCheckboxLabel + false + true + + + defaultLanguageId + false + true + + + defaultValue + false + true + + + disabled + false + true + + + field + true + true + + + fieldParam + false + true + + + formName + false + true + + + format + false + true + + + id + false + true + + + ignoreRequestValue + false + true + + + languageId + false + true + + + model + true + true + + + placeholder + false + true + + + + input-localized + com.liferay.taglib.ui.InputLocalizedTag + JSP + + autoFocus + false + true + + + autoSize + false + true + + + availableLocales + false + true + + + cssClass + false + true + + + defaultLanguageId + false + true + + + disabled + false + true + + + displayWidth + false + true + + + formName + false + true + + + id + false + true + + + ignoreRequestValue + false + true + + + languageId + false + true + + + maxLength + false + true + + + name + true + true + + + type + false + true + + + xml + true + true + + true + + + Creates an input move boxes component comprised of two columns of key value pairs that can be rearranged. + input-move-boxes + com.liferay.taglib.ui.InputMoveBoxesTag + JSP + + A CSS class for styling the component. + cssClass + false + true + + + A name for the left box. + leftBoxName + true + true + + + A list of key value pairs for the left box. + leftList + true + true + java.util.List + + + A function to be called on a change in selection in the left list. + leftOnChange + false + true + + + Whether the left list can be reordered. The default value is false]]>. + leftReorder + false + true + boolean + + + A title to display at the top of the right box. + leftTitle + true + true + + + A name for the right box. + rightBoxName + true + true + + + A list of key value pairs for the right box. + rightList + true + true + java.util.List + + + A function to be called on a change in selection in the right list. + rightOnChange + false + true + + + Whether the right list can be reordered. The default value is false]]>. + rightReorder + false + true + boolean + + + A title to display at the top of the right box. + rightTitle + true + true + + + + input-permissions + com.liferay.taglib.ui.InputPermissionsTag + JSP + + formName + false + true + + + modelName + false + true + + + + input-permissions-params + com.liferay.taglib.ui.InputPermissionsParamsTag + JSP + + modelName + true + true + + + + input-repeat + com.liferay.taglib.ui.InputRepeatTag + JSP + + cssClass + false + true + + + event + false + true + + + + input-resource + com.liferay.taglib.ui.InputResourceTag + JSP + + cssClass + false + true + + + id + false + true + + + title + false + true + + + url + true + true + + + + input-scheduler + com.liferay.taglib.ui.InputSchedulerTag + JSP + + + Creates a configurable search box. + input-search + com.liferay.taglib.ui.InputSearchTag + JSP + + Whether the search field gets focus by default. The default value is false]]>. + autoFocus + false + true + boolean + + + A text value for the search button's label. The default value is Search]]>. + buttonLabel + false + true + + + A CSS class for styling the component. + cssClass + false + true + + + An ID for the component instance. The default value is displayTerms.KEYWORDS]]>. + id + false + true + + + A name for the search box. The default value is displayTerms.KEYWORDS]]>. + name + false + true + + + Placeholder text for the search field. The default value is the value of the buttonLabel]]> attribute. + placeholder + false + true + + + Whether to show the search button. The default value is true]]>. + showButton + false + true + boolean + + + A title for the search box. + title + false + true + + + Whether to use a namespace with the search button. The default value is true]]>. + useNamespace + false + true + boolean + + + + Creates a select input component with yes or no options. + input-select + com.liferay.taglib.ui.InputSelectTag + JSP + + A CSS class for styling the component. + cssClass + false + true + + + Whether to select yes]]> as the input's default value. + defaultValue + false + true + boolean + + + Whether to disable input. + disabled + false + true + boolean + + + A name for the input select's form. + formName + false + true + + + A variable name for the component. + param + true + true + + + + Creates a configurable text area input field. + input-textarea + com.liferay.taglib.ui.InputTextAreaTag + JSP + + A CSS class for styling the component. + cssClass + false + true + + + Text to display in the text area. + defaultValue + false + true + + + Whether to disable input. The default value is false]]>. + disabled + false + true + boolean + + + A variable name for the component. + param + true + true + + + + Creates a time input field that provides a scrollable dropdown list of hours, in intervals designated by the minuteInterval]]> attribute. + input-time + com.liferay.taglib.ui.InputTimeTag + JSP + + The name of the AM/PM parameter for the time input. An acceptable value is ampm]]>. + amPmParam + true + true + + + A time to AM or PM. Acceptable values are 0]]> for AM and 1]]> for PM. The default value is 0]]>. + amPmValue + false + true + int + + + A CSS class for styling the time input. + cssClass + false + true + + + A date parameter for the time input. An acceptable value is date]]>. + dateParam + false + true + + + A date to associate with the time displayed. + dateValue + false + true + java.util.Date + + + Whether the input field is disabled. + disabled + false + true + boolean + + + The name of the hour parameter for the component. An acceptable value is hour]]>. + hourParam + true + true + + + An hour value for the time displayed. The default value is 12]]>. + hourValue + false + true + int + + + A minute interval displayed in the input. The default value is 30]]>. + minuteInterval + false + true + int + + + The name of the minute parameter for the component. An acceptable value is minute]]>. + minuteParam + true + true + + + A minute value for the time displayed. The default value is 00]]>. + minuteValue + false + true + int + + + A name for the time input. + name + false + true + + + + Creates a configurable timezone drop-down menu. + input-time-zone + com.liferay.taglib.ui.InputTimeZoneTag + JSP + + Whether the field gets focus by default. + autoFocus + false + true + boolean + + + A CSS class for styling the component. + cssClass + false + true + + + Whether to consider daylight savings for the times. The default value is true]]>. + daylight + false + true + boolean + + + Whether the field is disabled. + disabled + false + true + boolean + + + A style number corresponding to the time zone. A value of 0]]> displays the time zone's abbreviated name and a value of 1]]> displays its full name, e.g. "Pacific Standard Time." The default value is 0]]>. + displayStyle + false + true + int + + + A name for the component. + name + true + true + + + Whether the times can be null. + nullable + false + true + boolean + + + The ID of a time zone to associate with the component. For example, setting the value to PST]]> associates the component with the Pacific Standard Time zone. + value + false + true + + + + journal-article + com.liferay.taglib.ui.JournalArticleTag + JSP + + articleId + false + true + + + articlePage + false + true + + + articleResourcePrimKey + false + true + + + groupId + false + true + + + languageId + false + true + + + showAvailableLocales + false + true + + + showTitle + false + true + + + templateId + false + true + + + xmlRequest + false + true + + + + journal-content-search + com.liferay.taglib.ui.JournalContentSearchTag + JSP + + showListed + false + true + + + targetPortletId + false + true + + + type + false + true + + + + language + com.liferay.taglib.ui.LanguageTag + JSP + + displayCurrentLocale + false + true + + + displayStyle + false + true + + + formAction + false + true + + + formName + false + true + + + languageId + false + true + + + languageIds + false + true + + + name + false + true + + + + logo-selector + com.liferay.taglib.ui.LogoSelectorTag + JSP + + currentLogoURL + false + true + + + defaultLogoURL + false + true + + + editLogoURL + false + true + + + imageId + false + true + + + logoDisplaySelector + false + true + + + showBackground + false + true + + + + membership-policy-error + com.liferay.taglib.ui.MembershipPolicyErrorTag + JSP + + + Creates a message to display to the user. + message + com.liferay.taglib.ui.MessageTag + JSP + + Arguments for the language key, if the language key is configured to recieve arguments. + arguments + false + true + + + The name of a language key from which to derive the message to be displayed. + key + true + true + + + Whether to translate the language key value into the user's language. The default value is true]]>. + localizeKey + false + true + boolean + + + Whether to translate the arguments into the user's language. The default value is true]]>. + translateArguments + false + true + boolean + + + unicode + false + true + boolean + + + + my-sites + com.liferay.taglib.ui.MySitesTag + JSP + + classNames + false + true + + + cssClass + false + true + + + includeControlPanel + false + true + + + max + false + true + + + + navigation + com.liferay.taglib.ui.NavigationTag + JSP + + bulletStyle + false + true + + + displayStyle + false + true + + + headerType + false + true + + + includedLayouts + false + true + + + nestedChildren + false + true + + + preview + false + true + + + rootLayoutLevel + false + true + + + rootLayoutType + false + true + + + + Creates a page iterator for paginating through lists of items. + page-iterator + com.liferay.taglib.ui.PageIteratorTag + JSP + + Which page of items to display (e.g., first, second, third, etc.). + cur + true + true + int + + + A variable name to refer to the cur]]> value of the component. + curParam + true + true + + + The number of items to display per page. + delta + false + true + int + + + Whether the user can choose the number of items displayed per page. The default value is false]]>. + deltaConfigurable + false + true + boolean + + + A variable name to refer to the delta value of the component. + deltaParam + false + true + + + A name for the form. + formName + false + true + + + An ID for the component instance. + id + false + true + + + JavaScript to be called when the first]]>, previous]]>, next]]>, or last]]> links are clicked if the URL property is not set. + jsCall + false + true + + + A maximum number of pages to iterate through. + maxPages + false + true + int + + + A target for the first]]>, previous]]>, next]]>, and last]]> link buttons. + target + false + true + + + The total number of items in the iterator. + total + true + true + int + + + A type of iterator to display. Options are approximate]]>, article]]>, more]]>, and regular]]>. + type + false + true + + + A base URL for the iterator. Parameters are added to and removed from this URL as the user navigates through pages. + url + false + true + + + + Creates a collapsible panel for housing content. + panel + com.liferay.taglib.ui.PanelTag + JSP + + Whether the panel can be collapsed. The default value is true]]>. + collapsible + false + true + boolean + + + A CSS class for styling the component. + cssClass + false + true + + + A default state for the component. Possible values are open]]> and any string other than open. Any string other than open]]> collapses the panel. The default value is open]]>. + defaultState + false + true + + + Whether the panel is extended. The default value is false]]>. + extended + false + true + boolean + + + Text to display as a help tool tip on mouse over of the panel's help icon. + helpMessage + false + true + + + An icon to display next to the panel's title. The icon can be specified using the name of one of the Bootstrap icon CSS classes found at http://marcoceppi.github.io/bootstrap-glyphicons/]]>. + iconCssClass + false + true + + + An ID for the component instance. + id + false + true + + + The ID of the component that contains the panel. If a liferay-ui:panel-container]]> is used as the container for the panel, its ID is used as the value for the parentID]]>. + parentId + false + true + + + Whether to remember the component's state and persist it to the database. The default value is false]]>. + persistState + false + true + boolean + + + A state for the component. Possible values are open]]> and any string other than open. Any string other than open]]> collapses the panel. + state + false + true + + + A title to display at the top of the panel. + title + true + true + + + + Creates a collapsible container to house liferay-ui:panel]]> components. + panel-container + com.liferay.taglib.ui.PanelContainerTag + JSP + + Whether only one panel can be shown at a time. As one panel is opened, the others close, creating an accordian effect. The default value is false]]>. + accordion + false + true + boolean + + + A CSS class for styling the component. + cssClass + false + true + + + Whether to extend the interface with additional styling. The default value is false]]>. + extended + false + true + boolean + + + An ID for the component instance. + id + false + true + + + Whether to remember the component's state and persist it to the database. The default value is false]]>. + persistState + false + true + boolean + + + + param + com.liferay.taglib.util.ParamTag + JSP + + name + true + true + + + value + true + true + + + + Renders a PNG image with the source given for the image]]> attribute. + png-image + com.liferay.taglib.ui.PngImageTag + JSP + + The height of the image in pixels. A possible value would be 16]]>. px]]> is then appended to the end of the value. + height + true + true + int + + + The location of a PNG image file to use. + image + true + true + + + The height of the image in pixels. A possible value would be 16]]>. px]]> is then appended to the end of the value. + width + true + true + int + + + + progress + com.liferay.taglib.ui.ProgressTag + JSP + + height + false + true + + + id + true + true + + + message + false + true + + + sessionKey + true + true + + + updatePeriod + false + true + + + + ratings + com.liferay.taglib.ui.RatingsTag + JSP + + className + true + true + + + classPK + true + true + + + numberOfStars + false + true + + + ratingsEntry + false + true + + + ratingsStats + false + true + + + type + false + true + + + url + false + true + + + + ratings-score + com.liferay.taglib.ui.RatingsScoreTag + JSP + + score + true + true + + + + restore-entry + com.liferay.taglib.ui.RestoreEntryTag + JSP + + duplicateEntryAction + false + true + + + overrideMessage + false + true + + + renameMessage + false + true + + + restoreEntryAction + false + true + + + + Creates a clickable link and/or icon to an RSS feed document. + rss + com.liferay.taglib.ui.RSSTag + JSP + + A default maximum number of items to display. The default value is 20]]>. + delta + false + true + int + + + A default style to display. + displayStyle + false + true + + + A default format for the RSS feed. Options are atom_1.0]]>, rss_1.0]]>, and rss_2.0]]>. + feedType + false + true + + + A message to display next to the RSS icon. + message + false + true + + + A name for the RSS feed. + name + false + true + + + A URL from which to retrieve feed information. + resourceURL + false + true + + + The URL for an RSS feed file. + url + false + true + + + + Creates a configuration component for users to define RSS settings, such as how many articles to display. + rss-settings + com.liferay.taglib.ui.RSSSettingsTag + JSP + + A default maximum number of items to display. The default value is 20]]>. + delta + false + true + int + + + A default style to display. + displayStyle + false + true + + + Available RSS display styles from which the user can choose. Options are abstract]]>, full-content]]>, and title]]>. + displayStyles + false + true + + + Whether users are able to subscribe. Default value is false]]>. + enabled + false + true + boolean + + + A default format for the RSS feed. Options are atom_1.0]]>, rss_1.0]]>, and rss_2.0]]>. + feedType + false + true + + + A name for the component. + name + false + true + + + Whether the RSS feed has a name. The default value is false]]>. + nameEnabled + false + true + boolean + + + + Creates a search form, with an additional select input to set the scope of the search. + search + com.liferay.taglib.ui.SearchTag + JSP + + + Creates a grid for displaying a list of objects and their properties. + search-container + com.liferay.taglib.ui.SearchContainerTag + com.liferay.taglib.ui.SearchContainerTei + JSP + + A variable for the search container's pagination. Different pagination variables ensure independent pagination when multiple search containers are on a JSP. + curParam + false + true + + + The number of items to show on each search container page. + delta + false + true + int + + + The delta]]> attribute as configurable by users. + deltaConfigurable + false + true + + + deltaParam + false + true + + + displayTerms + false + true + + + A message displayed when the search container is empty. + emptyResultsMessage + false + true + + + headerNames + false + true + + + hover + false + true + + + id + false + true + + + iteratorURL + false + true + + + orderByCol + false + true + + + orderByColParam + false + true + + + orderByComparator + false + true + + + An order type for the columns, either ascending or descending. Values are asc]]> or desc]]>. + orderByType + false + true + + + orderByTypeParam + false + true + + + Inserts a checkbox column in the search container. Value must be a RowChecker]]> object. + rowChecker + false + true + + + searchContainer + false + true + + + searchTerms + false + true + + + The total number of objects in the search container. + total + false + true + int + + + A variable name for the results of the total]]> attribute. The default is total]]>. + totalVar + false + true + + + A variable name for the SearchContainer]]> object. The default is searchContainer]]>. + var + false + true + + + + search-container-column-button + com.liferay.taglib.ui.SearchContainerColumnButtonTag + JSP + + align + false + true + + + colspan + false + true + + + cssClass + false + true + + + href + true + true + + + index + false + true + + + name + false + true + + + valign + false + true + + + + Creates a date column in a search container. + search-container-column-date + com.liferay.taglib.ui.SearchContainerColumnDateTag + JSP + + A horizontal alignment for the column contents. The default is left]]>. + align + false + true + + + The number of columns to span. The default is 1]]>. + colspan + false + true + int + + + A CSS class for styling the column. + cssClass + false + true + + + A URL for the items in the column. + href + false + true + + + index + false + true + + + A name for the column. + name + false + true + + + Whether to set the column as sortable. The default value is false]]>. + orderable + false + true + boolean + + + An object's property by which to sort the column. + orderableProperty + false + true + + + A property to request from the row object. + property + false + true + + + A vertical alignment for the column contents. The default is middle]]>. + valign + false + true + + + A value for the column. + value + false + true + + + + Creates a column in a search container with the contents of a JSP file. + search-container-column-jsp + com.liferay.taglib.ui.SearchContainerColumnJSPTag + JSP + + A horizontal alignment for the column contents. The default is left]]>. + align + false + true + + + The number of columns to span. The default is 1]]>. + colspan + false + true + int + + + A CSS class for styling the column. + cssClass + false + true + + + index + false + true + + + name + false + true + + + The JSP file's location. + path + true + true + + + valign + false + true + + + + Creates a column in a search container for the workflow status. + search-container-column-status + com.liferay.taglib.ui.SearchContainerColumnStatusTag + JSP + + A horizontal alignment for the column contents. The default is left]]>. + align + false + true + + + The number of columns to span. The default is 1]]>. + colspan + false + true + int + + + A CSS class for styling the column. + cssClass + false + true + + + A URL for the column's contents. + href + false + true + + + index + false + true + + + name + false + true + + + Whether to set the column as sortable. The default value is false]]>. + orderable + false + true + boolean + + + An object's property by which to sort the column. + orderableProperty + false + true + + + An object's property to use for the column. + property + false + true + + + A vertical alignment for the column contents. The default is middle]]>. + valign + false + true + + + A workflow status for the item. + status + false + true + + + statusByUserId + false + true + + + statusDate + false + true + + + + Creates a text column in a search container. + search-container-column-text + com.liferay.taglib.ui.SearchContainerColumnTextTag + com.liferay.taglib.ui.SearchContainerColumnTextTei + JSP + + A horizontal alignment for the column contents. + align + false + true + + + A string buffer variable for constructing a URL in a scriptlet. + buffer + false + true + + + The number of columns to span. The default is 1]]>. + colspan + false + true + int + + + A CSS class for styling the column. + cssClass + false + true + + + href + false + true + + + index + false + true + + + name + false + true + + + Whether to set the column as sortable. The default value is false]]>. + orderable + false + true + boolean + + + An object's property by which to sort the column. + orderableProperty + false + true + + + property + false + true + + + target + false + true + + + title + false + true + + + Whether to automatically translate values. The default value is false]]>. + translate + false + true + boolean + + + A vertical alignment for the column contents. The default is middle]]>. + valign + false + true + + + value + false + true + + + + The list of objects to display in the search container. + search-container-results + com.liferay.taglib.ui.SearchContainerResultsTag + com.liferay.taglib.ui.SearchContainerResultsTei + JSP + + A list of objects to display in the search container. + results + false + true + + + A variable to use for the results. + resultsVar + false + true + + + Deprecated as of 6.2.0, replaced by liferay-ui:search-container#total + total + false + true + + + Deprecated as of 6.2.0, replaced by liferay-ui:search-container#totalVar + totalVar + false + true + + + + Creates rows in the search container for each object returned by liferay-ui:search-container-results]]>. + search-container-row + com.liferay.taglib.ui.SearchContainerRowTag + com.liferay.taglib.ui.SearchContainerRowTei + JSP + + bold + false + true + + + The class name of the objects to display in rows. + className + true + true + + + The returned model instances as HTML escaped. + escapedModel + false + true + + + A variable name to use for the rows' index. + indexVar + false + true + + + A property to use as the primary key for the object type in the className]]> attribute. + keyProperty + false + true + + + A variable name to use for each object as the search container iterates through the objects returned by liferay-ui:search-container-results]]>. + modelVar + false + true + + + A model property to use as the row ID. + rowIdProperty + false + true + + + A variable name to use for the rows. + rowVar + false + true + + + servletContext + false + true + + + stringKey + false + true + + + + Creates parameters for rows in the search container. The liferay-ui:search-container-row]]> tag is required. + search-container-row-parameter + com.liferay.taglib.ui.SearchContainerRowParameterTag + JSP + + A name for the row parameter. + name + true + true + + + A value for the row parameter. + value + true + true + + + + search-form + com.liferay.taglib.ui.SearchFormTag + JSP + + page + true + true + + + searchContainer + false + true + + + servletContext + false + true + + + showAddButton + false + true + + + + Creates a search results page iterator with an optional paginator. + search-iterator + com.liferay.taglib.ui.SearchIteratorTag + JSP + + Whether to add a liferay-ui:search-paginator]]> to the search container. The default value is true]]>. + paginate + false + true + boolean + + + All configurable properties of the search container, such as cur]]> and curParam]]>. These properties are set with searchContainer.getCur()]]> and searchContainer.getCurParam()]]> respectively. + searchContainer + false + true + + + A type of iterator to display. Options are approximate]]>, article]]>, more]]>, and regular]]>. + type + false + true + + + + Creates a page iterator to paginate through search results + search-paginator + com.liferay.taglib.ui.SearchPaginatorTag + JSP + + An ID for the component instance. + id + false + true + + + All configurable porperties of the search container, such as cur]]> and curParam]]>. These properties are set with searchContainer.getCur()]]> and searchContainer.getCurParam()]]> respectively. + searchContainer + true + true + + + A type of iterator to display. Options are approximate]]>, article]]>, more]]>, and regular]]>. + type + false + true + + + + search-speed + com.liferay.taglib.ui.SearchSpeedTag + JSP + + hits + true + true + + + searchContainer + true + true + + + + Creates a search instance that can be toggled between basic and advanced search. + search-toggle + com.liferay.taglib.ui.SearchToggleTag + JSP + + Whether the search input field is automatically focused. The default value is false]]>. + autoFocus + false + true + boolean + + + A label for the search button such as Search]]> or Go]]>. + buttonLabel + false + true + + + Terms to be used and displayed through the search instance. Term examples include keywords]]>, advancedSearch]]>, and description]]>. + displayTerms + true + true + + + The component instance's ID. + id + true + true + + + width + false + true + + + + section + com.liferay.taglib.ui.SectionTag + com.liferay.taglib.ui.SectionTei + JSP + + + sites-directory + com.liferay.taglib.ui.SitesDirectoryTag + JSP + + displayStyle + false + true + + + sites + false + true + + + + social-activities + com.liferay.taglib.ui.SocialActivitiesTag + JSP + + activities + false + true + + + className + false + true + + + classPK + false + true + + + displayRSSFeed + false + true + + + feedDelta + false + true + + + feedDisplayStyle + false + true + + + feedEnabled + false + true + + + feedLink + false + true + + + feedLinkMessage + false + true + + + feedTitle + false + true + + + feedType + false + true + + + + social-bookmark + com.liferay.taglib.ui.SocialBookmarkTag + JSP + + contentId + false + true + + + target + false + true + + + title + true + true + + + type + true + true + + + url + true + true + + + + social-bookmarks + com.liferay.taglib.ui.SocialBookmarksTag + JSP + + contentId + false + true + + + displayStyle + false + true + + + target + false + true + + + title + true + true + + + types + false + true + + + url + true + true + + + + staging + com.liferay.taglib.ui.StagingTag + JSP + + cssClass + false + true + + + extended + false + true + + + groupId + false + true + + + icon + false + true + + + layoutSetBranchId + false + true + + + message + false + true + + + onlyActions + false + true + + + privateLayout + false + true + + + selPlid + false + true + + + showManageBranches + false + true + + + + Creates a success message to display to the user. + success + com.liferay.taglib.ui.SuccessTag + empty + + A key to be placed in the SessionMessages]]> object to trigger the success message. + key + true + true + + + Explicit message text or the name of a language key from which to derive the message text. + message + true + true + + + Whether to translate the success message into the user's language. The default value is true]]>. + translateMessage + false + true + boolean + + + + table-iterator + com.liferay.taglib.ui.TableIteratorTag + com.liferay.taglib.ui.TableIteratorTei + JSP + + bodyPage + false + true + + + list + true + true + + + listType + true + true + + + rowBreak + false + true + + + rowLength + true + true + + + rowPadding + false + true + + + rowValign + false + true + + + width + false + true + + + + Creates a tabbed UI of section dividers that each house their own content. + tabs + com.liferay.taglib.ui.TabsTag + JSP + + + A label for the back URL. + backLabel + false + true + + + A URL for navigating back to. + backURL + false + true + + + A name for the tab's form. + formName + false + true + + + The names of the tabs. Each name must be separated by a comma with no spaces. + names + true + true + + + A function to be called on a user clicking any of the tabs. + onClick + false + true + + + A variable for the component. + param + false + true + + + A URL to refer to the portlet that contains the component. + portletURL + false + true + + + Whether the page refreshes when a tab is clicked. + refresh + false + true + boolean + + + Tab values that must follow the same order as the names]]> attribute. Each value must be separated by a comma with no spaces. + tabsValues + false + true + + + A design type for the tabs. Possible values are tabs]]> and pills]]>. + type + false + true + + + A URL to which all the tabs are linked when clicked. You can also set each tab's URL individually using url[number]]]> attribute. + url + false + true + + + url0 + false + true + + + A URL to which the second tab is linked when clicked. + url1 + false + true + + + A URL to which the third tab is linked when clicked + url2 + false + true + + + A URL to which the fourth tab is linked when clicked + url3 + false + true + + + A URL to which the fifth tab is linked when clicked + url4 + false + true + + + A URL to which the sixth tab is linked when clicked + url5 + false + true + + + A URL to which the seventh tab is linked when clicked + url6 + false + true + + + A URL to which the eighth tab is linked when clicked + url7 + false + true + + + A URL to which the ninth tab is linked when clicked + url8 + false + true + + + A URL to which the tenth tab is linked when clicked + url9 + false + true + + + An active tab from the value given in the attribute tabsValues]]>. No matter which tab a user selects, the tab given for this value always remains active. + value + false + true + + + + Creates a component that toggles the visibility of the content of the component matching the given id]]>. Default icons are used as the component's default mechanism for showing and hiding the content. + toggle + com.liferay.taglib.ui.ToggleTag + JSP + + Whether to initially show content by default. The default value is true]]>. + defaultShowContent + false + true + boolean + + + An icon to use as the mechanism for hiding the content. You can specify the location of an image file to use in the icon; otherwise a default icon is used. + hideImage + false + true + + + Text to display as a link for hiding the content. It overrides the hideImage]]> attribute. Note that the showMessage]]> attribute must also be configured in order for the hide message to render. + hideMessage + false + true + + + The ID of a component instance whose content's visibility to toggle. + id + true + true + + + An icon to use as the mechanism for showing the content. You can specify the location of an image file to use in the icon; otherwise a default icon is used. + showImage + false + true + + + A link to use as the mechanism for showing the content. The text value of this attribute is used as the link's text. The message takes precedence over showing an image, via the showImage]]> attribute. If you specify a showMessage]]> attribute, you should also specify the hideMessage]]> attribute; a null]]> is otherwise displayed for the text of the hide link. + showMessage + false + true + + + Text to be prefixed to the Toggle()]]> function that is called to toggle visibility of the content. If this is not configured, a random key is generated and prefixed to the Toggle()]]> function. For example, a value of run]]> would result in a function named runToggle()]]>. + stateVar + false + true + + + + toggle-area + com.liferay.taglib.ui.ToggleAreaTag + JSP + + align + false + true + + + defaultShowContent + false + true + + + hideImage + false + true + + + hideMessage + false + true + + + id + false + true + + + showImage + false + true + + + showMessage + false + true + + + stateVar + false + true + + + + toggle-value + com.liferay.taglib.ui.ToggleValueTag + JSP + + defaultValue + false + true + + + id + true + true + + + + Creates a component for users to permanently delete items such as images, articles, etc. from the recycle bin. + trash-empty + com.liferay.taglib.ui.TrashEmptyTag + empty + + A message to display to confirm that the user wants to remove the item(s) from the recycle bin. + confirmMessage + false + true + + + A message to be used for the empty-trash]]> button and link. + emptyMessage + false + true + + + A message to display to give users information about removing items from the recycle bin. + infoMessage + false + true + + + A URL for the empty-trash]]> button/link. + portletURL + true + true + + + The number of items to be removed from the recycle bin. + totalEntries + true + true + int + + + + Creates a message confirming items were moved to the recycle bin and presenting an option to restore them. + trash-undo + com.liferay.taglib.ui.TrashUndoTag + empty + + The URL of the undo link. + portletURL + true + true + + + A redirect URL. + redirect + false + true + + + + upload-progress + com.liferay.taglib.ui.UploadProgressTag + JSP + + height + false + true + + + id + true + true + + + message + false + true + + + redirect + false + true + + + updatePeriod + false + true + + + + user-display + com.liferay.taglib.ui.UserDisplayTag + com.liferay.taglib.ui.UserDisplayTei + JSP + + displayStyle + false + true + + + url + false + true + + + userId + true + true + + + userName + false + true + + + + user-search + com.liferay.taglib.ui.UserSearchTag + JSP + + portletURL + true + true + + + rowChecker + false + true + + + userParams + true + true + + + + webdav + com.liferay.taglib.ui.WebDAVTag + JSP + + path + true + true + + + + write + com.liferay.taglib.ui.WriteTag + JSP + + bean + true + true + + + property + true + true + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-util.tld b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-util.tld new file mode 100644 index 0000000..72a4caf --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/tld/liferay-util.tld @@ -0,0 +1,141 @@ + + + + + 1.2 + 1.1 + liferay-util + http://liferay.com/tld/util + + body-bottom + com.liferay.taglib.util.BodyBottomTag + JSP + + outputKey + false + true + + + + body-top + com.liferay.taglib.util.BodyTopTag + JSP + + outputKey + false + true + + + + buffer + com.liferay.taglib.util.BufferTag + com.liferay.taglib.util.BufferTei + JSP + + var + true + true + + + + get-url + com.liferay.taglib.util.GetUrlTag + com.liferay.taglib.util.GetUrlTei + JSP + + expires + false + true + + + url + true + true + + + var + false + true + + + + html-bottom + com.liferay.taglib.util.HtmlBottomTag + JSP + + outputKey + false + true + + + position + false + true + + + + html-top + com.liferay.taglib.util.HtmlTopTag + JSP + + outputKey + false + true + + + position + false + true + + + + include + com.liferay.taglib.util.IncludeTag + JSP + + page + true + true + + + portletId + false + true + + + servletContext + false + true + + + strict + false + true + + + useCustomPage + false + true + + + + param + com.liferay.taglib.util.ParamTag + JSP + + name + true + true + + + value + true + true + + + + whitespace-remover + com.liferay.taglib.util.WhitespaceRemoverTag + JSP + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/WEB-INF/web.xml b/portlets/sicilia-login-portlet/docroot/WEB-INF/web.xml new file mode 100644 index 0000000..1aa8cdb --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/WEB-INF/web.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/docroot/html/configurazione/view.jsp b/portlets/sicilia-login-portlet/docroot/html/configurazione/view.jsp new file mode 100644 index 0000000..9273604 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/html/configurazione/view.jsp @@ -0,0 +1,21 @@ +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@page import="it.mwg.sicilia.login.service.ConfigurazioneLocalServiceUtil"%> +<%@include file="/html/init.jsp"%> +<% +long companyId = company.getCompanyId(); +%> + + +

Configurazione

+ + + + + + + + + + diff --git a/portlets/sicilia-login-portlet/docroot/html/init.jsp b/portlets/sicilia-login-portlet/docroot/html/init.jsp new file mode 100644 index 0000000..e4e7fe3 --- /dev/null +++ b/portlets/sicilia-login-portlet/docroot/html/init.jsp @@ -0,0 +1,17 @@ +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> +<%@taglib uri="http://liferay.com/tld/aui" prefix="aui"%> +<%@taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet"%> +<%@taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%> +<%@taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%> +<%@taglib uri="http://liferay.com/tld/util" prefix="liferay-util"%> +<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%> +<%@page import="com.liferay.portlet.PortletURLUtil"%> +<%@page import="javax.portlet.PortletURL"%> + + +<% +PortletURL portletURL = PortletURLUtil.getCurrent(liferayPortletRequest, liferayPortletResponse); +PortletURL iteratorURL = liferayPortletResponse.createRenderURL(); +%> diff --git a/portlets/sicilia-login-portlet/docroot/icon.png b/portlets/sicilia-login-portlet/docroot/icon.png new file mode 100644 index 0000000..807b862 Binary files /dev/null and b/portlets/sicilia-login-portlet/docroot/icon.png differ diff --git a/portlets/sicilia-login-portlet/ivy.xml b/portlets/sicilia-login-portlet/ivy.xml new file mode 100644 index 0000000..d310b15 --- /dev/null +++ b/portlets/sicilia-login-portlet/ivy.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/portlets/sicilia-login-portlet/ivy.xml.MD5 b/portlets/sicilia-login-portlet/ivy.xml.MD5 new file mode 100644 index 0000000..5b95aae --- /dev/null +++ b/portlets/sicilia-login-portlet/ivy.xml.MD5 @@ -0,0 +1 @@ +b889523c7b480c442409fa84bf08140c diff --git a/portlets/sicilia-login-portlet/test/integration/arquillian.xml b/portlets/sicilia-login-portlet/test/integration/arquillian.xml new file mode 100644 index 0000000..9413609 --- /dev/null +++ b/portlets/sicilia-login-portlet/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + 8099 + tomcat + tomcat + + + \ No newline at end of file diff --git a/shared/.ant-targets-build.xml b/shared/.ant-targets-build.xml new file mode 100644 index 0000000..b7a31d2 --- /dev/null +++ b/shared/.ant-targets-build.xml @@ -0,0 +1,50 @@ +build-common.setup-eclipse +build-css +build-db +build-service +build-upgrade-table +build-wsdl +build-xsd +clean +compile +compile-jsp +compile-test +create +deploy +direct-deploy +direct-deploy-ext-cmd +direct-deploy-hook-cmd +direct-deploy-layouttpl-cmd +direct-deploy-portlet-cmd +direct-deploy-theme-cmd +direct-deploy-web-cmd +format-javadoc +format-source +inspect-plugins +install +jar +jar-javadoc +jar-source +javadoc +prepare-upgrade-table +print-current-time +print-stale-snapshot +publish +publish-local-m2-release +publish-local-m2-snapshot +publish-remote-m2-release +publish-remote-m2-snapshot +release +run-cpd +run-pmd +setup-arquillian +setup-eclipse +setup-jrebel +sort-xml-attributes +test +test-class-group +test-integration +test-package +test-unit +war +watch diff --git a/shared/build-common-shared.xml b/shared/build-common-shared.xml new file mode 100644 index 0000000..163aedd --- /dev/null +++ b/shared/build-common-shared.xml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/shared/build.xml b/shared/build.xml new file mode 100644 index 0000000..816d62e --- /dev/null +++ b/shared/build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/shared/portal-http-service/.classpath b/shared/portal-http-service/.classpath new file mode 100644 index 0000000..94698ba --- /dev/null +++ b/shared/portal-http-service/.classpath @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shared/portal-http-service/.project b/shared/portal-http-service/.project new file mode 100644 index 0000000..13f5c6f --- /dev/null +++ b/shared/portal-http-service/.project @@ -0,0 +1,28 @@ + + + portal-http-service-6.2.x + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + 1669365750342 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/shared/portal-http-service/bnd.bnd b/shared/portal-http-service/bnd.bnd new file mode 100644 index 0000000..ffa99e0 --- /dev/null +++ b/shared/portal-http-service/bnd.bnd @@ -0,0 +1,10 @@ +Bundle-Activator: com.liferay.portal.http.service.internal.HttpServiceBundleActivator +Bundle-Name: Liferay Portal HTTP Service +Bundle-SymbolicName: com.liferay.portal.http.service +Bundle-Version: 1.0.2 +Export-Package:\ + com.liferay.portal.http.service.servlet,\ + com.liferay.portal.http.service.ws.axis +Include-Resource: classes +Private-Package:\ + com.liferay.portal.http.service.internal.* \ No newline at end of file diff --git a/shared/portal-http-service/build.xml b/shared/portal-http-service/build.xml new file mode 100644 index 0000000..72eea64 --- /dev/null +++ b/shared/portal-http-service/build.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shared/portal-http-service/ivy.xml b/shared/portal-http-service/ivy.xml new file mode 100644 index 0000000..7dfbea2 --- /dev/null +++ b/shared/portal-http-service/ivy.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shared/portal-http-service/ivy.xml.MD5 b/shared/portal-http-service/ivy.xml.MD5 new file mode 100644 index 0000000..71ae448 --- /dev/null +++ b/shared/portal-http-service/ivy.xml.MD5 @@ -0,0 +1 @@ +0610fea5fe877e1fd1f04ae117dc6030 diff --git a/shared/portal-http-service/lib/org.eclipse.osgi.services.jar b/shared/portal-http-service/lib/org.eclipse.osgi.services.jar new file mode 100644 index 0000000..b648e76 Binary files /dev/null and b/shared/portal-http-service/lib/org.eclipse.osgi.services.jar differ diff --git a/shared/portal-http-service/lib/org.osgi.core.jar b/shared/portal-http-service/lib/org.osgi.core.jar new file mode 100644 index 0000000..d881a6a Binary files /dev/null and b/shared/portal-http-service/lib/org.osgi.core.jar differ diff --git a/shared/portal-http-service/lib/portal-compat-shared.jar b/shared/portal-http-service/lib/portal-compat-shared.jar new file mode 100644 index 0000000..6e7a6ac Binary files /dev/null and b/shared/portal-http-service/lib/portal-compat-shared.jar differ diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/HttpServiceBundleActivator.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/HttpServiceBundleActivator.java new file mode 100644 index 0000000..8a63871 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/HttpServiceBundleActivator.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal; + +import com.liferay.portal.http.service.internal.event.EventUtil; +import com.liferay.portal.http.service.internal.http.PortalHttpContext; +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.http.service.internal.servlet.WebExtenderServlet; +import com.liferay.portal.http.service.servlet.BundleServletConfig; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.Validator; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Filter; +import org.osgi.framework.ServiceReference; +import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +/** + * @author Miguel Pastor + * @author Raymond Augé + */ +public class HttpServiceBundleActivator + implements BundleActivator, + ServiceTrackerCustomizer { + + + public ServletContext addingService( + ServiceReference serviceReference) { + + BundleContext bundleContext = getBundleContext(); + + ServletContext servletContext = bundleContext.getService( + serviceReference); + + ServletConfig servletConfig = new BundleServletConfig( + servletContext, "Web Extender Servlet", null, + new PortalHttpContext(servletContext)); + + try { + _webExtenderServlet = new WebExtenderServlet(bundleContext); + + _webExtenderServlet.init(servletConfig); + + _webBundleDeployer = new WebBundleDeployer(_webExtenderServlet); + + _startedBundleListener = new StartedBundleListener( + _webBundleDeployer); + + bundleContext.addBundleListener(_startedBundleListener); + + _stoppedBundleListener = new StoppedBundleListener( + _webBundleDeployer); + + bundleContext.addBundleListener(_stoppedBundleListener); + } + catch (Exception e) { + _log.error(e, e); + } + + checkStartableBundles(); + + return servletContext; + } + + public BundleContext getBundleContext() { + return _bundleContext; + } + + + public void modifiedService( + ServiceReference serviceReference, + ServletContext servletContext) { + } + + + public void removedService( + ServiceReference serviceReference, + ServletContext servletContext) { + + _webBundleDeployer.close(); + + _webBundleDeployer = null; + + _webExtenderServlet.destroy(); + + _webExtenderServlet = null; + + _bundleContext.removeBundleListener(_startedBundleListener); + + _startedBundleListener = null; + + _bundleContext.removeBundleListener(_stoppedBundleListener); + + _stoppedBundleListener = null; + } + + + public void start(BundleContext bundleContext) throws Exception { + _bundleContext = bundleContext; + + EventUtil.start(_bundleContext); + + Filter filter = bundleContext.createFilter( + "(&(bean.id=" + ServletContext.class.getName() + + ")(original.bean=*))"); + + _servletContextTracker = + new ServiceTracker( + bundleContext, filter, this); + + _servletContextTracker.open(); + } + + + public void stop(BundleContext bundleContext) throws Exception { + _servletContextTracker.close(); + + _servletContextTracker = null; + + EventUtil.close(); + + _bundleContext = null; + } + + protected void checkStartableBundles() { + for (Bundle bundle : _bundleContext.getBundles()) { + String servletContextName = + BundleServletContext.getServletContextName(bundle); + + if (Validator.isNull(servletContextName)) { + continue; + } + + try { + _webBundleDeployer.doStart(bundle, servletContextName); + } + catch (Exception e) { + _log.error(e, e); + } + } + } + + private static Log _log = LogFactoryUtil.getLog( + HttpServiceBundleActivator.class); + + private BundleContext _bundleContext; + private ServiceTracker + _servletContextTracker; + private StartedBundleListener _startedBundleListener; + private StoppedBundleListener _stoppedBundleListener; + private WebBundleDeployer _webBundleDeployer; + private WebExtenderServlet _webExtenderServlet; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/StartedBundleListener.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/StartedBundleListener.java new file mode 100644 index 0000000..c7e5bc3 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/StartedBundleListener.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.Validator; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleEvent; +import org.osgi.framework.BundleListener; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class StartedBundleListener implements BundleListener { + + public StartedBundleListener(WebBundleDeployer webBundleDeployer) { + _webBundleDeployer = webBundleDeployer; + } + + + public void bundleChanged(BundleEvent bundleEvent) { + int type = bundleEvent.getType(); + + Bundle bundle = bundleEvent.getBundle(); + + String servletContextName = BundleServletContext.getServletContextName( + bundle); + + if (Validator.isNull(servletContextName)) { + return; + } + + try { + if (type == BundleEvent.STARTED) { + _webBundleDeployer.doStart(bundle, servletContextName); + } + } + catch (Exception e) { + _log.error(e, e); + } + } + + private static Log _log = LogFactoryUtil.getLog( + StartedBundleListener.class); + + private WebBundleDeployer _webBundleDeployer; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/StoppedBundleListener.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/StoppedBundleListener.java new file mode 100644 index 0000000..fa8c311 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/StoppedBundleListener.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.Validator; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleEvent; +import org.osgi.framework.SynchronousBundleListener; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class StoppedBundleListener implements SynchronousBundleListener { + + public StoppedBundleListener(WebBundleDeployer webBundleDeployer) { + _webBundleDeployer = webBundleDeployer; + } + + + public void bundleChanged(BundleEvent bundleEvent) { + int type = bundleEvent.getType(); + + Bundle bundle = bundleEvent.getBundle(); + + String servletContextName = BundleServletContext.getServletContextName( + bundle); + + if (Validator.isNull(servletContextName)) { + return; + } + + try { + if (type == BundleEvent.STOPPED) { + _webBundleDeployer.doStop(bundle, servletContextName); + } + } + catch (Exception e) { + _log.error(e, e); + } + } + + private static Log _log = LogFactoryUtil.getLog( + StoppedBundleListener.class); + + private WebBundleDeployer _webBundleDeployer; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/WebBundleDeployer.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/WebBundleDeployer.java new file mode 100644 index 0000000..c16e90c --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/WebBundleDeployer.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal; + +import com.liferay.portal.http.service.internal.event.EventUtil; +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.http.service.internal.servlet.WebExtenderServlet; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.servlet.ServletContextPool; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.ServletContext; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class WebBundleDeployer { + + public WebBundleDeployer(WebExtenderServlet webExtenderServlet) + throws Exception { + + _webExtenderServlet = webExtenderServlet; + } + + public void close() { + _webExtenderServlet = null; + } + + public void doStart(Bundle bundle, String servletContextName) { + if (bundle.getState() != Bundle.ACTIVE) { + return; + } + + EventUtil.sendEvent(bundle, EventUtil.DEPLOYING, null, false); + + ServletContext servletContext = ServletContextPool.get( + servletContextName); + + if (servletContext != null) { + EventUtil.sendEvent(bundle, EventUtil.FAILED, null, true); + + _collidedWABBundleIds.add(bundle.getBundleId()); + + return; + } + + try { + BundleServletContext bundleServletContext = + new BundleServletContext( + bundle, servletContextName, + _webExtenderServlet.getServletContext()); + + bundleServletContext.open(); + + ServletContextPool.put(servletContextName, bundleServletContext); + } + catch (Exception e) { + EventUtil.sendEvent(bundle, EventUtil.FAILED, e, false); + } + } + + public void doStop(Bundle bundle, String servletContextName) { + EventUtil.sendEvent(bundle, EventUtil.UNDEPLOYING, null, false); + + BundleServletContext bundleServletContext = null; + + ServletContext servletContext = ServletContextPool.get( + servletContextName); + + if ((servletContext != null) && + (servletContext instanceof BundleServletContext)) { + + bundleServletContext = (BundleServletContext)servletContext; + } + + if (bundleServletContext == null) { + EventUtil.sendEvent(bundle, EventUtil.UNDEPLOYED, null, false); + + ServletContextPool.remove(servletContextName); + + return; + } + + try { + bundleServletContext.close(); + } + catch (Exception e) { + EventUtil.sendEvent(bundle, EventUtil.FAILED, null, false); + } + + EventUtil.sendEvent(bundle, EventUtil.UNDEPLOYED, null, false); + + ServletContextPool.remove(servletContextName); + + handleCollidedWABs(bundle, servletContextName); + } + + protected void handleCollidedWABs( + Bundle bundle, String servletContextName) { + + if (_collidedWABBundleIds.isEmpty()) { + return; + } + + BundleContext bundleContext = _webExtenderServlet.getBundleContext(); + + Iterator iterator = _collidedWABBundleIds.iterator(); + + while (iterator.hasNext()) { + long bundleId = iterator.next(); + + Bundle curBundle = bundleContext.getBundle(bundleId); + + if (curBundle == null) { + iterator.remove(); + + continue; + } + + String curServletContextName = + BundleServletContext.getServletContextName(curBundle); + + if (servletContextName.equals(curServletContextName) && + (bundle.getBundleId() != curBundle.getBundleId())) { + + iterator.remove(); + + doStart(curBundle, servletContextName); + + break; + } + } + } + + private static Log _log = LogFactoryUtil.getLog(WebBundleDeployer.class); + + private List _collidedWABBundleIds = Collections.synchronizedList( + new ArrayList()); + private WebExtenderServlet _webExtenderServlet; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/FilterDefinition.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/FilterDefinition.java new file mode 100644 index 0000000..dfe0409 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/FilterDefinition.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.definition; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.Filter; + +/** + * @author Raymond Augé + */ +public class FilterDefinition { + + public void addURLPattern(String urlPattern) { + _urlPatterns.add(urlPattern); + } + + public Filter getFilter() { + return _filter; + } + + public Map getInitParameters() { + return _initParameters; + } + + public String getName() { + return _name; + } + + public List getURLPatterns() { + return _urlPatterns; + } + + public void setFilter(Filter filter) { + _filter = filter; + } + + public void setInitParameter(String key, String value) { + _initParameters.put(key, value); + } + + public void setInitParameters(Map initParameters) { + _initParameters = initParameters; + } + + public void setName(String name) { + _name = name; + } + + public void setURLPatterns(List urlPatterns) { + _urlPatterns = urlPatterns; + } + + private Filter _filter; + private Map _initParameters = new HashMap(); + private String _name; + private List _urlPatterns = new ArrayList(); + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/ListenerDefinition.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/ListenerDefinition.java new file mode 100644 index 0000000..e78e8b5 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/ListenerDefinition.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.definition; + +/** + * @author Raymond Augé + */ +public class ListenerDefinition { + + public Object getListener() { + return _listener; + } + + public void setListener(Object listener) { + _listener = listener; + } + + private Object _listener; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/ServletDefinition.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/ServletDefinition.java new file mode 100644 index 0000000..c969130 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/ServletDefinition.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.definition; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.Servlet; + +/** + * @author Raymond Augé + */ +public class ServletDefinition { + + public void addURLPattern(String urlPattern) { + _urlPatterns.add(urlPattern); + } + + public Map getInitParameters() { + return _initParameters; + } + + public String getName() { + return _name; + } + + public Servlet getServlet() { + return _servlet; + } + + public List getURLPatterns() { + return _urlPatterns; + } + + public void setInitParameter(String name, String value) { + _initParameters.put(name, value); + } + + public void setInitParameters(Map initParameters) { + _initParameters = initParameters; + } + + public void setName(String name) { + _name = name; + } + + public void setServlet(Servlet servlet) { + _servlet = servlet; + } + + public void setURLPatterns(List urlPatterns) { + _urlPatterns = urlPatterns; + } + + private Map _initParameters = new HashMap(); + private String _name; + private Servlet _servlet; + private List _urlPatterns = new ArrayList(); + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/WebXMLDefinition.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/WebXMLDefinition.java new file mode 100644 index 0000000..669a9a4 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/WebXMLDefinition.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.definition; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class WebXMLDefinition { + + public void addListenerDefinition(ListenerDefinition listenerDefinition) { + _listenerDefinitions.add(listenerDefinition); + } + + public Map getContextParameters() { + return _contextParameters; + } + + public Map getFilterDefinitions() { + return _filterDefinitions; + } + + public List getListenerDefinitions() { + return _listenerDefinitions; + } + + public Map getServletDefinitions() { + return _servletDefinitions; + } + + public void setContextParameter(String name, String value) { + _contextParameters.put(name, value); + } + + public void setContextParameters(Map contextParameters) { + _contextParameters = contextParameters; + } + + public void setFilterDefinition( + String name, FilterDefinition filterDefinition) { + + _filterDefinitions.put(name, filterDefinition); + } + + public void setFilterDefinitions( + Map filterDefinitions) { + + _filterDefinitions = filterDefinitions; + } + + public void setListenerDefinitions( + List listenerDefinitions) { + + _listenerDefinitions = listenerDefinitions; + } + + public void setServletDefinition( + String name, ServletDefinition servletDefinition) { + + _servletDefinitions.put(name, servletDefinition); + } + + public void setServletDefinitions( + Map servletDefinitions) { + + _servletDefinitions = servletDefinitions; + } + + private Map _contextParameters = + new HashMap(); + private Map _filterDefinitions = + new HashMap(); + private List _listenerDefinitions = + new ArrayList(); + private Map _servletDefinitions = + new HashMap(); + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/WebXMLDefinitionLoader.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/WebXMLDefinitionLoader.java new file mode 100644 index 0000000..881c2e3 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/definition/WebXMLDefinitionLoader.java @@ -0,0 +1,240 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.definition; + +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.xml.Document; +import com.liferay.portal.kernel.xml.DocumentException; +import com.liferay.portal.kernel.xml.Element; +import com.liferay.portal.kernel.xml.SAXReaderUtil; + +import java.net.URL; + +import java.util.List; + +import javax.servlet.Filter; +import javax.servlet.Servlet; + +import org.osgi.framework.Bundle; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class WebXMLDefinitionLoader { + + public WebXMLDefinition loadWebXML(Bundle bundle) + throws DocumentException, IllegalAccessException, + InstantiationException { + + WebXMLDefinition webXML = new WebXMLDefinition(); + + URL url = bundle.getEntry("WEB-INF/web.xml"); + + if (url != null) { + Document document = SAXReaderUtil.read(url); + + Element rootElement = document.getRootElement(); + + readContextParameters(bundle, rootElement, webXML); + readFilters(bundle, rootElement, webXML); + readListeners(bundle, rootElement, webXML); + readServlets(bundle, rootElement, webXML); + } + + return webXML; + } + + protected String getURLPattern(Element element) { + String urlPattern = element.elementText("url-pattern"); + + if (urlPattern.endsWith(_SLASH_STAR) && (urlPattern.length() > 2)) { + urlPattern = urlPattern.substring(0, urlPattern.length() - 2); + } + + if (urlPattern.startsWith(StringPool.STAR)) { + urlPattern = StringPool.SLASH.concat(urlPattern); + } + + return urlPattern; + } + + protected void readContextParameters( + Bundle bundle, Element rootElement, WebXMLDefinition webXML) { + + for (Element element : rootElement.elements("context-param")) { + String name = element.elementText("param-name"); + String value = element.elementText("param-value"); + + webXML.setContextParameter(name, value); + } + } + + protected void readFilters( + Bundle bundle, Element rootElement, WebXMLDefinition webXML) + throws IllegalAccessException, InstantiationException { + + List filterElements = rootElement.elements("filter"); + + for (Element filterElement : filterElements) { + FilterDefinition filterDefinition = new FilterDefinition(); + + String filterClassName = filterElement.elementText("filter-class"); + + Class clazz = null; + + try { + clazz = bundle.loadClass(filterClassName); + } + catch (Exception e) { + _log.error("Unable to load filter " + filterClassName); + + continue; + } + + Filter filter = (Filter)clazz.newInstance(); + + filterDefinition.setFilter(filter); + + List initParamElements = filterElement.elements( + "init-param"); + + for (Element initParamElement : initParamElements) { + String paramName = initParamElement.elementText("param-name"); + String paramValue = initParamElement.elementText("param-value"); + + filterDefinition.setInitParameter(paramName, paramValue); + } + + String filterName = filterElement.elementText("filter-name"); + + filterDefinition.setName(filterName); + + List filterMappingElements = rootElement.elements( + "filter-mapping"); + + for (Element filterMappingElement : filterMappingElements) { + String filterMappingElementFilterName = + filterMappingElement.elementText("filter-name"); + + if (filterMappingElementFilterName.equals(filterName)) { + String urlPattern = getURLPattern(filterMappingElement); + + filterDefinition.addURLPattern(urlPattern); + } + } + + webXML.setFilterDefinition(filterName, filterDefinition); + } + } + + protected void readListeners( + Bundle bundle, Element rootElement, WebXMLDefinition webXML) + throws IllegalAccessException, InstantiationException { + + List listenerElements = rootElement.elements("listener"); + + for (Element listenerElement : listenerElements) { + ListenerDefinition listenerDefinition = new ListenerDefinition(); + + String listenerClassName = listenerElement.elementText( + "listener-class"); + + Class clazz = null; + + try { + clazz = bundle.loadClass(listenerClassName); + } + catch (Exception e) { + _log.error("Unable to load listener " + listenerClassName); + + continue; + } + + Object listener = clazz.newInstance(); + + listenerDefinition.setListener(listener); + + webXML.addListenerDefinition(listenerDefinition); + } + } + + protected void readServlets( + Bundle bundle, Element rootElement, WebXMLDefinition webXML) + throws IllegalAccessException, InstantiationException { + + List servletElements = rootElement.elements("servlet"); + + for (Element servletElement : servletElements) { + ServletDefinition servletDefinition = new ServletDefinition(); + + String servletClassName = servletElement.elementText( + "servlet-class"); + + Class servletClass = null; + + try { + servletClass = bundle.loadClass(servletClassName); + } + catch (Exception e) { + _log.error("Unable to load servlet " + servletClassName); + + continue; + } + + Servlet servlet = (Servlet)servletClass.newInstance(); + + servletDefinition.setServlet(servlet); + + List initParamElements = servletElement.elements( + "init-param"); + + for (Element initParamElement : initParamElements) { + String paramName = initParamElement.elementText("param-name"); + String paramValue = initParamElement.elementText("param-value"); + + servletDefinition.setInitParameter(paramName, paramValue); + } + + String servletName = servletElement.elementText("servlet-name"); + + servletDefinition.setName(servletName); + + List servletMappingElements = rootElement.elements( + "servlet-mapping"); + + for (Element servletMappingElement : servletMappingElements) { + String servletMappingElementServletName = + servletMappingElement.elementText("servlet-name"); + + if (servletMappingElementServletName.equals(servletName)) { + String urlPattern = getURLPattern(servletMappingElement); + + servletDefinition.addURLPattern(urlPattern); + } + } + + webXML.setServletDefinition(servletName, servletDefinition); + } + } + + private static final String _SLASH_STAR = "/*"; + + private static Log _log = LogFactoryUtil.getLog( + WebXMLDefinitionLoader.class); + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/event/EventUtil.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/event/EventUtil.java new file mode 100644 index 0000000..fd16475 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/event/EventUtil.java @@ -0,0 +1,209 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.event; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.StringPool; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.event.Event; +import org.osgi.service.event.EventAdmin; +import org.osgi.service.event.EventConstants; +import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class EventUtil + implements ServiceTrackerCustomizer { + + public static final String DEPLOYED = "org/osgi/service/web/DEPLOYED"; + + public static final String DEPLOYING = "org/osgi/service/web/DEPLOYING"; + + public static final String FAILED = "org/osgi/service/web/FAILED"; + + public static final String UNDEPLOYED = "org/osgi/service/web/UNDEPLOYED"; + + public static final String UNDEPLOYING = "org/osgi/service/web/UNDEPLOYING"; + + public static void close() { + _instance._close(); + + _instance = null; + } + + public static void sendEvent( + Bundle bundle, String eventTopic, Exception exception, + boolean collision) { + + _instance._sendEvent(bundle, eventTopic, exception, collision); + } + + public static void start(BundleContext bundleContext) { + if (_instance != null) { + return; + } + + _instance = new EventUtil(); + + _instance._start(bundleContext); + } + + public void _close() { + _eventAdminServiceTracker.close(); + + _bundleContext = null; + _eventAdminServiceTracker = null; + _webExtenderBundle = null; + } + + + public EventAdmin addingService( + ServiceReference serviceReference) { + + _eventAdmin = _bundleContext.getService(serviceReference); + + return _eventAdmin; + } + + + public void modifiedService( + ServiceReference serviceReference, EventAdmin eventAdmin) { + } + + + public void removedService( + ServiceReference serviceReference, EventAdmin eventAdmin) { + + _eventAdmin = null; + } + + private EventUtil() { + } + + private void _sendEvent( + Bundle bundle, String eventTopic, Exception exception, + boolean collision) { + + Map properties = new Hashtable(); + + properties.put("bundle", bundle); + properties.put("bundle.id", bundle.getBundleId()); + properties.put("bundle.symbolicName", bundle.getSymbolicName()); + properties.put("bundle.version", bundle.getVersion()); + + String servletContextName = BundleServletContext.getServletContextName( + bundle, true); + + String contextPath = StringPool.SLASH.concat(servletContextName); + + if (collision) { + properties.put("collision", contextPath); + + List collidedBundleIds = new ArrayList(); + + BundleContext bundleContext = bundle.getBundleContext(); + + for (Bundle curBundle : bundleContext.getBundles()) { + if (curBundle.equals(bundle) || + (curBundle.getState() != Bundle.ACTIVE)) { + + continue; + } + + String curServletContextName = + BundleServletContext.getServletContextName(curBundle); + + if ((curServletContextName != null) && + curServletContextName.equals(servletContextName)) { + + collidedBundleIds.add( + String.valueOf(curBundle.getBundleId())); + } + } + + properties.put("collision.bundles", collidedBundleIds); + } + + properties.put("context.path", contextPath); + + if (exception != null) { + properties.put("exception", exception); + } + + properties.put("extender.bundle", _webExtenderBundle); + properties.put("extender.bundle.id", _webExtenderBundle.getBundleId()); + properties.put( + "extender.bundle.symbolicName", + _webExtenderBundle.getSymbolicName()); + properties.put( + "extender.bundle.version", _webExtenderBundle.getVersion()); + properties.put("servlet.context.name", servletContextName); + properties.put("timestamp", System.currentTimeMillis()); + + Event event = new Event(eventTopic, properties); + + if (_log.isInfoEnabled()) { + _log.info(event); + } + + if (_eventAdmin == null) { + return; + } + + _eventAdmin.sendEvent(event); + } + + private void _start(BundleContext bundleContext) { + _bundleContext = bundleContext; + + _webExtenderBundle = _bundleContext.getBundle(); + + Map properties = new Hashtable(); + + properties.put(EventConstants.EVENT_TOPIC, _EVENT_TOPICS); + + _eventAdminServiceTracker = new ServiceTracker( + _bundleContext, EventAdmin.class.getName(), this); + + _eventAdminServiceTracker.open(); + } + + private static final String[] _EVENT_TOPICS = new String[] { + DEPLOYED, DEPLOYING, FAILED, UNDEPLOYED, UNDEPLOYING + }; + + private static Log _log = LogFactoryUtil.getLog(EventUtil.class); + + private static EventUtil _instance; + + private BundleContext _bundleContext; + private EventAdmin _eventAdmin; + private ServiceTracker _eventAdminServiceTracker; + private Bundle _webExtenderBundle; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/BaseServiceTrackerCustomizer.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/BaseServiceTrackerCustomizer.java new file mode 100644 index 0000000..9dcedd4 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/BaseServiceTrackerCustomizer.java @@ -0,0 +1,144 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.GetterUtil; + +import java.util.HashMap; +import java.util.Map; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.http.HttpContext; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +/** + * @author Miguel Pastor + * @author Raymond Augé + */ +public abstract class BaseServiceTrackerCustomizer + implements ServiceTrackerCustomizer { + + public BaseServiceTrackerCustomizer(HttpSupport httpSupport) { + this.httpSupport = httpSupport; + } + + + public T addingService(ServiceReference serviceReference) { + BundleContext bundleContext = httpSupport.getBundleContext(); + + T service = (T)bundleContext.getService(serviceReference); + + return doAction(serviceReference, service, ACTION_ADDING); + } + + + public void modifiedService( + ServiceReference serviceReference, T service) { + + doAction(serviceReference, service, ACTION_MODIFIED); + } + + + public void removedService( + ServiceReference serviceReference, T service) { + + doAction(serviceReference, service, ACTION_REMOVED); + } + + protected T doAction( + ServiceReference serviceReference, T service, int action) { + + Map initParameters = new HashMap(); + + if (action != ACTION_REMOVED) { + for (String key : serviceReference.getPropertyKeys()) { + if (key.startsWith("init.")) { + String value = GetterUtil.getString( + serviceReference.getProperty(key)); + + initParameters.put(key.substring(5), value); + } + } + + int serviceRanking = GetterUtil.getInteger( + serviceReference.getProperty(Constants.SERVICE_RANKING)); + + initParameters.put( + Constants.SERVICE_RANKING, String.valueOf(serviceRanking)); + } + + Bundle bundle = serviceReference.getBundle(); + + try { + HttpServiceWrapper httpServiceWrapper = httpSupport.getHttpService( + bundle); + + BundleServletContext bundleServletContext = + httpServiceWrapper.getBundleServletContext(); + + if (action != ACTION_ADDING) { + unregisterService(bundleServletContext, serviceReference); + } + + if (action != ACTION_REMOVED) { + String contextId = GetterUtil.getString( + serviceReference.getProperty("contextId")); + + HttpContext httpContext = httpSupport.getHttpContext(contextId); + + if (httpContext == null) { + httpContext = bundleServletContext.getHttpContext(); + } + + registerService( + bundleServletContext, serviceReference, service, + initParameters, httpContext); + } + } + catch (Exception e) { + _log.error(e, e); + } + + return service; + } + + protected abstract void registerService( + BundleServletContext bundleServletContext, + ServiceReference serviceReference, T service, + Map initParameters, HttpContext httpContext) + throws Exception; + + protected abstract void unregisterService( + BundleServletContext bundleServletContext, + ServiceReference serviceReference); + + protected static final int ACTION_ADDING = 0; + + protected static final int ACTION_MODIFIED = 1; + + protected static final int ACTION_REMOVED = 2; + + protected HttpSupport httpSupport; + + private static Log _log = LogFactoryUtil.getLog( + BaseServiceTrackerCustomizer.class); + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/DefaultHttpContext.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/DefaultHttpContext.java new file mode 100644 index 0000000..5becb71 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/DefaultHttpContext.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.kernel.util.MimeTypesUtil; +import com.liferay.portal.kernel.util.StringPool; + +import java.net.URL; + +import java.util.Enumeration; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.Bundle; +import org.osgi.service.http.HttpContext; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class DefaultHttpContext implements HttpContext { + + public DefaultHttpContext(Bundle bundle) { + _bundle = bundle; + } + + + public String getMimeType(String name) { + return MimeTypesUtil.getContentType(name); + } + + + public URL getResource(String path) { + if (!path.startsWith(StringPool.SLASH)) { + path = StringPool.SLASH.concat(path); + } + + URL url = null; + + if (!path.startsWith(_PATH_EXT)) { + url = getResource(_PATH_EXT.concat(path)); + + if (url != null) { + return url; + } + } + + url = _bundle.getResource(path); + + if (url != null) { + return url; + } + + String filePattern = path; + + int index = path.lastIndexOf(StringPool.SLASH); + + if (index != -1) { + filePattern = path.substring(index + 1); + + path = path.substring(0, index); + } + + Enumeration enumeration = _bundle.findEntries( + path, filePattern, false); + + if ((enumeration != null) && enumeration.hasMoreElements()) { + return enumeration.nextElement(); + } + + return null; + } + + + public boolean handleSecurity( + HttpServletRequest request, HttpServletResponse response) { + + return true; + } + + private static final String _PATH_EXT = "/ext"; + + private Bundle _bundle; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/ExtendedHttpService.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/ExtendedHttpService.java new file mode 100644 index 0000000..175949b --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/ExtendedHttpService.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import java.util.List; +import java.util.Map; + +import javax.servlet.Filter; +import javax.servlet.Servlet; +import javax.servlet.ServletException; + +import org.osgi.service.http.HttpContext; +import org.osgi.service.http.HttpService; +import org.osgi.service.http.NamespaceException; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public interface ExtendedHttpService extends HttpService { + + public void registerFilter( + String filterName, List urlPatterns, Filter filter, + Map initParameters, HttpContext httpContext) + throws NamespaceException, ServletException; + + public void registerListener( + Object listener, Map initParameters, + HttpContext httpContext); + + public void registerServlet( + String servletName, List urlPatterns, Servlet servlet, + Map initParameters, HttpContext httpContext) + throws NamespaceException, ServletException; + + public void unregisterFilter(String filterName); + + public void unregisterListener(Object listener); + + public void unregisterServlet(String servletName); + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/FilterTracker.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/FilterTracker.java new file mode 100644 index 0000000..2ef510c --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/FilterTracker.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.kernel.util.GetterUtil; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.Validator; + +import java.util.Map; + +import javax.servlet.Filter; + +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.http.HttpContext; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class FilterTracker + extends BaseServiceTrackerCustomizer { + + public FilterTracker(HttpSupport httpSupport) { + super(httpSupport); + } + + + protected void registerService( + BundleServletContext bundleServletContext, + ServiceReference serviceReference, Filter filter, + Map initParameters, HttpContext httpContext) + throws Exception { + + String filterName = GetterUtil.getString( + serviceReference.getProperty("filterName")); + + if (Validator.isNull(filterName)) { + filterName = String.valueOf( + serviceReference.getProperty(Constants.SERVICE_ID)); + } + + String urlPattern = GetterUtil.getString( + serviceReference.getProperty("urlPattern")); + + if (Validator.isNull(urlPattern)) { + urlPattern = GetterUtil.getString( + serviceReference.getProperty("pattern")); + } + + if (Validator.isNull(urlPattern)) { + return; + } + + if (!urlPattern.startsWith(StringPool.SLASH)) { + urlPattern = StringPool.SLASH.concat(urlPattern); + } + + bundleServletContext.registerFilter( + filterName, urlPattern, filter, initParameters, httpContext); + } + + + protected void unregisterService( + BundleServletContext bundleServletContext, + ServiceReference serviceReference) { + + String filterName = GetterUtil.getString( + serviceReference.getProperty("filterName")); + + if (Validator.isNull(filterName)) { + filterName = String.valueOf( + serviceReference.getProperty(Constants.SERVICE_ID)); + } + + bundleServletContext.unregisterFilter(filterName); + } + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpServiceFactory.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpServiceFactory.java new file mode 100644 index 0000000..4845626 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpServiceFactory.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import org.osgi.framework.Bundle; +import org.osgi.framework.ServiceFactory; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.http.HttpService; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class HttpServiceFactory implements ServiceFactory { + + public HttpServiceFactory(HttpSupport httpSupport) { + _httpSupport = httpSupport; + } + + + public HttpService getService( + Bundle bundle, ServiceRegistration serviceRegistration) { + + return _httpSupport.getHttpService(bundle); + } + + + public void ungetService( + Bundle bundle, ServiceRegistration serviceRegistration, + HttpService httpService) { + + _httpSupport.ungetHttpService(bundle); + } + + private HttpSupport _httpSupport; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpServiceTracker.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpServiceTracker.java new file mode 100644 index 0000000..62d7aad --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpServiceTracker.java @@ -0,0 +1,224 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.http.service.internal.definition.FilterDefinition; +import com.liferay.portal.http.service.internal.definition.ListenerDefinition; +import com.liferay.portal.http.service.internal.definition.ServletDefinition; +import com.liferay.portal.http.service.internal.definition.WebXMLDefinition; +import com.liferay.portal.http.service.internal.definition.WebXMLDefinitionLoader; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.xml.DocumentException; + +import java.util.List; +import java.util.Map; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.http.HttpContext; +import org.osgi.service.http.HttpService; +import org.osgi.util.tracker.ServiceTracker; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class HttpServiceTracker + extends ServiceTracker { + + public HttpServiceTracker(BundleContext bundleContext, Bundle bundle) + throws DocumentException { + + super(bundleContext, HttpService.class, null); + + _bundleContext = bundleContext; + _bundle = bundle; + + _webXMLDefinitionLoader = new WebXMLDefinitionLoader(); + } + + + public HttpService addingService( + ServiceReference serviceReference) { + + _serviceReference = serviceReference; + + HttpService httpService = _bundleContext.getService(_serviceReference); + + if (httpService == null) { + return httpService; + } + + HttpContext httpContext = httpService.createDefaultHttpContext(); + + readConfiguration(_bundle); + + ExtendedHttpService extendedHttpService = + (ExtendedHttpService)httpService; + + initListeners(extendedHttpService, httpContext); + + initServlets(extendedHttpService, httpContext); + + initFilters(extendedHttpService, httpContext); + + return httpService; + } + + + public void removedService( + ServiceReference serviceReference, + HttpService httpService) { + + if (_webXML == null) { + return; + } + + ExtendedHttpService extendedHttpService = + (ExtendedHttpService)httpService; + + destroyFilters(extendedHttpService); + + destroyServlets(extendedHttpService); + + destroyListeners(extendedHttpService); + + _webXML = null; + } + + protected void destroyFilters(ExtendedHttpService extendedHttpService) { + Map filterDefinitions = + _webXML.getFilterDefinitions(); + + for (String filterName : filterDefinitions.keySet()) { + try { + extendedHttpService.unregisterFilter(filterName); + } + catch (Exception e) { + _log.error(e, e); + } + } + } + + protected void destroyListeners(ExtendedHttpService extendedHttpService) { + List listenerDefinitions = + _webXML.getListenerDefinitions(); + + for (ListenerDefinition listenerDefinition : listenerDefinitions) { + try { + extendedHttpService.unregisterListener( + listenerDefinition.getListener()); + } + catch (Exception e) { + _log.error(e, e); + } + } + } + + protected void destroyServlets(ExtendedHttpService extendedHttpService) { + Map servlets = + _webXML.getServletDefinitions(); + + for (String servletName : servlets.keySet()) { + extendedHttpService.unregisterServlet(servletName); + } + } + + protected void initFilters( + ExtendedHttpService extendedHttpService, HttpContext httpContext) { + + Map filterDefinitions = + _webXML.getFilterDefinitions(); + + for (Map.Entry entry : + filterDefinitions.entrySet()) { + + FilterDefinition filterDefinition = entry.getValue(); + + try { + extendedHttpService.registerFilter( + filterDefinition.getName(), + filterDefinition.getURLPatterns(), + filterDefinition.getFilter(), + filterDefinition.getInitParameters(), httpContext); + } + catch (Exception e) { + _log.error(e, e); + } + } + } + + protected void initListeners( + ExtendedHttpService extendedHttpService, HttpContext httpContext) { + + List listenerDefinitions = + _webXML.getListenerDefinitions(); + + for (ListenerDefinition listenerDefinition : listenerDefinitions) { + try { + extendedHttpService.registerListener( + listenerDefinition.getListener(), + _webXML.getContextParameters(), httpContext); + } + catch (Exception e) { + _log.error(e, e); + } + } + } + + protected void initServlets( + ExtendedHttpService extendedHttpService, HttpContext httpContext) { + + Map servletDefinitions = + _webXML.getServletDefinitions(); + + for (Map.Entry entry : + servletDefinitions.entrySet()) { + + ServletDefinition servletDefinition = entry.getValue(); + + try { + extendedHttpService.registerServlet( + servletDefinition.getName(), + servletDefinition.getURLPatterns(), + servletDefinition.getServlet(), + servletDefinition.getInitParameters(), httpContext); + } + catch (Exception e) { + _log.error(e, e); + } + } + } + + protected void readConfiguration(Bundle bundle) { + try { + _webXML = _webXMLDefinitionLoader.loadWebXML(bundle); + } + catch (Exception e) { + _log.error(e, e); + } + } + + private static Log _log = LogFactoryUtil.getLog(HttpServiceTracker.class); + + private Bundle _bundle; + private BundleContext _bundleContext; + private ServiceReference _serviceReference; + private WebXMLDefinition _webXML; + private WebXMLDefinitionLoader _webXMLDefinitionLoader; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpServiceWrapper.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpServiceWrapper.java new file mode 100644 index 0000000..ca22a6d --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpServiceWrapper.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; + +import java.util.Arrays; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.Filter; +import javax.servlet.Servlet; +import javax.servlet.ServletException; + +import org.osgi.service.http.HttpContext; +import org.osgi.service.http.HttpService; +import org.osgi.service.http.NamespaceException; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class HttpServiceWrapper implements ExtendedHttpService, HttpService { + + public HttpServiceWrapper(BundleServletContext bundleServletContext) { + this.bundleServletContext = bundleServletContext; + } + + public void close() { + bundleServletContext.close(); + } + + + public HttpContext createDefaultHttpContext() { + return bundleServletContext.getHttpContext(); + } + + public BundleServletContext getBundleServletContext() { + return bundleServletContext; + } + + + public void registerFilter( + String filterName, List urlPatterns, Filter filter, + Map initParameters, HttpContext httpContext) + throws NamespaceException, ServletException { + + if (httpContext == null) { + httpContext = createDefaultHttpContext(); + } + + bundleServletContext.registerFilter( + filterName, urlPatterns, filter, initParameters, httpContext); + } + + + public void registerListener( + Object listener, Map initParameters, + HttpContext httpContext) { + + bundleServletContext.registerListener( + listener, initParameters, httpContext); + } + + + public void registerResources( + String alias, String name, HttpContext httpContext) + throws NamespaceException { + + bundleServletContext.registerResources(alias, name, httpContext); + } + + + public void registerServlet( + String servletName, List urlPatterns, Servlet servlet, + Map initParameters, HttpContext httpContext) + throws NamespaceException, ServletException { + + if (httpContext == null) { + httpContext = createDefaultHttpContext(); + } + + bundleServletContext.registerServlet( + servletName, urlPatterns, servlet, initParameters, httpContext); + } + + + public void registerServlet( + String urlPattern, Servlet servlet, + @SuppressWarnings("rawtypes") Dictionary initParameters, + HttpContext httpContext) + throws NamespaceException, ServletException { + + // This method is not called by Liferay directly, but is made available + // for other OSGi modules that depend on the HTTP service + + bundleServletContext.registerServlet( + urlPattern, Arrays.asList(urlPattern), servlet, + toMap(initParameters), httpContext); + } + + + public void unregister(String servletName) { + unregisterServlet(servletName); + } + + + public void unregisterFilter(String filterName) { + bundleServletContext.unregisterFilter(filterName); + } + + + public void unregisterListener(Object listener) { + bundleServletContext.unregisterListener(listener); + } + + + public void unregisterServlet(String servletName) { + bundleServletContext.unregisterServlet(servletName); + } + + protected Map toMap(Dictionary dictionary) { + Map map = new HashMap(); + + Enumeration keys = dictionary.keys(); + + while (keys.hasMoreElements()) { + K key = keys.nextElement(); + + map.put(key, dictionary.get(key)); + } + + return map; + } + + protected BundleServletContext bundleServletContext; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpSupport.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpSupport.java new file mode 100644 index 0000000..dfc2cfe --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/HttpSupport.java @@ -0,0 +1,200 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.http.service.internal.servlet.WebExtenderServlet; +import com.liferay.portal.kernel.util.StringBundler; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.kernel.xml.DocumentException; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Filter; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.http.HttpContext; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class HttpSupport { + + public HttpSupport( + BundleContext bundleContext, WebExtenderServlet webExtenderServlet) { + + _bundleContext = bundleContext; + _webExtenderServlet = webExtenderServlet; + } + + public BundleContext getBundleContext() { + return _bundleContext; + } + + public BundleServletContext getBundleServletContext(Bundle bundle) + throws DocumentException, InvalidSyntaxException { + + BundleServletContext bundleServletContext = getWABBundleServletContext( + bundle); + + if (bundleServletContext != null) { + return bundleServletContext; + } + + return getNonWABBundleServletContext(bundle); + } + + public Filter getFilter(Bundle bundle) throws InvalidSyntaxException { + StringBundler sb = new StringBundler(7); + + sb.append("(&(bundle.symbolicName="); + sb.append(bundle.getSymbolicName()); + sb.append(")(bundle.version="); + sb.append(bundle.getVersion()); + sb.append(")(bundle.id="); + sb.append(bundle.getBundleId()); + sb.append(")(Web-ContextPath=*))"); + + return _bundleContext.createFilter(sb.toString()); + } + + public Filter getFilter(String contextId) throws InvalidSyntaxException { + return _bundleContext.createFilter("(&(contextId=" + contextId + ")"); + } + + public HttpContext getHttpContext(String contextId) + throws InvalidSyntaxException { + + if (Validator.isNull(contextId)) { + return null; + } + + Filter filter = getFilter(contextId); + + Collection> serviceReferences = + _bundleContext.getServiceReferences( + HttpContext.class, filter.toString()); + + Iterator> iterator = + serviceReferences.iterator(); + + if (iterator.hasNext()) { + ServiceReference httpContextReference = + iterator.next(); + + return _bundleContext.getService(httpContextReference); + } + + return null; + } + + public HttpServiceWrapper getHttpService(Bundle bundle) { + HttpServiceWrapper httpServiceWrapper = _httpServiceWrappers.get( + bundle); + + if (httpServiceWrapper != null) { + return httpServiceWrapper; + } + + httpServiceWrapper = doGetService(bundle); + + _httpServiceWrappers.put(bundle, httpServiceWrapper); + + return httpServiceWrapper; + } + + public BundleServletContext getWABBundleServletContext(Bundle bundle) + throws InvalidSyntaxException { + + Filter filter = getFilter(bundle); + + Collection> serviceReferences = + _bundleContext.getServiceReferences( + BundleServletContext.class, filter.toString()); + + Iterator> iterator = + serviceReferences.iterator(); + + if (iterator.hasNext()) { + ServiceReference servletContextReference = + iterator.next(); + + return _bundleContext.getService(servletContextReference); + } + + return null; + } + + public WebExtenderServlet getWebExtenderServlet() { + return _webExtenderServlet; + } + + public void ungetHttpService(Bundle bundle) { + HttpServiceWrapper httpServiceWrapper = _httpServiceWrappers.get( + bundle); + + if (httpServiceWrapper == null) { + return; + } + + BundleServletContext bundleServletContext = + httpServiceWrapper.getBundleServletContext(); + + bundleServletContext.close(); + + _httpServiceWrappers.remove(bundle); + } + + protected HttpServiceWrapper doGetService(Bundle bundle) { + try { + BundleServletContext bundleServletContext = getBundleServletContext( + bundle); + + if (bundleServletContext != null) { + return new HttpServiceWrapper(bundleServletContext); + } + + bundleServletContext = getNonWABBundleServletContext(bundle); + + return new NonWABHttpServiceWrapper(bundleServletContext); + } + catch (Exception ise) { + throw new IllegalStateException(ise); + } + } + + protected BundleServletContext getNonWABBundleServletContext(Bundle bundle) + throws DocumentException { + + BundleServletContext bundleServletContext = new BundleServletContext( + bundle, null, _webExtenderServlet.getServletContext()); + + bundleServletContext.open(); + + return bundleServletContext; + } + + private BundleContext _bundleContext; + private Map _httpServiceWrappers = + new HashMap(); + private WebExtenderServlet _webExtenderServlet; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/NonWABHttpServiceWrapper.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/NonWABHttpServiceWrapper.java new file mode 100644 index 0000000..8d8e10f --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/NonWABHttpServiceWrapper.java @@ -0,0 +1,141 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; + +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; +import java.util.Map; + +import javax.servlet.Filter; +import javax.servlet.Servlet; +import javax.servlet.ServletException; + +import org.osgi.service.http.HttpContext; +import org.osgi.service.http.NamespaceException; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class NonWABHttpServiceWrapper extends HttpServiceWrapper { + + public NonWABHttpServiceWrapper(BundleServletContext bundleServletContext) { + super(bundleServletContext); + } + + + public void registerFilter( + String filterName, List urlPatterns, Filter filter, + Map initParameters, HttpContext httpContext) + throws NamespaceException, ServletException { + + super.registerFilter( + filterName, urlPatterns, filter, initParameters, httpContext); + + _registrations.add(filterName); + } + + + public void registerListener( + Object listener, Map initParameters, + HttpContext httpContext) { + + if (httpContext == null) { + httpContext = createDefaultHttpContext(); + } + + bundleServletContext.registerListener( + listener, initParameters, httpContext); + + _registrations.add(listener); + } + + + public void registerResources( + String alias, String name, HttpContext httpContext) + throws NamespaceException { + + if (httpContext == null) { + httpContext = createDefaultHttpContext(); + } + + bundleServletContext.registerResources(alias, name, httpContext); + + _registrations.add(alias); + } + + + public void registerServlet( + String servletName, List urlPatterns, Servlet servlet, + Map initParameters, HttpContext httpContext) + throws NamespaceException, ServletException { + + super.registerServlet( + servletName, urlPatterns, servlet, initParameters, httpContext); + + _registrations.add(servletName); + } + + + public void registerServlet( + String urlPattern, Servlet servlet, + @SuppressWarnings("rawtypes") Dictionary initParameters, + HttpContext httpContext) + throws NamespaceException, ServletException { + + // This method is not called by Liferay directly, but is made available + // for other OSGi modules that depend on the HTTP service + + super.registerServlet(urlPattern, servlet, initParameters, httpContext); + + _registrations.add(urlPattern); + } + + + public void unregister(String servletName) { + unregisterServlet(servletName); + } + + + public void unregisterFilter(String filterName) { + super.unregisterFilter(filterName); + + removeRegistration(filterName); + } + + + public void unregisterListener(Object listener) { + bundleServletContext.unregisterListener(listener); + + removeRegistration(listener); + } + + + public void unregisterServlet(String servletName) { + super.unregisterServlet(servletName); + + removeRegistration(servletName); + } + + protected void removeRegistration(Object object) { + _registrations.remove(object); + } + + private List _registrations = new ArrayList(); + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/PortalHttpContext.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/PortalHttpContext.java new file mode 100644 index 0000000..89193d8 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/PortalHttpContext.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.util.MimeTypesUtil; + +import java.net.MalformedURLException; +import java.net.URL; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.service.http.HttpContext; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class PortalHttpContext implements HttpContext { + + public PortalHttpContext(ServletContext servletContext) { + _servletContext = servletContext; + } + + + public String getMimeType(String name) { + String mimeType = _servletContext.getMimeType(name); + + if (mimeType == null) { + mimeType = MimeTypesUtil.getContentType(name); + } + + return mimeType; + } + + + public URL getResource(String path) { + try { + return _servletContext.getResource(path); + } + catch (MalformedURLException mue) { + _log.error(mue, mue); + } + + return null; + } + + + public boolean handleSecurity( + HttpServletRequest request, HttpServletResponse response) { + + return true; + } + + private static Log _log = LogFactoryUtil.getLog(PortalHttpContext.class); + + private ServletContext _servletContext; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/ServletTracker.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/ServletTracker.java new file mode 100644 index 0000000..0b94448 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/http/ServletTracker.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.kernel.util.GetterUtil; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.Validator; + +import java.util.Map; + +import javax.servlet.Servlet; + +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.http.HttpContext; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class ServletTracker + extends BaseServiceTrackerCustomizer { + + public ServletTracker(HttpSupport httpSupport) { + super(httpSupport); + } + + + protected void registerService( + BundleServletContext bundleServletContext, + ServiceReference serviceReference, Servlet servlet, + Map initParameters, HttpContext httpContext) + throws Exception { + + String servletName = GetterUtil.getString( + serviceReference.getProperty("servletName")); + + if (Validator.isNull(servletName)) { + servletName = String.valueOf( + serviceReference.getProperty(Constants.SERVICE_ID)); + } + + String urlPattern = GetterUtil.getString( + serviceReference.getProperty("urlPattern")); + + if (Validator.isNull(urlPattern)) { + urlPattern = GetterUtil.getString( + serviceReference.getProperty("alias")); + } + + if (Validator.isNull(urlPattern)) { + return; + } + + if (!urlPattern.startsWith(StringPool.SLASH)) { + urlPattern = StringPool.SLASH.concat(urlPattern); + } + + bundleServletContext.registerServlet( + servletName, urlPattern, servlet, initParameters, httpContext); + } + + + protected void unregisterService( + BundleServletContext bundleServletContext, + ServiceReference serviceReference) { + + String servletName = GetterUtil.getString( + serviceReference.getProperty("servletName")); + + if (Validator.isNull(servletName)) { + servletName = String.valueOf( + serviceReference.getProperty(Constants.SERVICE_ID)); + } + + bundleServletContext.unregisterServlet(servletName); + } + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleFilterChain.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleFilterChain.java new file mode 100644 index 0000000..af5ccf3 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleFilterChain.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.servlet; + +import com.liferay.portal.http.service.servlet.BundleServletConfig; + +import java.io.IOException; + +import java.util.LinkedList; +import java.util.Queue; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.service.http.HttpContext; + +/** + * @author Raymond Augé + */ +public class BundleFilterChain implements FilterChain { + + public void addFilter(Filter filter) { + _filters.add(filter); + } + + + public void doFilter( + ServletRequest servletRequest, ServletResponse servletResponse) + throws IOException, ServletException { + + Filter filter = _filters.poll(); + + if (filter == null) { + ServletConfig servletConfig = _servlet.getServletConfig(); + + if (servletConfig instanceof BundleServletConfig) { + BundleServletConfig bundleServletConfig = + (BundleServletConfig)servletConfig; + + HttpContext httpContext = bundleServletConfig.getHttpContext(); + + if (!httpContext.handleSecurity( + (HttpServletRequest)servletRequest, + (HttpServletResponse)servletResponse)) { + + return; + } + } + + _servlet.service(servletRequest, servletResponse); + + return; + } + + filter.doFilter(servletRequest, servletResponse, this); + } + + public void setServlet(Servlet servlet) { + _servlet = servlet; + } + + private Queue _filters = new LinkedList(); + private Servlet _servlet; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleFilterConfig.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleFilterConfig.java new file mode 100644 index 0000000..7a16a3b --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleFilterConfig.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.servlet; + +import java.util.Collections; +import java.util.Enumeration; +import java.util.Map; + +import javax.servlet.FilterConfig; +import javax.servlet.ServletContext; + +import org.osgi.service.http.HttpContext; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class BundleFilterConfig implements FilterConfig { + + public BundleFilterConfig( + ServletContext servletContext, String filterName, + Map initParameters, HttpContext httpContext) { + + _servletContext = servletContext; + _filterName = filterName; + _initParameters = initParameters; + _httpContext = httpContext; + } + + + public String getFilterName() { + return _filterName; + } + + public HttpContext getHttpContext() { + return _httpContext; + } + + + public String getInitParameter(String parameter) { + return _initParameters.get(parameter); + } + + + public Enumeration getInitParameterNames() { + return Collections.enumeration(_initParameters.keySet()); + } + + + public ServletContext getServletContext() { + return _servletContext; + } + + private String _filterName; + private HttpContext _httpContext; + private Map _initParameters; + private ServletContext _servletContext; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleRequestDispatcher.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleRequestDispatcher.java new file mode 100644 index 0000000..33e4543 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleRequestDispatcher.java @@ -0,0 +1,195 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.servlet; + +import com.liferay.portal.kernel.util.JavaConstants; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.StringUtil; +import com.liferay.portal.util.ClassLoaderUtil; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +import java.net.URLDecoder; + +import javax.servlet.DispatcherType; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletRequestEvent; +import javax.servlet.ServletRequestListener; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class BundleRequestDispatcher implements RequestDispatcher { + + public BundleRequestDispatcher( + String servletMapping, boolean extensionMapping, String requestURI, + BundleServletContext bundleServletContext) { + + _servletMapping = servletMapping; + _extensionMapping = extensionMapping; + _requestURI = StringUtil.replace( + requestURI, StringPool.DOUBLE_SLASH, StringPool.SLASH); + _bundleServletContext = bundleServletContext; + + if (!_extensionMapping) { + _servletPath = _servletMapping; + } + else { + _servletPath = _requestURI; + } + + if ((_servletPath != null) && + _requestURI.startsWith(_servletPath) && + (_requestURI.length() > _servletPath.length())) { + + _pathInfo = _requestURI.substring(_servletPath.length()); + + try { + _pathInfo = URLDecoder.decode(_pathInfo, StringPool.UTF8); + } + catch (UnsupportedEncodingException uee) { + throw new RuntimeException(uee); + } + } + } + + public void doDispatch( + ServletRequest servletRequest, ServletResponse servletResponse, + DispatcherType dispatcherType) + throws IOException, ServletException { + + ClassLoader contextClassLoader = + ClassLoaderUtil.getContextClassLoader(); + + try { + ClassLoader pluginClassLoader = + _bundleServletContext.getClassLoader(); + + ClassLoaderUtil.setContextClassLoader(pluginClassLoader); + + for (ServletRequestListener servletRequestListener : + _bundleServletContext.getServletRequestListeners()) { + + ServletRequestEvent servletRequestEvent = + new ServletRequestEvent( + _bundleServletContext, servletRequest); + + servletRequestListener.requestInitialized(servletRequestEvent); + } + + BundleFilterChain bundleFilterChain = + _bundleServletContext.getFilterChain( + _requestURI, dispatcherType); + + bundleFilterChain.doFilter(servletRequest, servletResponse); + + for (ServletRequestListener servletRequestListener : + _bundleServletContext.getServletRequestListeners()) { + + ServletRequestEvent servletRequestEvent = + new ServletRequestEvent( + _bundleServletContext, servletRequest); + + servletRequestListener.requestDestroyed(servletRequestEvent); + } + } + finally { + ClassLoaderUtil.setContextClassLoader(contextClassLoader); + } + } + + + public void forward( + ServletRequest servletRequest, ServletResponse servletResponse) + throws IOException, ServletException { + + BundleServletRequest bundleServletRequest = new BundleServletRequest( + this, (HttpServletRequest)servletRequest); + + doDispatch( + bundleServletRequest, servletResponse, DispatcherType.FORWARD); + } + + + public void include( + ServletRequest servletRequest, ServletResponse servletResponse) + throws IOException, ServletException { + + BundleServletRequest bundleServletRequest = new BundleServletRequest( + this, (HttpServletRequest)servletRequest); + + String contextPath = _bundleServletContext.getContextPath(); + + if (_requestURI != null) { + bundleServletRequest.setAttribute( + JavaConstants.JAVAX_SERVLET_INCLUDE_REQUEST_URI, + _bundleServletContext.getContextPath().concat(_requestURI)); + } + + if (contextPath != null) { + bundleServletRequest.setAttribute( + JavaConstants.JAVAX_SERVLET_INCLUDE_CONTEXT_PATH, contextPath); + } + + if (_servletPath != null) { + bundleServletRequest.setAttribute( + JavaConstants.JAVAX_SERVLET_INCLUDE_SERVLET_PATH, _servletPath); + } + + if (_queryString != null) { + bundleServletRequest.setAttribute( + JavaConstants.JAVAX_SERVLET_INCLUDE_QUERY_STRING, _queryString); + } + + if (_pathInfo != null) { + bundleServletRequest.setAttribute( + JavaConstants.JAVAX_SERVLET_INCLUDE_PATH_INFO, _pathInfo); + } + + doDispatch( + bundleServletRequest, servletResponse, DispatcherType.INCLUDE); + } + + protected BundleServletContext getBundleServletContext() { + return _bundleServletContext; + } + + protected String getPathInfo() { + return _pathInfo; + } + + protected String getRequestURI() { + return _requestURI; + } + + protected String getServletPath() { + return _servletPath; + } + + private BundleServletContext _bundleServletContext; + private boolean _extensionMapping; + private String _pathInfo; + private String _queryString; + private String _requestURI; + private String _servletMapping; + private String _servletPath; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleServletContext.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleServletContext.java new file mode 100644 index 0000000..8df2cbb --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleServletContext.java @@ -0,0 +1,1315 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.servlet; + +import com.liferay.portal.apache.bridges.struts.LiferayServletContext; +import com.liferay.portal.http.service.internal.http.DefaultHttpContext; +import com.liferay.portal.http.service.internal.http.HttpServiceTracker; +import com.liferay.portal.http.service.servlet.BundleServletConfig; +import com.liferay.portal.http.service.servlet.ResourceServlet; +import com.liferay.portal.kernel.deploy.hot.DependencyManagementThreadLocal; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.servlet.PluginContextListener; +import com.liferay.portal.kernel.servlet.PortletSessionListenerManager; +import com.liferay.portal.kernel.servlet.ServletContextPool; +import com.liferay.portal.kernel.util.FileUtil; +import com.liferay.portal.kernel.util.GetterUtil; +import com.liferay.portal.kernel.util.HttpUtil; +import com.liferay.portal.kernel.util.JavaConstants; +import com.liferay.portal.kernel.util.PropertiesUtil; +import com.liferay.portal.kernel.util.StringBundler; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.StringUtil; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.kernel.xml.Document; +import com.liferay.portal.kernel.xml.DocumentException; +import com.liferay.portal.kernel.xml.Element; +import com.liferay.portal.kernel.xml.SAXReaderUtil; +import com.liferay.portal.struts.AuthPublicPathRegistry; +import com.liferay.portal.util.Portal; +import com.liferay.portal.util.PortalUtil; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + +import java.net.URL; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentSkipListSet; + +import javax.servlet.DispatcherType; +import javax.servlet.Filter; +import javax.servlet.FilterConfig; +import javax.servlet.RequestDispatcher; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletContextAttributeEvent; +import javax.servlet.ServletContextAttributeListener; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; +import javax.servlet.ServletException; +import javax.servlet.ServletRequestAttributeListener; +import javax.servlet.ServletRequestListener; +import javax.servlet.http.HttpSessionActivationListener; +import javax.servlet.http.HttpSessionAttributeListener; +import javax.servlet.http.HttpSessionBindingListener; +import javax.servlet.http.HttpSessionListener; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleReference; +import org.osgi.framework.ServiceRegistration; +import org.osgi.framework.wiring.BundleWiring; +import org.osgi.service.http.HttpContext; +import org.osgi.service.http.NamespaceException; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class BundleServletContext + extends LiferayServletContext implements BundleReference { + + public static String getServletContextName(Bundle bundle) { + return getServletContextName(bundle, false); + } + + public static String getServletContextName( + Bundle bundle, boolean generate) { + + Dictionary headers = bundle.getHeaders(); + + String webContextPath = headers.get("Web-ContextPath"); + + if (Validator.isNotNull(webContextPath)) { + return webContextPath.substring(1); + } + + String deploymentContext = null; + + try { + String pluginPackageXml = HttpUtil.URLtoString( + bundle.getResource("/WEB-INF/liferay-plugin-package.xml")); + + if (pluginPackageXml != null) { + Document document = SAXReaderUtil.read(pluginPackageXml); + + Element rootElement = document.getRootElement(); + + deploymentContext = GetterUtil.getString( + rootElement.elementText("recommended-deployment-context")); + } + else { + String pluginPackageProperties = HttpUtil.URLtoString( + bundle.getResource( + "/WEB-INF/liferay-plugin-package.properties")); + + if (pluginPackageProperties != null) { + if (_log.isDebugEnabled()) { + _log.debug( + "Reading plugin package from " + + "liferay-plugin-package.properties"); + } + + Properties properties = PropertiesUtil.load( + pluginPackageProperties); + + deploymentContext = GetterUtil.getString( + properties.getProperty( + "recommended-deployment-context"), + deploymentContext); + } + } + } + catch (Exception e) { + if (_log.isWarnEnabled()) { + _log.warn(e, e); + } + } + + if (Validator.isNull(deploymentContext) && generate) { + deploymentContext = PortalUtil.getJsSafePortletId( + bundle.getSymbolicName()); + } + + if (Validator.isNotNull(deploymentContext) && + deploymentContext.startsWith(StringPool.SLASH)) { + + deploymentContext = deploymentContext.substring(1); + } + + return deploymentContext; + } + + public BundleServletContext( + Bundle bundle, String servletContextName, + ServletContext servletContext) { + + super(servletContext); + + _bundle = bundle; + + if (servletContextName == null) { + _servletContextName = StringPool.BLANK; + } + else { + _servletContextName = servletContextName; + } + + _httpContext = new DefaultHttpContext(_bundle); + } + + public void close() { + ServletContextPool.remove(_servletContextName); + + _httpServiceTracker.close(); + + try { + _serviceRegistration.unregister(); + } + catch (IllegalStateException ies) { + if (_log.isInfoEnabled()) { + _log.info("The service is already unregistered"); + } + } + + if (_tempDir != null) { + FileUtil.deltree(_tempDir); + } + } + + + public Object getAttribute(String name) { + if (name.equals(JavaConstants.JAVAX_SERVLET_CONTEXT_TEMPDIR)) { + return getTempDir(); + } + else if (name.equals("osgi-bundle")) { + return _bundle; + } + else if (name.equals("osgi-bundlecontext")) { + return _bundle.getBundleContext(); + } + + Object value = _contextAttributes.get(name); + + if (value == null) { + if (name.equals(PluginContextListener.PLUGIN_CLASS_LOADER)) { + return getClassLoader(); + } + else if (name.equals("org.apache.catalina.JSP_PROPERTY_GROUPS")) { + value = new HashMap(); + + _contextAttributes.put(name, value); + } + else if (name.equals("org.apache.tomcat.InstanceManager")) { + return super.getAttribute(name); + } + } + + return value; + } + + + public Bundle getBundle() { + return _bundle; + } + + + public ClassLoader getClassLoader() { + ClassLoader classLoader = (ClassLoader)_contextAttributes.get( + PluginContextListener.PLUGIN_CLASS_LOADER); + + if (classLoader == null) { + BundleWiring bundleWiring = _bundle.adapt(BundleWiring.class); + + classLoader = bundleWiring.getClassLoader(); + + _contextAttributes.put( + PluginContextListener.PLUGIN_CLASS_LOADER, classLoader); + } + + return classLoader; + } + + + public String getContextPath() { + if (_contextPath != null) { + return _contextPath; + } + + StringBundler sb = new StringBundler(4); + + sb.append(PortalUtil.getPathContext()); + sb.append(Portal.PATH_MODULE); + sb.append(StringPool.SLASH); + + String servletContextName = getServletContextName(); + + if (Validator.isNotNull(servletContextName)) { + sb.append(servletContextName); + } + + _contextPath = sb.toString(); + + return _contextPath; + } + + public BundleFilterChain getFilterChain( + String path, DispatcherType dispatcherType) { + + BundleFilterChain bundleFilterChain = new BundleFilterChain(); + + for (FilterServiceRanking filterServiceRanking : + _filterServiceRankings) { + + if (!matchDispatcherType(filterServiceRanking, dispatcherType)) { + continue; + } + + String filterName = filterServiceRanking.getFilterName(); + + Filter filter = _filtersByFilterNames.get(filterName); + + List urlPatterns = filterServiceRanking.getUrlPatterns(); + + for (String urlPattern : urlPatterns) { + if (urlPattern.equals(path)) { + bundleFilterChain.addFilter(filter); + + break; + } + + if (urlPattern.contains(StringPool.STAR)) { + urlPattern = urlPattern.replaceAll( + "\\".concat(StringPool.STAR), ".*"); + } + + if (path.matches(urlPattern)) { + bundleFilterChain.addFilter(filter); + } + } + } + + ExtensionMapping extensionMapping = getMatchingServletKey(path); + + Servlet servlet = _servletsByURLPatterns.get( + extensionMapping.getPath()); + + bundleFilterChain.setServlet(servlet); + + return bundleFilterChain; + } + + public HttpContext getHttpContext() { + return _httpContext; + } + + + public String getInitParameter(String name) { + return _initParameters.get(name); + } + + + public Enumeration getInitParameterNames() { + return Collections.enumeration(_initParameters.keySet()); + } + + public ExtensionMapping getMatchingServletKey(String path) { + if (_servletsByURLPatterns.containsKey(path)) { + return new ExtensionMapping(false, path); + } + + String extension = StringUtil.toLowerCase(FileUtil.getExtension(path)); + + boolean extensionMapping = false; + + if (Validator.isNotNull(extension)) { + extension = "*.".concat(extension); + + extensionMapping = true; + } + + String alias = path.substring(0, path.lastIndexOf(StringPool.SLASH)); + + while (alias.length() != 0) { + if (_servletsByURLPatterns.containsKey(alias)) { + return new ExtensionMapping(false, alias); + } + else if (_servletsByURLPatterns.containsKey( + alias.concat(extension))) { + + return new ExtensionMapping(true, alias.concat(extension)); + } + + alias = path.substring(0, alias.lastIndexOf(StringPool.SLASH)); + } + + if (_servletsByURLPatterns.containsKey( + StringPool.SLASH.concat(extension))) { + + return new ExtensionMapping( + extensionMapping, StringPool.SLASH.concat(extension)); + } + + if (_servletsByURLPatterns.containsKey(StringPool.SLASH)) { + return new ExtensionMapping(false, StringPool.SLASH); + } + + return null; + } + + + public String getRealPath(String path) { + URL url = _httpContext.getResource(path); + + if (url != null) { + return url.toExternalForm(); + } + + return path; + } + + + public RequestDispatcher getRequestDispatcher(String path) { + String contextPath = getContextPath(); + + String portalContextPath = PortalUtil.getPathContext(); + + if (Validator.isNotNull(portalContextPath)) { + if (contextPath.startsWith(portalContextPath)) { + contextPath = contextPath.substring(portalContextPath.length()); + } + + if (path.startsWith(portalContextPath)) { + path = path.substring(portalContextPath.length()); + } + } + + if (path.startsWith(contextPath)) { + path = path.substring(contextPath.length()); + } + + if (Validator.isNull(path)) { + path = StringPool.SLASH; + } + + if (!isValidPath(path)) { + return null; + } + + ExtensionMapping extensionMapping = getMatchingServletKey(path); + + if (extensionMapping != null) { + return new BundleRequestDispatcher( + extensionMapping.getPath(), extensionMapping.isExtension(), + path, this); + } + + return null; + } + + + public URL getResource(String path) { + return _httpContext.getResource(path); + } + + + public InputStream getResourceAsStream(String path) { + try { + URL url = getResource(path); + + if (url != null) { + return url.openStream(); + } + } + catch (IOException ioe) { + _log.error(ioe, ioe); + } + + return null; + } + + + public Set getResourcePaths(String path) { + Set paths = new HashSet(); + + Enumeration enumeration = _bundle.getEntryPaths(path); + + if (enumeration == null) { + return Collections.emptySet(); + } + + while (enumeration.hasMoreElements()) { + String entryPath = enumeration.nextElement(); + + paths.add(StringPool.SLASH.concat(entryPath)); + } + + return paths; + } + + + public Servlet getServlet(String name) { + return _servletsByServletNames.get(name); + } + + + public String getServletContextName() { + return _servletContextName; + } + + public List + getServletRequestAttributeListeners() { + + return _servletRequestAttributeListeners; + } + + public List getServletRequestListeners() { + return _servletRequestListeners; + } + + public void open() throws DocumentException { + Hashtable properties = new Hashtable(); + + properties.put("bundle", _bundle); + properties.put("bundle.id", _bundle.getBundleId()); + properties.put("bundle.symbolicName", _bundle.getSymbolicName()); + properties.put("bundle.version", _bundle.getVersion()); + properties.put("Web-ContextPath", getContextPath()); + + BundleContext bundleContext = _bundle.getBundleContext(); + + _serviceRegistration = + (ServiceRegistration) + bundleContext.registerService( + new String[] { + BundleServletContext.class.getName(), + ServletContext.class.getName() + }, + this, properties); + + _httpServiceTracker = new HttpServiceTracker(bundleContext, _bundle); + + _httpServiceTracker.open(); + } + + public void registerFilter( + String filterName, List urlPatterns, Filter filter, + Map initParameters, HttpContext httpContext) + throws NamespaceException, ServletException { + + validateFilter(filterName, filter, urlPatterns, httpContext); + + Thread currentThread = Thread.currentThread(); + + ClassLoader contextClassLoader = currentThread.getContextClassLoader(); + + try { + currentThread.setContextClassLoader(getClassLoader()); + + FilterConfig filterConfig = new BundleFilterConfig( + this, filterName, initParameters, httpContext); + + filter.init(filterConfig); + + _filtersByFilterNames.put(filterName, filter); + + if (_log.isInfoEnabled()) { + _log.info("Registered filter " + filterName); + } + + for (String urlPattern : urlPatterns) { + _filtersByURLPatterns.put(urlPattern, filter); + + if (_log.isInfoEnabled()) { + _log.info( + "Mapped filter " + filterName + " to " + + getContextPath() + urlPattern); + } + } + + FilterServiceRanking filterServiceRanking = + new FilterServiceRanking(); + + filterServiceRanking.setFilterName(filterName); + + int serviceRanking = _FILTER_SERVICE_RANKING_DEFAULT; + + if (initParameters != null) { + serviceRanking = GetterUtil.getInteger( + initParameters.remove("service.ranking"), + _FILTER_SERVICE_RANKING_DEFAULT); + } + + filterServiceRanking.setServiceRanking(serviceRanking); + filterServiceRanking.setUrlPattterns(urlPatterns); + filterServiceRanking.setDispatcherType( + getDispatcher(initParameters)); + + // Filters are sorted based on their service ranking value where the + // default service ranking is 10 for those filters that do not + // specify a specific service ranking. + + // Filters are first sorted based on the service ranking where + // filters with a smaller service ranking appear earlier in the + // list, and then based on when the filter was registered where + // those that are registered earlier appear earlier in the list. + + _filterServiceRankings.add(filterServiceRanking); + } + finally { + currentThread.setContextClassLoader(contextClassLoader); + } + } + + public void registerFilter( + String filterName, String urlPattern, Filter filter, + Map initParameters, HttpContext httpContext) + throws NamespaceException, ServletException { + + List urlPatterns = Arrays.asList(urlPattern); + + registerFilter( + filterName, urlPatterns, filter, initParameters, httpContext); + } + + public void registerListener( + Object listener, Map initParameters, + HttpContext httpContext) { + + Thread currentThread = Thread.currentThread(); + + ClassLoader contextClassLoader = currentThread.getContextClassLoader(); + + boolean enabled = DependencyManagementThreadLocal.isEnabled(); + + try { + currentThread.setContextClassLoader(getClassLoader()); + + DependencyManagementThreadLocal.setEnabled(false); + + if (initParameters != null) { + Set> set = initParameters.entrySet(); + + Iterator> iterator = set.iterator(); + + while (iterator.hasNext()) { + Entry entry = iterator.next(); + + String value = entry.getValue(); + + if (_initParameters.containsKey(value)) { + continue; + } + + _initParameters.put(entry.getKey(), value); + } + } + + if (listener instanceof HttpSessionActivationListener) { + PortletSessionListenerManager.addHttpSessionActivationListener( + (HttpSessionActivationListener)listener); + } + + if (listener instanceof HttpSessionAttributeListener) { + PortletSessionListenerManager.addHttpSessionAttributeListener( + (HttpSessionAttributeListener)listener); + } + + if (listener instanceof HttpSessionBindingListener) { + PortletSessionListenerManager.addHttpSessionBindingListener( + (HttpSessionBindingListener)listener); + } + + if (listener instanceof HttpSessionListener) { + PortletSessionListenerManager.addHttpSessionListener( + (HttpSessionListener)listener); + } + + if (listener instanceof ServletContextAttributeListener) { + _servletContextAttributeListeners.add( + (ServletContextAttributeListener)listener); + } + + if (listener instanceof ServletContextListener) { + ServletContextListener servletContextListener = + (ServletContextListener)listener; + + ServletContextEvent servletContextEvent = + new ServletContextEvent(this); + + servletContextListener.contextInitialized(servletContextEvent); + + _servletContextListeners.add(servletContextListener); + } + + if (listener instanceof ServletRequestAttributeListener) { + _servletRequestAttributeListeners.add( + (ServletRequestAttributeListener)listener); + } + + if (listener instanceof ServletRequestListener) { + _servletRequestListeners.add((ServletRequestListener)listener); + } + } + finally { + DependencyManagementThreadLocal.setEnabled(enabled); + + currentThread.setContextClassLoader(contextClassLoader); + } + } + + public void registerResources( + String alias, String name, HttpContext httpContext) + throws NamespaceException { + + Map initParameters = new Hashtable(); + + initParameters.put("alias", alias); + + if (name == null) { + throw new IllegalArgumentException("Name is null"); + } + + if (name.endsWith(StringPool.SLASH) && !name.equals(StringPool.SLASH)) { + throw new IllegalArgumentException("Invalid name " + name); + } + + initParameters.put("name", name); + + Servlet resourceServlet = new ResourceServlet(); + + try { + registerServlet( + name, alias, resourceServlet, initParameters, httpContext); + + StringBundler sb = new StringBundler(4); + + sb.append(Portal.PATH_MODULE); + sb.append(StringPool.SLASH); + + String servletContextName = getServletContextName(); + + if (Validator.isNotNull(servletContextName)) { + sb.append(servletContextName); + } + + sb.append(alias); + + AuthPublicPathRegistry.register(sb.toString()); + } + catch (ServletException se) { + throw new IllegalArgumentException(se); + } + } + + public void registerServlet( + String servletName, List urlPatterns, Servlet servlet, + Map initParameters, HttpContext httpContext) + throws NamespaceException, ServletException { + + validateServlet(servletName, servlet, urlPatterns, httpContext); + + Thread currentThread = Thread.currentThread(); + + ClassLoader contextClassLoader = currentThread.getContextClassLoader(); + + try { + currentThread.setContextClassLoader(getClassLoader()); + + ServletConfig servletConfig = new BundleServletConfig( + this, servletName, initParameters, httpContext); + + servlet.init(servletConfig); + + _servletsByServletNames.put(servletName, servlet); + + if (_log.isInfoEnabled()) { + _log.info("Registered servlet " + servletName); + } + + for (String urlPattern : urlPatterns) { + _servletsByURLPatterns.put(urlPattern, servlet); + + if (_log.isInfoEnabled()) { + _log.info( + "Mapped servlet " + servletName + " to " + + getContextPath() + urlPattern); + } + } + } + finally { + currentThread.setContextClassLoader(contextClassLoader); + } + } + + public void registerServlet( + String servletName, String urlPattern, Servlet servlet, + Map initParameters, HttpContext httpContext) + throws NamespaceException, ServletException { + + List urlPatterns = Arrays.asList(urlPattern); + + registerServlet( + servletName, urlPatterns, servlet, initParameters, httpContext); + } + + + public void removeAttribute(String name) { + Object value = _contextAttributes.remove(name); + + for (ServletContextAttributeListener servletContextAttributeListener : + _servletContextAttributeListeners) { + + servletContextAttributeListener.attributeRemoved( + new ServletContextAttributeEvent(this, name, value)); + } + } + + + public void setAttribute(String name, Object value) { + if (name.equals(JavaConstants.JAVAX_SERVLET_CONTEXT_TEMPDIR) || + name.equals(PluginContextListener.PLUGIN_CLASS_LOADER)) { + + return; + } + + Object originalValue = _contextAttributes.get(name); + + _contextAttributes.put(name, value); + + for (ServletContextAttributeListener servletContextAttributeListener : + _servletContextAttributeListeners) { + + ServletContextAttributeEvent servletContextAttributeEvent = + new ServletContextAttributeEvent(this, name, value); + + if (originalValue != null) { + servletContextAttributeListener.attributeReplaced( + servletContextAttributeEvent); + } + else { + servletContextAttributeListener.attributeAdded( + servletContextAttributeEvent); + } + } + } + + public void setServletContextName(String servletContextName) { + _servletContextName = servletContextName; + } + + public void unregisterFilter(String filterName) { + Filter filter = _filtersByFilterNames.remove(filterName); + + if (filter == null) { + return; + } + + filter.destroy(); + + unregisterFilterByServiceRanking(filterName); + unregisterFilterByURLMapping(filterName, filter); + } + + public void unregisterListener(Object listener) { + Thread currentThread = Thread.currentThread(); + + ClassLoader contextClassLoader = currentThread.getContextClassLoader(); + + boolean enabled = DependencyManagementThreadLocal.isEnabled(); + + try { + currentThread.setContextClassLoader(getClassLoader()); + + DependencyManagementThreadLocal.setEnabled(false); + + if (listener instanceof HttpSessionActivationListener) { + PortletSessionListenerManager. + removeHttpSessionActivationListener( + (HttpSessionActivationListener)listener); + } + + if (listener instanceof HttpSessionAttributeListener) { + PortletSessionListenerManager. + removeHttpSessionAttributeListener( + (HttpSessionAttributeListener)listener); + } + + if (listener instanceof HttpSessionBindingListener) { + PortletSessionListenerManager.removeHttpSessionBindingListener( + (HttpSessionBindingListener)listener); + } + + if (listener instanceof HttpSessionListener) { + PortletSessionListenerManager.removeHttpSessionListener( + (HttpSessionListener)listener); + } + + if (listener instanceof ServletContextAttributeListener) { + _servletContextAttributeListeners.remove(listener); + } + + if (listener instanceof ServletContextListener) { + if (_servletContextListeners.contains(listener)) { + _servletContextListeners.remove(listener); + + ServletContextListener servletContextListener = + (ServletContextListener)listener; + + ServletContextEvent servletContextEvent = + new ServletContextEvent(this); + + servletContextListener.contextDestroyed( + servletContextEvent); + } + } + + if (listener instanceof ServletRequestAttributeListener) { + _servletRequestAttributeListeners.remove(listener); + } + + if (listener instanceof ServletRequestListener) { + _servletRequestListeners.remove(listener); + } + } + finally { + DependencyManagementThreadLocal.setEnabled(enabled); + + currentThread.setContextClassLoader(contextClassLoader); + } + } + + public void unregisterServlet(String servletName) { + Servlet servlet = _servletsByServletNames.remove(servletName); + + if (servlet == null) { + return; + } + + servlet.destroy(); + + Set> set = _servletsByURLPatterns.entrySet(); + + Iterator> iterator = set.iterator(); + + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + + Servlet curServlet = entry.getValue(); + + if (curServlet != servlet) { + continue; + } + + StringBundler sb = new StringBundler(4); + + sb.append(Portal.PATH_MODULE); + sb.append(StringPool.SLASH); + + String servletContextName = getServletContextName(); + + if (Validator.isNotNull(servletContextName)) { + sb.append(servletContextName); + } + + String alias = entry.getKey(); + + sb.append(alias); + + AuthPublicPathRegistry.unregister(alias); + + iterator.remove(); + + if (_log.isInfoEnabled()) { + String urlPattern = entry.getKey(); + + _log.info("Unmapped servlet " + servletName + " from " + alias); + } + } + + if (_log.isInfoEnabled()) { + _log.info("Unregistered servlet " + servletName); + } + } + + protected DispatcherType getDispatcher(Map parameters) { + if (parameters == null) { + return DispatcherType.REQUEST; + } + + String dispatcher = parameters.get("dispatcher"); + + if (DispatcherType.ASYNC.name().equals(dispatcher)) { + return DispatcherType.ASYNC; + } + else if (DispatcherType.ERROR.name().equals(dispatcher)) { + return DispatcherType.ERROR; + } + else if (DispatcherType.FORWARD.name().equals(dispatcher)) { + return DispatcherType.FORWARD; + } + else if (DispatcherType.INCLUDE.name().equals(dispatcher)) { + return DispatcherType.INCLUDE; + } + + return DispatcherType.REQUEST; + } + + protected File getTempDir() { + if (_tempDir != null) { + return _tempDir; + } + + File parentTempDir = (File)super.getAttribute( + JavaConstants.JAVAX_SERVLET_CONTEXT_TEMPDIR); + + String fileName = getServletContextName(); + + if (Validator.isNull(fileName)) { + fileName = String.valueOf(_bundle.getBundleId()); + } + + File tempDir = new File(parentTempDir, fileName); + + if (!tempDir.exists() && !tempDir.mkdirs()) { + throw new IllegalStateException( + "Unable to make temporary directory " + tempDir); + } + + _tempDir = tempDir; + + return _tempDir; + } + + protected boolean isValidPath(String path) { + if (!path.startsWith(StringPool.SLASH)) { + path = StringPool.SLASH.concat(path); + } + + for (String illegalPath : _ILLEGAL_PATHS) { + if (path.startsWith(illegalPath)) { + return false; + } + } + + return true; + } + + protected boolean matchDispatcherType( + FilterServiceRanking filterServiceRanking, + DispatcherType dispatcherType) { + + DispatcherType targetDispatcherType = + filterServiceRanking.getDispatcherType(); + + return targetDispatcherType.equals(dispatcherType); + } + + protected void unregisterFilterByServiceRanking(String filterName) { + Iterator iterator = + _filterServiceRankings.iterator(); + + while (iterator.hasNext()) { + FilterServiceRanking filterServiceRanking = iterator.next(); + + if (!filterName.equals(filterServiceRanking.getFilterName())) { + continue; + } + + iterator.remove(); + } + } + + protected void unregisterFilterByURLMapping( + String filterName, Filter filter) { + + Set> set = _filtersByURLPatterns.entrySet(); + + Iterator> iterator = set.iterator(); + + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + + Filter curFilter = entry.getValue(); + + if (curFilter != filter) { + continue; + } + + iterator.remove(); + + if (_log.isInfoEnabled()) { + String urlPattern = entry.getKey(); + + _log.info( + "Unmapped filter " + filterName + " from " + urlPattern); + } + } + + if (_log.isInfoEnabled()) { + _log.info("Unregistered filter " + filterName); + } + } + + protected void validateFilter( + String filterName, Filter filter, List urlPatterns, + HttpContext httpContext) + throws NamespaceException { + + if (filter == null) { + throw new IllegalArgumentException("Filter must not be null"); + } + + Filter registeredFilter = _filtersByFilterNames.get(filterName); + + if ((registeredFilter != null) && (registeredFilter != filter)) { + throw new NamespaceException( + "A filter is already registered with the name " + filterName); + } + + for (String urlPattern : urlPatterns) { + validateURLPattern(urlPattern); + } + } + + protected void validateServlet( + String servletName, Servlet servlet, List urlPatterns, + HttpContext httpContext) + throws NamespaceException { + + if (servlet == null) { + throw new IllegalArgumentException("Servlet must not be null"); + } + + Servlet registeredServlet = _servletsByServletNames.get(servletName); + + if ((registeredServlet != null) && (registeredServlet != servlet)) { + throw new NamespaceException( + "A servlet is already registered with the name " + servletName); + } + + for (String urlPattern : urlPatterns) { + validateURLPattern(urlPattern); + + if (_servletsByURLPatterns.containsKey(urlPattern)) { + throw new NamespaceException( + "A servlet is already registered with the URL pattern " + + urlPattern); + } + } + } + + protected void validateURLPattern(String urlPattern) { + if (Validator.isNull(urlPattern)) { + throw new IllegalArgumentException( + "An empty URL pattern is not allowed"); + } + + if (!urlPattern.startsWith(StringPool.SLASH) || + (urlPattern.endsWith(StringPool.SLASH) && + !urlPattern.equals(StringPool.SLASH))) { + + throw new IllegalArgumentException( + "URL patterns must start with / but cannot end with it"); + } + } + + private static final int _FILTER_SERVICE_RANKING_DEFAULT = 10; + + private static final String[] _ILLEGAL_PATHS = new String[] { + "/META-INF/", "/OSGI-INF/", "/OSGI-OPT/", "/WEB-INF/" + }; + + private static final String _PATH_MODULE_SLASH = + Portal.PATH_MODULE + StringPool.SLASH; + + private static Log _log = LogFactoryUtil.getLog(BundleServletContext.class); + + private Bundle _bundle; + private Map _contextAttributes = + new ConcurrentHashMap(); + private String _contextPath; + private Map _filtersByFilterNames = + new ConcurrentHashMap(); + private Map _filtersByURLPatterns = + new ConcurrentHashMap(); + private Set _filterServiceRankings = + new ConcurrentSkipListSet( + new FilterServiceRankingComparator()); + private HttpContext _httpContext; + private HttpServiceTracker _httpServiceTracker; + private Map _initParameters = new HashMap(); + private ServiceRegistration _serviceRegistration; + private List + _servletContextAttributeListeners = + new ArrayList(); + private List _servletContextListeners = + new ArrayList(); + private String _servletContextName; + private List + _servletRequestAttributeListeners = + new ArrayList(); + private List _servletRequestListeners = + new ArrayList(); + private Map _servletsByServletNames = + new ConcurrentHashMap(); + private Map _servletsByURLPatterns = + new ConcurrentHashMap(); + private File _tempDir; + + private class ExtensionMapping { + + public ExtensionMapping(boolean extension, String path) { + _extension = extension; + _path = path; + } + + public String getPath() { + return _path; + } + + public boolean isExtension() { + return _extension; + } + + private boolean _extension; + private String _path; + } + + private class FilterServiceRanking { + + + public boolean equals(Object object) { + FilterServiceRanking filterServiceRanking = + (FilterServiceRanking)object; + + if (Validator.equals( + _filterName, filterServiceRanking._filterName) && + Validator.equals( + _serviceRanking, filterServiceRanking._serviceRanking)) { + + return true; + } + + return false; + } + + public DispatcherType getDispatcherType() { + return _dispatcherType; + } + + public String getFilterName() { + return _filterName; + } + + public int getServiceRanking() { + return _serviceRanking; + } + + public long getTimestamp() { + return _timestamp; + } + + public List getUrlPatterns() { + return _urlPatterns; + } + + public void setDispatcherType(DispatcherType dispatcherType) { + _dispatcherType = dispatcherType; + } + + public void setFilterName(String filterName) { + _filterName = filterName; + } + + public void setServiceRanking(int serviceRanking) { + _serviceRanking = serviceRanking; + } + + public void setUrlPattterns(List urlMappings) { + _urlPatterns = urlMappings; + } + + private DispatcherType _dispatcherType; + private String _filterName; + private int _serviceRanking; + private long _timestamp = System.currentTimeMillis(); + private List _urlPatterns; + + } + + private class FilterServiceRankingComparator + implements Comparator { + + + public int compare( + FilterServiceRanking filterServiceRanking1, + FilterServiceRanking filterServiceRanking2) { + + String filterName = filterServiceRanking1.getFilterName(); + + int compareTo = filterName.compareTo( + filterServiceRanking2.getFilterName()); + + if (compareTo != 0) { + return compareTo; + } + + if (filterServiceRanking1.getServiceRanking() < + filterServiceRanking2.getServiceRanking()) { + + return -1; + } + else if (filterServiceRanking1.getServiceRanking() > + filterServiceRanking2.getServiceRanking()) { + + return 1; + } + + if (filterServiceRanking1.getTimestamp() < + filterServiceRanking2.getTimestamp()) { + + return -1; + } + else if (filterServiceRanking1.getTimestamp() > + filterServiceRanking2.getTimestamp()) { + + return 1; + } + + return 0; + } + } + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleServletRequest.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleServletRequest.java new file mode 100644 index 0000000..3f0ff11 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleServletRequest.java @@ -0,0 +1,212 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.servlet; + +import com.liferay.portal.kernel.util.JavaConstants; +import com.liferay.portal.kernel.util.SetUtil; +import com.liferay.portal.kernel.util.UniqueList; +import com.liferay.portal.kernel.util.WebKeys; + +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequestAttributeEvent; +import javax.servlet.ServletRequestAttributeListener; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import javax.servlet.http.HttpSession; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class BundleServletRequest extends HttpServletRequestWrapper { + + public BundleServletRequest( + BundleRequestDispatcher bundleRequestDispatcher, + HttpServletRequest request) { + + super(request); + + _bundleRequestDispatcher = bundleRequestDispatcher; + + _bundleServletContext = + _bundleRequestDispatcher.getBundleServletContext(); + + _session = new BundleSession( + _bundleServletContext, request.getSession()); + } + + + public Object getAttribute(String name) { + if ((name.equals( + JavaConstants.JAVAX_SERVLET_FORWARD_SERVLET_PATH) || + name.equals(WebKeys.INVOKER_FILTER_URI)) && + _attributes.containsKey(WebKeys.SERVLET_PATH)) { + + return _attributes.get(WebKeys.SERVLET_PATH); + } + + if (_maskedAttributes.contains(name)) { + return _attributes.get(name); + } + + return super.getAttribute(name); + } + + + public Enumeration getAttributeNames() { + List attributeNames = new UniqueList(); + + Enumeration enumeration = super.getAttributeNames(); + + while (enumeration.hasMoreElements()) { + String name = enumeration.nextElement(); + + attributeNames.add(name); + } + + attributeNames.addAll(_attributes.keySet()); + + return Collections.enumeration(attributeNames); + } + + + public String getContextPath() { + return _bundleServletContext.getContextPath(); + } + + + public String getPathInfo() { + return _bundleRequestDispatcher.getPathInfo(); + } + + + public RequestDispatcher getRequestDispatcher(String path) { + RequestDispatcher requestDispatcher = + _bundleServletContext.getRequestDispatcher(path); + + if (requestDispatcher != null) { + return requestDispatcher; + } + + return super.getRequestDispatcher(path); + } + + + public String getRequestURI() { + String contextPath = getContextPath(); + + return contextPath.concat(_bundleRequestDispatcher.getRequestURI()); + } + + + public String getServletPath() { + return _bundleRequestDispatcher.getServletPath(); + } + + + public HttpSession getSession() { + return _session; + } + + + public HttpSession getSession(boolean create) { + return _session; + } + + + public void removeAttribute(String name) { + Object oldValue = null; + + if (_maskedAttributes.contains(name)) { + oldValue = _attributes.remove(name); + } + else { + oldValue = super.getAttribute(name); + + super.removeAttribute(name); + } + + List servletRequestAttributeListeners = + _bundleServletContext.getServletRequestAttributeListeners(); + + for (ServletRequestAttributeListener servletRequestAttributeListener : + servletRequestAttributeListeners) { + + ServletRequestAttributeEvent servletRequestAttributeEvent = + new ServletRequestAttributeEvent( + _bundleServletContext, this, name, oldValue); + + servletRequestAttributeListener.attributeReplaced( + servletRequestAttributeEvent); + } + } + + + public void setAttribute(String name, Object value) { + Object oldValue = null; + + if (_maskedAttributes.contains(name)) { + oldValue = _attributes.put(name, value); + } + else { + oldValue = super.getAttribute(name); + + super.setAttribute(name, value); + } + + List servletRequestAttributeListeners = + _bundleServletContext.getServletRequestAttributeListeners(); + + for (ServletRequestAttributeListener servletRequestAttributeListener : + servletRequestAttributeListeners) { + + ServletRequestAttributeEvent servletRequestAttributeEvent = + new ServletRequestAttributeEvent( + _bundleServletContext, this, name, oldValue); + + if (oldValue != null) { + servletRequestAttributeListener.attributeReplaced( + servletRequestAttributeEvent); + } + else { + servletRequestAttributeListener.attributeAdded( + servletRequestAttributeEvent); + } + } + } + + private static Set _maskedAttributes = SetUtil.fromArray( + new String[] { + JavaConstants.JAVAX_SERVLET_ERROR_REQUEST_URI, + JavaConstants.JAVAX_SERVLET_FORWARD_CONTEXT_PATH, + JavaConstants.JAVAX_SERVLET_FORWARD_SERVLET_PATH, + JavaConstants.JAVAX_SERVLET_INCLUDE_PATH_INFO, + JavaConstants.JAVAX_SERVLET_INCLUDE_QUERY_STRING, + WebKeys.INVOKER_FILTER_URI, WebKeys.SERVLET_PATH + }); + + private Map _attributes = new HashMap(); + private BundleRequestDispatcher _bundleRequestDispatcher; + private BundleServletContext _bundleServletContext; + private HttpSession _session; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleSession.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleSession.java new file mode 100644 index 0000000..541e3a0 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/BundleSession.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.servlet; + +import com.liferay.portal.kernel.servlet.HttpSessionWrapper; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpSession; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class BundleSession extends HttpSessionWrapper { + + public BundleSession(ServletContext servletContext, HttpSession session) { + super(session); + + _servletContext = servletContext; + } + + + public ServletContext getServletContext() { + return _servletContext; + } + + private ServletContext _servletContext; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/WebExtenderServlet.java b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/WebExtenderServlet.java new file mode 100644 index 0000000..08bdcb0 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/internal/servlet/WebExtenderServlet.java @@ -0,0 +1,257 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.servlet; + +import com.liferay.portal.http.service.internal.http.ExtendedHttpService; +import com.liferay.portal.http.service.internal.http.FilterTracker; +import com.liferay.portal.http.service.internal.http.HttpServiceFactory; +import com.liferay.portal.http.service.internal.http.HttpSupport; +import com.liferay.portal.http.service.internal.http.ServletTracker; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.servlet.PortletServlet; +import com.liferay.portal.kernel.servlet.ServletContextPool; +import com.liferay.portal.kernel.util.JavaConstants; +import com.liferay.portal.kernel.util.ReleaseInfo; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.kernel.util.WebKeys; +import com.liferay.portal.model.Portlet; +import com.liferay.portal.model.PortletApp; +import com.liferay.portal.model.PortletConstants; +import com.liferay.portal.service.PortletLocalServiceUtil; +import com.liferay.portal.util.Portal; +import com.liferay.portal.util.PortalUtil; + +import java.io.IOException; + +import java.util.Enumeration; +import java.util.Hashtable; + +import javax.servlet.Filter; +import javax.servlet.RequestDispatcher; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.http.HttpService; +import org.osgi.util.tracker.ServiceTracker; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class WebExtenderServlet extends PortletServlet { + + public WebExtenderServlet(BundleContext bundleContext) { + _bundleContext = bundleContext; + } + + + public void destroy() { + _filterTracker.close(); + _httpServiceRegistration.unregister(); + _httpServletRegistration.unregister(); + _servletTracker.close(); + + super.destroy(); + } + + public BundleContext getBundleContext() { + return _bundleContext; + } + + + public void init(ServletConfig servletConfig) throws ServletException { + super.init(servletConfig); + + HttpSupport httpSupport = new HttpSupport(_bundleContext, this); + + HttpServiceFactory httpServiceFactory = new HttpServiceFactory( + httpSupport); + + _filterTracker = new ServiceTracker( + _bundleContext, Filter.class, new FilterTracker(httpSupport)); + + _filterTracker.open(); + + Hashtable properties = new Hashtable(); + + properties.put("bean.id", HttpService.class.getName()); + properties.put("original.bean", Boolean.TRUE); + properties.put("service.vendor", ReleaseInfo.getVendor()); + + _httpServiceRegistration = _bundleContext.registerService( + new String[] { + ExtendedHttpService.class.getName(), + HttpService.class.getName(), + }, + httpServiceFactory, properties); + + properties.put("bean.id", HttpServlet.class.getName()); + + _httpServletRegistration = _bundleContext.registerService( + HttpServlet.class, this, properties); + + _servletTracker = new ServiceTracker( + _bundleContext, Servlet.class, new ServletTracker(httpSupport)); + + _servletTracker.open(); + } + + + public void service( + HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + + printHeaders(request); + + String portletId = (String)request.getAttribute(WebKeys.PORTLET_ID); + String requestURI = request.getRequestURI(); + + String includeRequestURI = (String)request.getAttribute( + JavaConstants.JAVAX_SERVLET_INCLUDE_PATH_INFO); + + if (Validator.isNotNull(includeRequestURI)) { + requestURI = includeRequestURI; + } + + ServletContext servletContext = getServletContext( + portletId, requestURI); + + if (servletContext == null) { + response.sendError( + HttpServletResponse.SC_NOT_FOUND, + "No servlet or resource mapped to " + requestURI); + + return; + } + + service(request, response, servletContext, portletId, requestURI); + } + + protected ServletContext getServletContext( + String portletId, String requestURI) { + + Portlet portlet = null; + + if (Validator.isNotNull(portletId)) { + try { + String rootPortletId = PortletConstants.getRootPortletId( + portletId); + + portlet = PortletLocalServiceUtil.getPortletById(rootPortletId); + } + catch (Exception e) { + if (_log.isDebugEnabled()) { + _log.debug(e, e); + } + } + } + + String servletContextName = null; + + if (portlet != null) { + PortletApp portletApp = portlet.getPortletApp(); + + servletContextName = portletApp.getServletContextName(); + } + else if (requestURI != null) { + servletContextName = requestURI; + + String contextPath = PortalUtil.getPathContext(); + + if (Validator.isNotNull(contextPath) && + servletContextName.startsWith(contextPath)) { + + servletContextName = servletContextName.substring( + contextPath.length()); + } + + String modulePath = Portal.PATH_MODULE + StringPool.SLASH; + + if (servletContextName.startsWith(modulePath)) { + servletContextName = servletContextName.substring( + modulePath.length()); + } + + if (servletContextName.startsWith(StringPool.SLASH)) { + servletContextName = servletContextName.substring(1); + } + + int index = servletContextName.indexOf(StringPool.SLASH); + + if (index != -1) { + servletContextName = servletContextName.substring(0, index); + } + } + + return ServletContextPool.get(servletContextName); + } + + protected void printHeaders(HttpServletRequest request) { + if (!_log.isDebugEnabled()) { + return; + } + + Enumeration enumeration = request.getHeaderNames(); + + while (enumeration.hasMoreElements()) { + Object name = enumeration.nextElement(); + + _log.debug(name + " = " + request.getHeader(String.valueOf(name))); + } + } + + protected void service( + HttpServletRequest request, HttpServletResponse response, + ServletContext servletContext, String portletId, String requestURI) + throws IOException, ServletException { + + RequestDispatcher requestDispatcher = + servletContext.getRequestDispatcher(requestURI); + + if (requestDispatcher != null) { + requestDispatcher.forward(request, response); + + return; + } + + if (requestURI.endsWith("/invoke") && Validator.isNotNull(portletId)) { + super.service(request, response); + + return; + } + + response.sendError( + HttpServletResponse.SC_NOT_FOUND, + "No servlet or resource mapped to " + requestURI); + } + + private static Log _log = LogFactoryUtil.getLog(WebExtenderServlet.class); + + private BundleContext _bundleContext; + private ServiceTracker _filterTracker; + private ServiceRegistration _httpServiceRegistration; + private ServiceRegistration _httpServletRegistration; + private ServiceTracker _servletTracker; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/servlet/BundleServletConfig.java b/shared/portal-http-service/src/com/liferay/portal/http/service/servlet/BundleServletConfig.java new file mode 100644 index 0000000..dce9f40 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/servlet/BundleServletConfig.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.servlet; + +import java.util.Collections; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Map; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; + +import org.osgi.service.http.HttpContext; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class BundleServletConfig implements ServletConfig { + + public BundleServletConfig( + ServletContext servletContext, String servletName, + Map initParameters, HttpContext httpContext) { + + _servletContext = servletContext; + _servletName = servletName; + _initParameters = initParameters; + + if (_initParameters == null) { + _initParameters = new Hashtable(); + } + + _httpContext = httpContext; + } + + public HttpContext getHttpContext() { + return _httpContext; + } + + + public String getInitParameter(String name) { + return _initParameters.get(name); + } + + + public Enumeration getInitParameterNames() { + return Collections.enumeration(_initParameters.keySet()); + } + + public Map getInitParameters() { + return _initParameters; + } + + + public ServletContext getServletContext() { + return _servletContext; + } + + + public String getServletName() { + return _servletName; + } + + public void setInitParameter(String name, String value) { + _initParameters.put(name, value); + } + + private HttpContext _httpContext; + private Map _initParameters; + private ServletContext _servletContext; + private String _servletName; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/servlet/ResourceServlet.java b/shared/portal-http-service/src/com/liferay/portal/http/service/servlet/ResourceServlet.java new file mode 100644 index 0000000..95c6050 --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/servlet/ResourceServlet.java @@ -0,0 +1,168 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.servlet; + +import com.liferay.portal.kernel.servlet.HttpHeaders; +import com.liferay.portal.kernel.servlet.ServletResponseUtil; +import com.liferay.portal.kernel.util.GetterUtil; +import com.liferay.portal.kernel.util.JavaConstants; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.webserver.WebServerServlet; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +import java.net.URL; +import java.net.URLConnection; +import java.net.URLDecoder; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osgi.service.http.HttpContext; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class ResourceServlet extends WebServerServlet { + + + public void init(ServletConfig servletConfig) { + _bundleServletConfig = (BundleServletConfig)servletConfig; + + _httpContext = _bundleServletConfig.getHttpContext(); + + _alias = GetterUtil.getString( + _bundleServletConfig.getInitParameter("alias")); + _name = GetterUtil.getString( + _bundleServletConfig.getInitParameter("name")); + } + + + public void service( + HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + + String requestURI = getRequestURI(request); + + try { + int aliasIndex = requestURI.indexOf(_alias); + + if (aliasIndex == 0) { + requestURI = requestURI.substring(_alias.length()); + } + + if (Validator.isNotNull(_name)) { + requestURI = _name.concat(requestURI); + } + + URL url = _httpContext.getResource(requestURI); + + if (url == null) { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + + return; + } + + URLConnection urlConnection = url.openConnection(); + + long lastModified = urlConnection.getLastModified(); + + if (lastModified > 0) { + long ifModifiedSince = request.getDateHeader( + HttpHeaders.IF_MODIFIED_SINCE); + + if ((ifModifiedSince > 0) && + (ifModifiedSince == lastModified)) { + + response.setContentLength(0); + + response.setDateHeader( + HttpHeaders.LAST_MODIFIED, lastModified); + + String ifNoneMatch = request.getHeader( + HttpHeaders.IF_NONE_MATCH); + + if (Validator.isNotNull(ifNoneMatch) && + !ifNoneMatch.equals('0')) { + + response.setHeader(HttpHeaders.ETAG, ifNoneMatch); + } + + response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); + + return; + } + } + + if (lastModified > 0) { + response.setDateHeader(HttpHeaders.LAST_MODIFIED, lastModified); + } + + String fileName = getRequestURI(request); + + int slashIndex = fileName.lastIndexOf(StringPool.SLASH); + + if (slashIndex != -1) { + fileName = fileName.substring(slashIndex + 1); + } + + String contentType = _httpContext.getMimeType(fileName); + + if (isSupportsRangeHeader(contentType)) { + ServletResponseUtil.sendFileWithRangeHeader( + request, response, fileName, urlConnection.getInputStream(), + urlConnection.getContentLength(), contentType); + } + else { + ServletResponseUtil.sendFile( + request, response, fileName, urlConnection.getInputStream(), + urlConnection.getContentLength(), contentType); + } + } + catch (Exception e) { + request.setAttribute( + JavaConstants.JAVAX_SERVLET_ERROR_EXCEPTION, e); + + response.sendError( + HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); + } + } + + protected String getRequestURI(HttpServletRequest request) + throws UnsupportedEncodingException { + + String requestURI = URLDecoder.decode( + request.getRequestURI(), StringPool.UTF8); + + String contextPath = request.getContextPath(); + + if (!contextPath.equals(StringPool.SLASH)) { + requestURI = requestURI.substring(contextPath.length()); + } + + return requestURI; + } + + private String _alias; + private BundleServletConfig _bundleServletConfig; + private HttpContext _httpContext; + private String _name; + +} \ No newline at end of file diff --git a/shared/portal-http-service/src/com/liferay/portal/http/service/ws/axis/AxisConfigurationFactory.java b/shared/portal-http-service/src/com/liferay/portal/http/service/ws/axis/AxisConfigurationFactory.java new file mode 100644 index 0000000..082117f --- /dev/null +++ b/shared/portal-http-service/src/com/liferay/portal/http/service/ws/axis/AxisConfigurationFactory.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.ws.axis; + +import org.apache.axis.EngineConfiguration; +import org.apache.axis.EngineConfigurationFactory; +import org.apache.axis.configuration.EngineConfigurationFactoryDefault; + +/** + * @author Raymond Augé + * @author Miguel Pastor + */ +public class AxisConfigurationFactory implements EngineConfigurationFactory { + + public AxisConfigurationFactory() { + _engineConfigurationFactory = + EngineConfigurationFactoryDefault.newFactory(null); + } + + + public EngineConfiguration getClientEngineConfig() { + return _engineConfigurationFactory.getClientEngineConfig(); + } + + + public EngineConfiguration getServerEngineConfig() { + return _engineConfigurationFactory.getServerEngineConfig(); + } + + private EngineConfigurationFactory _engineConfigurationFactory; + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/FilterDefinitionTest.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/FilterDefinitionTest.java new file mode 100644 index 0000000..813f467 --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/FilterDefinitionTest.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.definition; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.Filter; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.mockito.Mock; + +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * @author Miguel Pastor + */ +@RunWith(PowerMockRunner.class) +public class FilterDefinitionTest { + + @Before + public void setUp() { + _filterDefinition = new FilterDefinition(); + } + + @Test + public void testAddMultipleURLPatterns() { + String urlPattern = "/o/module"; + + List urlPatterns = new ArrayList(); + + for (int i = 0; i < 10; i++) { + urlPatterns.add(urlPattern + "/" + i); + } + + _filterDefinition.setURLPatterns(urlPatterns); + + urlPatterns = _filterDefinition.getURLPatterns(); + + Assert.assertEquals(10, urlPatterns.size()); + + for (int i = 0; i < 10; i++) { + Assert.assertEquals(urlPattern + "/" + i, urlPatterns.get(i)); + } + } + + @Test + public void testAddSingleURLPattern() { + String urlPattern = "/o/module"; + + _filterDefinition.addURLPattern(urlPattern); + + List urlPatterns = _filterDefinition.getURLPatterns(); + + Assert.assertEquals(1, urlPatterns.size()); + Assert.assertEquals(urlPattern, urlPatterns.get(0)); + } + + @Test + public void testSetFilter() { + _filterDefinition.setFilter(_filter); + + Assert.assertEquals(_filter, _filterDefinition.getFilter()); + } + + @Test + public void testSetFilterName() { + String filterName = "Module Filter"; + + _filterDefinition.setName(filterName); + + Assert.assertEquals(filterName, _filterDefinition.getName()); + } + + @Test + public void testSetMultipleInitParameters() { + Map initParameters = new HashMap(); + + for (int i = 0; i < 10; i++) { + initParameters.put("parameter-" + i, String.valueOf(i)); + } + + _filterDefinition.setInitParameters(initParameters); + + initParameters = _filterDefinition.getInitParameters(); + + Assert.assertEquals(10, initParameters.size()); + + for (int i = 0; i < 10; i++) { + String expectedValue = String.valueOf(i); + String value = initParameters.get("parameter-" + i); + + Assert.assertEquals(expectedValue, value); + } + } + + @Test + public void testSetSingleInitParameter() { + String key = "parameter"; + String value = "1"; + + _filterDefinition.setInitParameter(key, value); + + Map initParameters = + _filterDefinition.getInitParameters(); + + Assert.assertEquals(1, initParameters.size()); + Assert.assertEquals(value, initParameters.get(key)); + } + + @Mock + private Filter _filter; + + private FilterDefinition _filterDefinition; + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/ServletDefinitionTest.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/ServletDefinitionTest.java new file mode 100644 index 0000000..bf2675c --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/ServletDefinitionTest.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.definition; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.Servlet; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.mockito.Mock; + +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * @author Miguel Pastor + */ +@RunWith(PowerMockRunner.class) +public class ServletDefinitionTest { + + @Before + public void setUp() { + _servletDefinition = new ServletDefinition(); + } + + @Test + public void testAddMultipleURLPatterns() { + String urlPattern = "/o/module"; + + List urlPatterns = new ArrayList(); + + for (int i = 0; i < 10; i++) { + urlPatterns.add(urlPattern + "/" + i); + } + + _servletDefinition.setURLPatterns(urlPatterns); + + urlPatterns = _servletDefinition.getURLPatterns(); + + Assert.assertEquals(10, urlPatterns.size()); + + for (int i = 0; i < 10; i++) { + Assert.assertEquals(urlPattern + "/" + i, urlPatterns.get(i)); + } + } + + @Test + public void testAddSingleURLPattern() { + String urlPattern = "/o/module"; + + _servletDefinition.addURLPattern(urlPattern); + + List urlPatterns = _servletDefinition.getURLPatterns(); + + Assert.assertEquals(1, urlPatterns.size()); + Assert.assertEquals(urlPattern, urlPatterns.get(0)); + } + + @Test + public void testSetMultipleInitParameters() { + Map initParameters = new HashMap(); + + for (int i = 0; i < 10; i++) { + initParameters.put("parameter-" + i, String.valueOf(i)); + } + + _servletDefinition.setInitParameters(initParameters); + + initParameters = _servletDefinition.getInitParameters(); + + Assert.assertEquals(10, initParameters.size()); + + for (int i = 0; i < 10; i++) { + String expectedValue = String.valueOf(i); + String value = initParameters.get("parameter-" + i); + + Assert.assertEquals(expectedValue, value); + } + } + + @Test + public void testSetServlet() { + _servletDefinition.setServlet(_servlet); + + Assert.assertEquals(_servlet, _servletDefinition.getServlet()); + } + + @Test + public void testSetServletName() { + String servletName = "Module Servlet"; + + _servletDefinition.setName(servletName); + + Assert.assertEquals(servletName, _servletDefinition.getName()); + } + + @Test + public void testSetSingleInitParameter() { + String key = "parameter"; + String value = "1"; + + _servletDefinition.setInitParameter(key, value); + + Map initParameters = + _servletDefinition.getInitParameters(); + + Assert.assertEquals(1, initParameters.size()); + Assert.assertEquals(value, initParameters.get(key)); + } + + @Mock + private Servlet _servlet; + + private ServletDefinition _servletDefinition; + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/WebXMLDefinitionLoaderTest.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/WebXMLDefinitionLoaderTest.java new file mode 100644 index 0000000..dbcd2d3 --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/WebXMLDefinitionLoaderTest.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.definition; + +import com.liferay.portal.http.service.test.MockBundle; +import com.liferay.portal.kernel.xml.DocumentException; +import com.liferay.portal.kernel.xml.SAXReaderUtil; +import com.liferay.portal.xml.SAXReaderImpl; + +import java.net.URL; + +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletContextListener; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.osgi.framework.Bundle; + +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * @author Miguel Pastor + */ +@RunWith(PowerMockRunner.class) +public class WebXMLDefinitionLoaderTest { + + @BeforeClass + public static void setUpClass() { + SAXReaderUtil saxReaderUtil = new SAXReaderUtil(); + + saxReaderUtil.setSAXReader(SAXReaderImpl.getInstance()); + } + + public WebXMLDefinitionLoaderTest() throws DocumentException { + _webXMLDefinitionLoader = new WebXMLDefinitionLoader(); + } + + @Test + public void testLoadCustomDependencies() throws Exception { + Bundle bundle = new EntryLoaderMockBundle(); + + testLoadDependencies(bundle, 1, 1, 1); + } + + protected void testLoadDependencies( + Bundle bundle, int numfOfListeners, int numOfFilters, + int numfOfServlets) + throws Exception { + + WebXMLDefinition webXMLDefinition = _webXMLDefinitionLoader.loadWebXML( + bundle); + + List listenerDefinitions = + webXMLDefinition.getListenerDefinitions(); + + Assert.assertEquals(numfOfListeners, listenerDefinitions.size()); + + for (ListenerDefinition listenerDefinition : listenerDefinitions) { + Object listener = listenerDefinition.getListener(); + + Assert.assertTrue(listener instanceof ServletContextListener); + } + + Map servletDefinitions = + webXMLDefinition.getServletDefinitions(); + + Assert.assertEquals(numfOfServlets, servletDefinitions.size()); + + Map filterDefinitions = + webXMLDefinition.getFilterDefinitions(); + + Assert.assertEquals(numOfFilters, filterDefinitions.size()); + } + + private WebXMLDefinitionLoader _webXMLDefinitionLoader; + + private class EntryLoaderMockBundle extends MockBundle { + + + public URL getEntry(String path) { + Class clazz = getClass(); + + return clazz.getResource("dependencies/custom-web.xml"); + } + + } + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/WebXMLDefinitionTest.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/WebXMLDefinitionTest.java new file mode 100644 index 0000000..9a65415 --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/WebXMLDefinitionTest.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.definition; + +import java.util.List; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Miguel Pastor + */ +public class WebXMLDefinitionTest { + + @Before + public void setUp() { + _webXmlDefinition = new WebXMLDefinition(); + } + + @Test + public void testAddMultipleFilterDefinition() { + testAddFilterDefinitions(5); + } + + @Test + public void testAddMultipleListenerDefinition() { + testAddListenerDefinition(5); + } + + @Test + public void testAddMultipleServletDefinitions() { + testAddServletDefinitions(5); + } + + @Test + public void testAddSingleFilterDefinition() { + testAddFilterDefinitions(1); + } + + @Test + public void testAddSingleListenerDefinition() { + testAddListenerDefinition(1); + } + + @Test + public void testAddSingleServletDefinition() { + testAddServletDefinitions(1); + } + + protected void testAddFilterDefinitions(int count) { + for (int i = 0; i < count; i++) { + String s = String.valueOf(i); + + FilterDefinition filterDefinition = new FilterDefinition(); + + filterDefinition.addURLPattern(s); + + filterDefinition.setName(s); + + _webXmlDefinition.setFilterDefinition(s, filterDefinition); + } + + Map filterDefinitions = + _webXmlDefinition.getFilterDefinitions(); + + Assert.assertEquals(count, filterDefinitions.size()); + } + + protected void testAddListenerDefinition(int count) { + for (int i = 0; i < count; i++) { + ListenerDefinition listenerDefinition = new ListenerDefinition(); + + listenerDefinition.setListener(new Object()); + + _webXmlDefinition.addListenerDefinition(listenerDefinition); + } + + List listenerDefinitions = + _webXmlDefinition.getListenerDefinitions(); + + Assert.assertEquals(count, listenerDefinitions.size()); + } + + protected void testAddServletDefinitions(int count) { + for (int i = 0; i < count; i++) { + String s = String.valueOf(i); + + ServletDefinition servletDefinition = new ServletDefinition(); + + servletDefinition.addURLPattern(s); + + servletDefinition.setName(s); + + _webXmlDefinition.setServletDefinition(s, servletDefinition); + } + + Map servletDefinitions = + _webXmlDefinition.getServletDefinitions(); + + Assert.assertEquals(count, servletDefinitions.size()); + } + + private WebXMLDefinition _webXmlDefinition; + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/dependencies/custom-web.xml b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/dependencies/custom-web.xml new file mode 100644 index 0000000..e544421 --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/definition/dependencies/custom-web.xml @@ -0,0 +1,30 @@ + + + + + com.liferay.portal.http.service.mock.MockServletContextListener + + + Mock Filter + com.liferay.portal.http.service.mock.MockFilter + + + Mock Filter + /mock_filter + + + Mock Servlet + com.liferay.portal.http.service.mock.MockServlet + 0 + + + Mock Servlet + /mock_servlet + + \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/BaseTrackerTestCase.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/BaseTrackerTestCase.java new file mode 100644 index 0000000..6b422cc --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/BaseTrackerTestCase.java @@ -0,0 +1,193 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.kernel.xml.DocumentException; + +import org.junit.Before; +import org.junit.Test; + +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.verification.VerificationMode; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.http.HttpContext; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +import org.powermock.api.mockito.PowerMockito; + +/** + * @author Miguel Pastor + */ +public abstract class BaseTrackerTestCase extends PowerMockito { + + @Before + public void setUp() { + service = buildService(); + _tracker = buildTracker(); + } + + @Test + public void testAddingServiceWithEmptyInitParameters() throws Exception { + mockAddingService(new String[0]); + + _tracker.addingService(_serviceReference); + + verifyAddingService(Mockito.never()); + } + + @Test + public void testAddingServiceWithInitParameters() throws Exception { + mockAddingService(new String[] {"init.a", "init.b", "foo.c"}); + + _tracker.addingService(_serviceReference); + + verifyAddingService(Mockito.never()); + } + + @Test + public void testRemovedService() throws Exception { + mockRemovedService(); + + _tracker.removedService(_serviceReference, service); + + verifyRemovedService(); + } + + protected abstract S buildService(); + + protected abstract ServiceTrackerCustomizer buildTracker(); + + protected void mockAction(String[] initParameters) + throws DocumentException, InvalidSyntaxException { + + when( + bundleContext.getService(_serviceReference) + ).thenReturn( + service + ); + + when( + httpServiceWrapper.getBundleServletContext() + ).thenReturn( + bundleServletContext + ); + + when( + httpSupport.getHttpContext(Mockito.anyString()) + ).thenReturn( + httpContext + ); + + when( + httpSupport.getHttpService(bundle) + ).thenReturn( + httpServiceWrapper + ); + + when( + _serviceReference.getBundle() + ).thenReturn( + bundle + ); + } + + protected void mockAddingService(String[] initParameters) throws Exception { + when( + httpSupport.getBundleContext() + ).thenReturn( + bundleContext + ); + + when( + _serviceReference.getPropertyKeys() + ).thenReturn( + initParameters + ); + + mockAction(initParameters); + } + + protected void mockRemovedService() throws Exception { + mockAction(null); + } + + protected void verifyAddingService(VerificationMode verificationMode) + throws Exception { + + BundleContext bundleContext = Mockito.verify(this.bundleContext); + + bundleContext.getService(_serviceReference); + + HttpSupport httpSupport = Mockito.verify(this.httpSupport); + + httpSupport.getBundleContext(); + httpSupport.getBundleServletContext(bundle); + httpSupport.getHttpContext(Mockito.anyString()); + + verifyRegisterServiceAction(verificationMode); + verifyServiceReference(); + } + + protected abstract void verifyRegisterServiceAction( + VerificationMode verificationMode) + throws Exception; + + protected void verifyRemovedService() throws Exception { + verifyServiceReference(); + verifyUnRegisterServiceAction(); + } + + protected void verifyServiceReference() { + ServiceReference serviceReference = Mockito.verify( + _serviceReference); + + serviceReference.getBundle(); + serviceReference.getPropertyKeys(); + } + + protected abstract void verifyUnRegisterServiceAction() throws Exception; + + @Mock + protected Bundle bundle; + + @Mock + protected BundleContext bundleContext; + + @Mock + protected BundleServletContext bundleServletContext; + + @Mock + protected HttpContext httpContext; + + @Mock + protected HttpServiceWrapper httpServiceWrapper; + + @Mock + protected HttpSupport httpSupport; + + protected S service; + + @Mock + private ServiceReference _serviceReference; + + private ServiceTrackerCustomizer _tracker; + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/DefaultHttpContextTest.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/DefaultHttpContextTest.java new file mode 100644 index 0000000..c3491e3 --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/DefaultHttpContextTest.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.mockito.Mock; +import org.mockito.Mockito; + +import org.osgi.framework.Bundle; + +import org.powermock.api.mockito.PowerMockito; +import org.powermock.modules.junit4.PowerMockRunner; + +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; + +/** + * @author Miguel Pastor + */ +@RunWith(PowerMockRunner.class) +public class DefaultHttpContextTest extends PowerMockito { + + @Before + public void setUp() { + _defaultHttpContext = new DefaultHttpContext(_bundle); + } + + @Test + public void testGetExistingResourceWithNoSlash() throws Exception { + mockBundleFindEntries(); + + getResourceAndVerify("existingResource"); + + verifyBundleFindEntries(); + } + + @Test + public void testGetExistingResourceWithSlash() throws Exception { + mockBundleFindEntries(); + + getResourceAndVerify("/existingResource"); + + verifyBundleFindEntries(); + } + + @Test + public void testGetNonExistingResourceNoSlash() { + Assert.assertNull( + _defaultHttpContext.getResource("nonExistingResource")); + } + + @Test + public void testGetNonExistingResourceWithSlash() { + Assert.assertNull( + _defaultHttpContext.getResource("nonExistingResource")); + } + + @Test + public void testHandleSecurity() { + MockHttpServletRequest mockHttpServletRequest = + new MockHttpServletRequest(); + MockHttpServletResponse mockHttpServletResponse = + new MockHttpServletResponse(); + + Assert.assertTrue( + _defaultHttpContext.handleSecurity( + mockHttpServletRequest, mockHttpServletResponse)); + } + + protected void getResourceAndVerify(String path) { + URL url = _defaultHttpContext.getResource(path); + + Assert.assertNotNull(url); + Assert.assertEquals(_FILE, url.getFile()); + Assert.assertEquals(_HOST, url.getHost()); + Assert.assertEquals(_PROTOCOL, url.getProtocol()); + } + + protected void mockBundleFindEntries() throws MalformedURLException { + when( + _bundle.getResource(Mockito.anyString()) + ).thenReturn( + new URL(_PROTOCOL, _HOST, _FILE) + ); + } + + protected void verifyBundleFindEntries() { + Bundle bundle = Mockito.verify(_bundle); + + bundle.getResource(Mockito.anyString()); + } + + private static final String _FILE = "/tmp/foo"; + + private static final String _HOST = "localhost"; + + private static final String _PROTOCOL = "file"; + + @Mock + private Bundle _bundle; + + private DefaultHttpContext _defaultHttpContext; + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/FilterTrackerTest.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/FilterTrackerTest.java new file mode 100644 index 0000000..b573d85 --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/FilterTrackerTest.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; +import com.liferay.portal.http.service.mock.MockFilter; + +import javax.servlet.Filter; + +import org.junit.runner.RunWith; + +import org.mockito.Mockito; +import org.mockito.verification.VerificationMode; + +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * @author Miguel Pastor + */ +@RunWith(PowerMockRunner.class) +public class FilterTrackerTest extends BaseTrackerTestCase { + + + protected Filter buildService() { + return new MockFilter(); + } + + + protected ServiceTrackerCustomizer buildTracker() { + return new FilterTracker(httpSupport); + } + + + protected void verifyRegisterServiceAction( + VerificationMode verificationMode) + throws Exception { + + BundleServletContext bundleServletContext = Mockito.verify( + this.bundleServletContext, verificationMode); + + bundleServletContext.registerFilter( + Mockito.anyString(), Mockito.anyString(), Mockito.eq(service), + Mockito.anyMap(), Mockito.eq(httpContext)); + } + + + protected void verifyUnRegisterServiceAction() throws Exception { + BundleServletContext bundleServletContext = Mockito.verify( + this.bundleServletContext); + + bundleServletContext.unregisterFilter(Mockito.anyString()); + } + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/ServletTrackerTest.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/ServletTrackerTest.java new file mode 100644 index 0000000..87c0275 --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/http/ServletTrackerTest.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.http; + +import com.liferay.portal.http.service.internal.servlet.BundleServletContext; + +import javax.servlet.GenericServlet; +import javax.servlet.Servlet; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import org.junit.runner.RunWith; + +import org.mockito.Mockito; +import org.mockito.verification.VerificationMode; + +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * @author Miguel Pastor + */ +@RunWith(PowerMockRunner.class) +public class ServletTrackerTest extends BaseTrackerTestCase { + + + protected Servlet buildService() { + return new MockServlet(); + } + + + protected ServiceTrackerCustomizer buildTracker() { + return new ServletTracker(httpSupport); + } + + + protected void verifyRegisterServiceAction( + VerificationMode verificationMode) + throws Exception { + + BundleServletContext bundleServletContext = Mockito.verify( + this.bundleServletContext, verificationMode); + + bundleServletContext.registerServlet( + Mockito.anyString(), Mockito.anyString(), Mockito.eq(service), + Mockito.anyMap(), Mockito.eq(httpContext)); + } + + + protected void verifyUnRegisterServiceAction() throws Exception { + BundleServletContext bundleServletContext = Mockito.verify( + this.bundleServletContext); + + bundleServletContext.unregisterServlet(Mockito.anyString()); + } + + private class MockServlet extends GenericServlet { + + + public void service( + ServletRequest servletRequest, ServletResponse servletResponse) { + } + + } + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/servlet/BundleServletContextTest.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/servlet/BundleServletContextTest.java new file mode 100644 index 0000000..8ab131d --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/internal/servlet/BundleServletContextTest.java @@ -0,0 +1,647 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.internal.servlet; + +import com.liferay.portal.http.service.mock.MockFilter; +import com.liferay.portal.http.service.mock.MockServlet; +import com.liferay.portal.http.service.servlet.ResourceServlet; +import com.liferay.portal.kernel.test.JDKLoggerTestUtil; +import com.liferay.portal.kernel.util.FastDateFormatFactoryUtil; +import com.liferay.portal.kernel.util.FileUtil; +import com.liferay.portal.util.FileImpl; +import com.liferay.portal.util.PortalUtil; + +import java.text.SimpleDateFormat; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; + +import javax.servlet.DispatcherType; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.Servlet; +import javax.servlet.ServletContext; +import javax.servlet.ServletContextAttributeListener; +import javax.servlet.ServletContextListener; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletRequestAttributeListener; +import javax.servlet.ServletRequestListener; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpSessionActivationListener; +import javax.servlet.http.HttpSessionAttributeListener; +import javax.servlet.http.HttpSessionBindingListener; +import javax.servlet.http.HttpSessionListener; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.mockito.Mock; +import org.mockito.Mockito; + +import org.osgi.framework.Bundle; +import org.osgi.framework.wiring.BundleWiring; +import org.osgi.service.http.HttpContext; +import org.osgi.service.http.NamespaceException; + +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.mock.web.MockServletConfig; + +/** + * @author Miguel Pastor + */ +@PrepareForTest({FastDateFormatFactoryUtil.class, PortalUtil.class}) +@RunWith(PowerMockRunner.class) +public class BundleServletContextTest extends PowerMockito { + + @Before + public void setUp() { + mockStatic(FastDateFormatFactoryUtil.class); + + when( + FastDateFormatFactoryUtil.getSimpleDateFormat(Mockito.anyString()) + ).thenReturn( + new SimpleDateFormat() + ); + + mockStatic(PortalUtil.class); + + when( + PortalUtil.getPathContext() + ).thenReturn( + "sample-test-module" + ); + + _bundleServletContext = new BundleServletContext( + _bundle, "test", _servletContext); + + FileUtil fileUtil = new FileUtil(); + + fileUtil.setFile(new FileImpl()); + } + + @After + public void tearDown() { + verifyStatic(); + } + + @Test + public void testGetClassloader() { + mockBundleWiring(); + + Class clazz = getClass(); + + ClassLoader classLoader = clazz.getClassLoader(); + + Assert.assertEquals( + classLoader, _bundleServletContext.getClassLoader()); + + verifyBundleWiring(); + } + + @Test + public void testGetFilterChain() throws Exception { + mockBundleWiring(); + + List logFilterRecords = JDKLoggerTestUtil.configureJDKLogger( + MockLoggingFilter.class.getName(), Level.INFO); + + String cssFilterName = "CSS Filter"; + + registerFilter( + cssFilterName, new MockLoggingFilter(cssFilterName), null, + "/css/*"); + + String jsFilterName = "JS Filter"; + + registerFilter( + jsFilterName, new MockLoggingFilter(jsFilterName), null, "/js/*"); + + registerServlet("Sample Servlet", "/"); + + FilterChain filterChain = _bundleServletContext.getFilterChain( + "/js/main.js", DispatcherType.REQUEST); + + Assert.assertNotNull(filterChain); + + filterChain.doFilter( + new MockHttpServletRequest(), new MockHttpServletResponse()); + + Assert.assertEquals(1, logFilterRecords.size()); + + LogRecord logRecord = logFilterRecords.get(0); + + Assert.assertEquals(jsFilterName, logRecord.getMessage()); + + verifyBundleWiring(); + } + + @Test + public void testGetServletContextName() { + Assert.assertEquals( + "test",_bundleServletContext.getServletContextName()); + } + + @Test + public void testRegisterFilterBadURLMapping() + throws NamespaceException, ServletException { + + try { + registerFilter("Bad Mapping Filter", "/a/"); + } + catch (IllegalArgumentException iae) { + return; + } + + Assert.fail(); + } + + @Test + public void testRegisterFilterMultipleMapping() + throws NamespaceException, ServletException { + + registerFilter("Security Filter", "/a", "/b/*"); + } + + @Test + public void testRegisterFilterSingleMapping() + throws NamespaceException, ServletException { + + registerFilter("Security Filter", "/a"); + } + + @Test + public void testRegisterFilterWithServiceRanking() + throws NamespaceException, ServletException { + + Map initParameters = new HashMap(); + + initParameters.put("service.ranking", "1"); + + registerFilter("Security Filter", _filter, initParameters, "/a"); + } + + @Test + public void testRegisterHttpSessionActivationListener() { + registerListener(_httpSessionActivationListener); + } + + @Test + public void testRegisterHttpSessionAttributeListener() { + registerListener(_httpSessionAttributeListener); + } + + @Test + public void testRegisterHttpSessionBindingListener() { + registerListener(_httpSessionBindingListener); + } + + @Test + public void testRegisterHttpSessionListener() { + registerListener(_httpSessionListener); + } + + @Test + public void testRegisterNullFilter() + throws NamespaceException, ServletException { + + try { + _bundleServletContext.registerFilter( + "Filter A", Arrays.asList("/a"), null, null, _httpContext); + } + catch (IllegalArgumentException iae) { + return; + } + + Assert.fail(); + } + + @Test + public void testRegisterNullServlet() + throws NamespaceException, ServletException { + + try { + _bundleServletContext.registerServlet( + "Servlet A", Arrays.asList("/a"), null, null, _httpContext); + } + catch (IllegalArgumentException iae) { + return; + } + + Assert.fail(); + } + + @Test + public void testRegisterResource() throws NamespaceException { + registerResource("JS Servlet", "/js"); + } + + @Test + public void testRegisterResourceDuplicatedMapping() + throws NamespaceException { + + registerResource("CSS Servlet", "/css"); + + try { + registerResource("New CSS Servlet", "/css"); + } + catch (NamespaceException ne) { + return; + } + + Assert.fail(); + } + + @Test + public void testRegisterResourceInvalidName() throws NamespaceException { + try { + registerResource("Bad Name/", "/js"); + } + catch (IllegalArgumentException iae) { + return; + } + + Assert.fail(); + } + + @Test + public void testRegisterServletContextAttributeListener() { + registerListener(_servletContextAttributeListener); + } + + @Test + public void testRegisterServletContextListener() { + registerListener(_servletContextListener); + } + + @Test + public void testRegisterServletMappingTwice() + throws NamespaceException, ServletException { + + registerServlet("Original Servlet", "/a"); + + try { + registerServlet("New Servlet", "/a"); + } + catch (NamespaceException ne) { + return; + } + + Assert.fail(); + } + + @Test + public void testRegisterServletMultipleMapping() + throws NamespaceException, ServletException { + + registerServlet("Servlet A", "/a", "/b", "/c"); + } + + @Test + public void testRegisterServletRequestAttributeListener() { + List servletRequestAttributeListeners = + _bundleServletContext.getServletRequestAttributeListeners(); + + int initialSize = servletRequestAttributeListeners.size(); + + registerListener(_servletRequestAttributeListener); + + servletRequestAttributeListeners = + _bundleServletContext.getServletRequestAttributeListeners(); + + Assert.assertEquals( + initialSize + 1, servletRequestAttributeListeners.size()); + } + + @Test + public void testRegisterServletRequestListener() { + List servletRequestListeners = + _bundleServletContext.getServletRequestListeners(); + + int initialSize = servletRequestListeners.size(); + + registerListener(_servletRequestListener); + + servletRequestListeners = + _bundleServletContext.getServletRequestListeners(); + + Assert.assertEquals(initialSize + 1, servletRequestListeners.size()); + } + + @Test + public void testRegisterServletSingleMapping() + throws NamespaceException, ServletException { + + registerServlet("Servlet B", "/a"); + } + + @Test + public void testUnegisterHttpSessionAttributeListener() { + unregisterListener(_httpSessionAttributeListener); + } + + @Test + public void testUnegisterServletContextListener() { + unregisterListener(_servletContextListener); + } + + @Test + public void testUnregisterExistingServlet() + throws NamespaceException, ServletException { + + String servletName = "Servlet A"; + + registerServlet(servletName, "/a"); + + _bundleServletContext.unregisterServlet(servletName); + + Servlet servlet = _bundleServletContext.getServlet(servletName); + + Assert.assertNull(servlet); + } + + @Test + public void testUnregisterHttpSessionActivationListener() { + unregisterListener(_httpSessionActivationListener); + } + + @Test + public void testUnregisterHttpSessionBindingListener() { + unregisterListener(_httpSessionBindingListener); + } + + @Test + public void testUnregisterHttpSessionListener() { + unregisterListener(_httpSessionListener); + } + + @Test + public void testUnregisterNonExistingServlet() { + String servletName = "Nonexisting Servlet"; + + _bundleServletContext.unregisterServlet(servletName); + + Servlet servlet = _bundleServletContext.getServlet(servletName); + + Assert.assertNull(servlet); + } + + @Test + public void testUnregisterServletContextAttributeListener() { + registerListener(_servletContextAttributeListener); + } + + @Test + public void testUnregisterServletRequestAttributeListener() { + List servletRequestAttributeListeners = + _bundleServletContext.getServletRequestAttributeListeners(); + + int initialSize = servletRequestAttributeListeners.size(); + + registerListener(_servletRequestAttributeListener); + + unregisterListener(_servletRequestAttributeListener); + + servletRequestAttributeListeners = + _bundleServletContext.getServletRequestAttributeListeners(); + + Assert.assertEquals( + initialSize, servletRequestAttributeListeners.size()); + } + + @Test + public void testUnregisterServletRequestListener() { + List servletRequestListeners = + _bundleServletContext.getServletRequestListeners(); + + int initialSize = servletRequestListeners.size(); + + registerListener(_servletRequestListener); + + unregisterListener(_servletRequestListener); + + servletRequestListeners = + _bundleServletContext.getServletRequestListeners(); + + Assert.assertEquals(initialSize, servletRequestListeners.size()); + } + + protected void mockBundleWiring() { + when( + _bundle.adapt(BundleWiring.class) + ).thenReturn( + _bundleWiring + ); + + Class clazz = getClass(); + + when( + _bundleWiring.getClassLoader() + ).thenReturn( + clazz.getClassLoader() + ); + } + + protected void registerFilter( + String filterName, Filter filter, + Map initParameters, String ... urlPatterns) + throws NamespaceException, ServletException { + + mockBundleWiring(); + + _bundleServletContext.registerFilter( + filterName, Arrays.asList(urlPatterns), filter, initParameters, + _httpContext); + + verifyBundleWiring(); + } + + protected void registerFilter(String filterName, String ... urlPatterns) + throws NamespaceException, ServletException { + + registerFilter(filterName, _filter, null, urlPatterns); + } + + protected void registerListener(Object listener) { + mockBundleWiring(); + + _bundleServletContext.registerListener(listener, null, _httpContext); + + verifyBundleWiring(); + } + + protected void registerResource(String servletName, String alias) + throws NamespaceException { + + mockBundleWiring(); + + _bundleServletContext.registerResources( + alias, servletName, _httpContext); + + Servlet servlet = _bundleServletContext.getServlet(servletName); + + Assert.assertNotNull(servlet); + + Assert.assertTrue(servlet instanceof ResourceServlet); + + verifyBundleWiring(); + } + + protected void registerServlet(String servletName, String ... urlPatterns) + throws NamespaceException, ServletException { + + mockBundleWiring(); + + when( + _servlet.getServletConfig() + ).thenReturn( + new MockServletConfig(servletName) + ); + + _bundleServletContext.registerServlet( + servletName, Arrays.asList(urlPatterns), _servlet, null, + _httpContext); + + Servlet servlet = _bundleServletContext.getServlet(servletName); + + Assert.assertNotNull(servlet); + + Assert.assertEquals( + servletName, servlet.getServletConfig().getServletName()); + + Mockito.verify(_servlet).getServletConfig(); + + verifyBundleWiring(); + } + + protected void unregisterListener(Object listener) { + mockBundleWiring(); + + _bundleServletContext.unregisterListener(listener); + + verifyBundleWiring(); + } + + protected void verifyBundleWiring() { + Bundle bundle = Mockito.verify(_bundle); + + bundle.adapt(BundleWiring.class); + + BundleWiring bundleWiring = Mockito.verify(_bundleWiring); + + bundleWiring.getClassLoader(); + } + + @Mock + private Bundle _bundle; + + private BundleServletContext _bundleServletContext; + + @Mock + private BundleWiring _bundleWiring; + + @Mock + private Filter _filter; + + @Mock + private HttpContext _httpContext; + + @Mock + private HttpSessionActivationListener _httpSessionActivationListener; + + @Mock + private HttpSessionAttributeListener _httpSessionAttributeListener; + + @Mock + private HttpSessionBindingListener _httpSessionBindingListener; + + @Mock + private HttpSessionListener _httpSessionListener; + + @Mock + private Servlet _servlet; + + @Mock + private ServletContext _servletContext; + + @Mock + private ServletContextAttributeListener _servletContextAttributeListener; + + @Mock + private ServletContextListener _servletContextListener; + + @Mock + private ServletRequestAttributeListener _servletRequestAttributeListener; + + @Mock + private ServletRequestListener _servletRequestListener; + + private class MockLoggingFilter extends MockFilter { + + public MockLoggingFilter(String message) { + _message = message; + + _logger.setLevel(Level.INFO); + } + + + public void doFilter( + ServletRequest servletRequest, ServletResponse servletResponse, + FilterChain filterChain) { + + _logger.info(_message); + } + + private Logger _logger = Logger.getLogger( + MockLoggingFilter.class.getName()); + private String _message; + + } + + private class MockLoggingServlet extends MockServlet { + + public MockLoggingServlet(String message) { + _message = message; + + _logger.setLevel(Level.INFO); + } + + + public void service( + ServletRequest servletRequest, ServletResponse servletResponse) { + + _logger.info(_message); + } + + private Logger _logger = Logger.getLogger( + MockLoggingServlet.class.getName()); + private String _message; + + } + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/mock/MockFilter.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/mock/MockFilter.java new file mode 100644 index 0000000..d296195 --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/mock/MockFilter.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.mock; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +/** + * @author Miguel Pastor + */ +public class MockFilter implements Filter { + + + public void destroy() { + } + + + public void doFilter( + ServletRequest servletRequest, ServletResponse servletResponse, + FilterChain filterChain) { + } + + + public void init(FilterConfig filterConfig) { + } + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/mock/MockServlet.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/mock/MockServlet.java new file mode 100644 index 0000000..42a2637 --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/mock/MockServlet.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.mock; + +import javax.servlet.GenericServlet; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +/** + * @author Miguel Pastor + */ +public class MockServlet extends GenericServlet { + + + public void service( + ServletRequest servletRequest, ServletResponse servletResponse) { + } + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/mock/MockServletContextListener.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/mock/MockServletContextListener.java new file mode 100644 index 0000000..9b94adc --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/mock/MockServletContextListener.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.mock; + +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +/** + * @author Miguel Pastor + */ +public class MockServletContextListener implements ServletContextListener { + + + public void contextDestroyed(ServletContextEvent servletContextEvent) { + } + + + public void contextInitialized(ServletContextEvent servletContextEvent) { + } + +} \ No newline at end of file diff --git a/shared/portal-http-service/test/unit/com/liferay/portal/http/service/test/MockBundle.java b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/test/MockBundle.java new file mode 100644 index 0000000..7415c2e --- /dev/null +++ b/shared/portal-http-service/test/unit/com/liferay/portal/http/service/test/MockBundle.java @@ -0,0 +1,191 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.portal.http.service.test; + +import com.liferay.portal.kernel.util.StringPool; + +import java.io.File; +import java.io.InputStream; + +import java.net.URL; + +import java.security.cert.X509Certificate; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.Version; + +/** + * @author Miguel Pastor + */ +public class MockBundle implements Bundle { + + + public A adapt(Class clazz) { + return null; + } + + + public int compareTo(Bundle bundle) { + return 0; + } + + + public Enumeration findEntries( + String path, String filePattern, boolean recurse) { + + return Collections.enumeration(new ArrayList()); + } + + + public BundleContext getBundleContext() { + return null; + } + + + public long getBundleId() { + return 0; + } + + + public File getDataFile(String fileName) { + return null; + } + + + public URL getEntry(String path) { + return null; + } + + + public Enumeration getEntryPaths(String path) { + return Collections.enumeration(new ArrayList()); + } + + + public Dictionary getHeaders() { + return new Hashtable(); + } + + + public Dictionary getHeaders(String locale) { + return new Hashtable(); + } + + + public long getLastModified() { + return 0; + } + + + public String getLocation() { + return StringPool.BLANK; + } + + + public ServiceReference[] getRegisteredServices() { + return new ServiceReference[0]; + } + + + public URL getResource(String name) { + return null; + } + + + public Enumeration getResources(String name) { + return Collections.enumeration(new ArrayList()); + } + + + public ServiceReference[] getServicesInUse() { + return new ServiceReference[0]; + } + + + public Map> getSignerCertificates( + int signersType) { + + return Collections.emptyMap(); + } + + + public int getState() { + return Bundle.ACTIVE; + } + + + public String getSymbolicName() { + return "bundle"; + } + + + public Version getVersion() { + return Version.emptyVersion; + } + + + public boolean hasPermission(Object permission) { + return false; + } + + + public Class loadClass(String className) throws ClassNotFoundException { + Class clazz = getClass(); + + ClassLoader classLoader = clazz.getClassLoader(); + + return classLoader.loadClass(className); + } + + + public void start() { + start(0); + } + + + public void start(int options) { + } + + + public void stop() { + } + + + public void stop(int options) { + } + + + public void uninstall() { + } + + + public void update() { + } + + + public void update(InputStream inputStream) { + } + +} \ No newline at end of file diff --git a/source-formatter.properties b/source-formatter.properties new file mode 100644 index 0000000..618e996 --- /dev/null +++ b/source-formatter.properties @@ -0,0 +1,106 @@ +## +## Exclusions +## + + # + # Input a list of comma delimited paths that will be excluded by the source + # formatter. + # + source.formatter.excludes=\ + **/.git/**,\ + **/bin/**,\ + **/classes/**,\ + **/test-classes/**,\ + **/test-coverage/**,\ + **/test-results/**,\ + **/tmp/** + + # + # Input a list of comma delimited file names that should be ignored when + # applying diamond operators. + # + diamond.operator.excludes.files=\ + portlets/wsrp-portlet/docroot/WEB-INF/src/com/liferay/wsrp/util/WSRPConsumerManagerFactory.java,\ + webs/kaleo-web/docroot/WEB-INF/src/com/liferay/portal/workflow/kaleo/runtime/util/ScriptingContextBuilderImpl.java + + # + # Input a list of comma delimited file names that are allowed to call + # session.createSQLQuery instead of session.createSynchronizedSQLQuery. See + # LPS-42599. + # + hibernate.sql.query.excludes= + + # + # Input a list of comma delimited file names that are allowed to have + # unalphabetized Java terms. In addition these files are allowed to have + # nonfinal variables that are capitalized. + # + javaterm.sort.excludes= + + # + # Input a list of comma delimited file names that are allowed to surpass the + # 80 column limit. + # + line.length.excludes=\ + portlets/calendar-portlet/docroot/WEB-INF/src/com/liferay/calendar/lar/CalendarPortletDataHandler.java@132 + + # + # Input a list of comma delimited portlet XML files names that are allowed + # to have non-numerical portlet-name elements. + # + numerical.portlet.name.element.excludes= + + # + # Input a list of comma delimited paths that are allowed to run outside the + # portal. For files that match any of these paths, we skip source formatting + # rules that enforce calling portal methods. + # + run.outside.portal.excludes= + + # + # Input a list of comma delimited file names that are allowed to use + # java.security.SecureRandom. See LPS-39508. + # + secure.random.excludes= + + # + # Input a list of comma delimited file names that are allowed to have + # nonstatic _log variables. + # + static.log.excludes= + + # + # Input a list of comma delimited XML file names that are allowed to have + # lines that start with spaces. + # + xml.excludes=\ + portlets/sample-struts-liferay-portlet/docroot/WEB-INF/validator-rules.xml,\ + portlets/sample-struts-portlet/docroot/WEB-INF/validator-rules.xml,\ + webs/solr4-web/docroot/WEB-INF/conf/solrconfig.xml + +## +## Miscellaneous +## + + # + # Specify incorrect and excpected parameters for the methods + # LanguageUtil.get and LanguageUtil.format. See LPS-47682. + # + languageutil.expected.parameter=pageContext + languageutil.incorrect.parameter=request + + # + # Set this property to true to add the release version to deprecated Java + # terms. + # + add.missing.deprecation.release.version=false + +## +## Portal Compat +## + + # + # Set this property to true to force plugins to use classes from the portal + # compat JAR if possible. + # + use.portal.compat.import=true \ No newline at end of file diff --git a/themes/build-common-theme.xml b/themes/build-common-theme.xml new file mode 100644 index 0000000..385ad8e --- /dev/null +++ b/themes/build-common-theme.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/themes/build.xml b/themes/build.xml new file mode 100644 index 0000000..b77ffb6 --- /dev/null +++ b/themes/build.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + This task must be called by the create script. + + + + + + + + + + ${theme.name}-theme already exists. + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/themes/create.bat b/themes/create.bat new file mode 100644 index 0000000..30f910d --- /dev/null +++ b/themes/create.bat @@ -0,0 +1,25 @@ +@echo off + +if "" == "%1" goto errorCreate + +if "" == "%2" goto errorCreate + +call ant -Dtheme.name=%1 -Dtheme.display.name=%2 create + +rem call ant deploy + +goto end + +:errorCreate + echo. + echo Usage: create.bat hello-world "Hello World" + echo. + echo The first hello-world is your theme id. A new directory will be created based + echo on the theme id. + echo. + echo The second "Hello World" is the theme's display name. The quotation marks are + echo only needed because there is a space in the display name. + + goto end + +:end \ No newline at end of file diff --git a/themes/create.sh b/themes/create.sh new file mode 100644 index 0000000..01abe6a --- /dev/null +++ b/themes/create.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +#set -x + +if [ $# -lt 2 ]; then + echo + echo Usage: ./create.sh hello-world \"Hello World\" + echo + echo The first hello-world is your theme id. A new directory will be created based + echo on the theme id. + echo + echo The second \"Hello World\" is the theme\'s display name. The quotation marks are + echo only needed because there is a space in the display name. + + exit 127 +fi + +ant -Dtheme.name=$1 -Dtheme.display.name=\"$2\" create + +#ant deploy + +exit 0 \ No newline at end of file diff --git a/themes/merge.bat b/themes/merge.bat new file mode 100644 index 0000000..f0a4594 --- /dev/null +++ b/themes/merge.bat @@ -0,0 +1,15 @@ +@echo off + +if "" == "%1" goto errorMerge + +call ant -Dtheme.name=%1 merge + +goto end + +:errorMerge + echo. + echo Usage: merge.bat hello-world + + goto end + +:end \ No newline at end of file diff --git a/themes/readme.txt b/themes/readme.txt new file mode 100644 index 0000000..55e64f5 --- /dev/null +++ b/themes/readme.txt @@ -0,0 +1,3 @@ +To view more information about developing themes, please view this wiki entry: + +http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Themes#section-Themes-DevelopingATheme \ No newline at end of file diff --git a/tools/templates/ear_tmpl/modules/META-INF/application.xml b/tools/templates/ear_tmpl/modules/META-INF/application.xml new file mode 100644 index 0000000..d08f65d --- /dev/null +++ b/tools/templates/ear_tmpl/modules/META-INF/application.xml @@ -0,0 +1,10 @@ + + + + Liferay Portal + \ No newline at end of file diff --git a/tools/templates/ext_tmpl/build.xml b/tools/templates/ext_tmpl/build.xml new file mode 100644 index 0000000..d2cd075 --- /dev/null +++ b/tools/templates/ext_tmpl/build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/liferay-portlet-ext.xml b/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/liferay-portlet-ext.xml new file mode 100644 index 0000000..e1a6a9b --- /dev/null +++ b/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/liferay-portlet-ext.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/portlet-ext.xml b/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/portlet-ext.xml new file mode 100644 index 0000000..11a6e3e --- /dev/null +++ b/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/portlet-ext.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/struts-config-ext.xml b/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/struts-config-ext.xml new file mode 100644 index 0000000..989a32c --- /dev/null +++ b/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/struts-config-ext.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/tiles-defs-ext.xml b/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/tiles-defs-ext.xml new file mode 100644 index 0000000..8d8c8de --- /dev/null +++ b/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/tiles-defs-ext.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/web.xml b/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/web.xml new file mode 100644 index 0000000..7d8c082 --- /dev/null +++ b/tools/templates/ext_tmpl/docroot/WEB-INF/ext-web/docroot/WEB-INF/web.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tools/templates/ext_tmpl/docroot/WEB-INF/liferay-plugin-package.properties b/tools/templates/ext_tmpl/docroot/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..a74c747 --- /dev/null +++ b/tools/templates/ext_tmpl/docroot/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,11 @@ +name=@ext.display.name@ +module-group-id=liferay +module-incremental-version=1 +tags= +short-description= +long-description= +change-log= +page-url=http://www.liferay.com +author=Liferay, Inc. +licenses=LGPL +liferay-versions=6.2.0+ \ No newline at end of file diff --git a/tools/templates/hook_tmpl/build.xml b/tools/templates/hook_tmpl/build.xml new file mode 100644 index 0000000..b7ff356 --- /dev/null +++ b/tools/templates/hook_tmpl/build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tools/templates/hook_tmpl/docroot/WEB-INF/liferay-hook.xml b/tools/templates/hook_tmpl/docroot/WEB-INF/liferay-hook.xml new file mode 100644 index 0000000..984d2e7 --- /dev/null +++ b/tools/templates/hook_tmpl/docroot/WEB-INF/liferay-hook.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/tools/templates/hook_tmpl/docroot/WEB-INF/liferay-plugin-package.properties b/tools/templates/hook_tmpl/docroot/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..ddfc009 --- /dev/null +++ b/tools/templates/hook_tmpl/docroot/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,11 @@ +name=@hook.display.name@ +module-group-id=liferay +module-incremental-version=1 +tags= +short-description= +long-description= +change-log= +page-url=http://www.liferay.com +author=Liferay, Inc. +licenses=LGPL +liferay-versions=6.2.0+ \ No newline at end of file diff --git a/tools/templates/hook_tmpl/ivy.xml b/tools/templates/hook_tmpl/ivy.xml new file mode 100644 index 0000000..2f9047f --- /dev/null +++ b/tools/templates/hook_tmpl/ivy.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/templates/hook_tmpl/test/integration/arquillian.xml b/tools/templates/hook_tmpl/test/integration/arquillian.xml new file mode 100644 index 0000000..e67be6c --- /dev/null +++ b/tools/templates/hook_tmpl/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + @jmx.remote.port@ + @app.server.tomcat.manager.password@ + @app.server.tomcat.manager.user@ + + + \ No newline at end of file diff --git a/tools/templates/layouttpl_tmpl/build.xml b/tools/templates/layouttpl_tmpl/build.xml new file mode 100644 index 0000000..32519e1 --- /dev/null +++ b/tools/templates/layouttpl_tmpl/build.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tools/templates/layouttpl_tmpl/docroot/WEB-INF/liferay-layout-templates.xml b/tools/templates/layouttpl_tmpl/docroot/WEB-INF/liferay-layout-templates.xml new file mode 100644 index 0000000..be3b906 --- /dev/null +++ b/tools/templates/layouttpl_tmpl/docroot/WEB-INF/liferay-layout-templates.xml @@ -0,0 +1,12 @@ + + + + + + + /@layouttpl.template.name@.tpl + /@layouttpl.template.name@.wap.tpl + /@layouttpl.template.name@.png + + + \ No newline at end of file diff --git a/tools/templates/layouttpl_tmpl/docroot/WEB-INF/liferay-plugin-package.properties b/tools/templates/layouttpl_tmpl/docroot/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..35bc9b6 --- /dev/null +++ b/tools/templates/layouttpl_tmpl/docroot/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,11 @@ +name=@layouttpl.display.name@ +module-group-id=liferay +module-incremental-version=1 +tags= +short-description= +long-description= +change-log= +page-url=http://www.liferay.com +author=Liferay, Inc. +licenses=LGPL +liferay-versions=6.2.0+ \ No newline at end of file diff --git a/tools/templates/layouttpl_tmpl/docroot/blank_columns.png b/tools/templates/layouttpl_tmpl/docroot/blank_columns.png new file mode 100644 index 0000000..159d0d7 Binary files /dev/null and b/tools/templates/layouttpl_tmpl/docroot/blank_columns.png differ diff --git a/tools/templates/layouttpl_tmpl/docroot/blank_columns.tpl b/tools/templates/layouttpl_tmpl/docroot/blank_columns.tpl new file mode 100644 index 0000000..e69de29 diff --git a/tools/templates/layouttpl_tmpl/docroot/blank_columns.wap.tpl b/tools/templates/layouttpl_tmpl/docroot/blank_columns.wap.tpl new file mode 100644 index 0000000..e69de29 diff --git a/tools/templates/pom_tmpl/template.pom b/tools/templates/pom_tmpl/template.pom new file mode 100644 index 0000000..5048c66 --- /dev/null +++ b/tools/templates/pom_tmpl/template.pom @@ -0,0 +1,34 @@ + + + + ${ivy.pom.artifactId} + ${ivy.pom.description} + + + ${ivy.pom.developer.name} + ${ivy.pom.developer.organization} + ${ivy.pom.developer.organizationUrl} + + + ${ivy.pom.groupId} + + + ${ivy.pom.license.name} + ${ivy.pom.license.url} + + + 4.0.0 + ${ivy.pom.name} + ${ivy.pom.packaging} + + ${ivy.pom.scm.connection} + ${ivy.pom.scm.developerConnection} + ${ivy.pom.scm.url} + + ${ivy.pom.url} + ${ivy.pom.version} + \ No newline at end of file diff --git a/tools/templates/portlet_icefaces_tmpl/docroot/WEB-INF/web.xml b/tools/templates/portlet_icefaces_tmpl/docroot/WEB-INF/web.xml new file mode 100644 index 0000000..0044e53 --- /dev/null +++ b/tools/templates/portlet_icefaces_tmpl/docroot/WEB-INF/web.xml @@ -0,0 +1,30 @@ + + + + + com.sun.faces.expressionFactory + org.jboss.el.ExpressionFactoryImpl + + + javax.faces.PROJECT_STAGE + Development + + + org.icefaces.mandatoryResourceConfiguration + none + + + org.icefaces.uniqueResourceURLs + false + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + \ No newline at end of file diff --git a/tools/templates/portlet_icefaces_tmpl/docroot/views/view.xhtml b/tools/templates/portlet_icefaces_tmpl/docroot/views/view.xhtml new file mode 100644 index 0000000..4662781 --- /dev/null +++ b/tools/templates/portlet_icefaces_tmpl/docroot/views/view.xhtml @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_icefaces_tmpl/ivy.xml b/tools/templates/portlet_icefaces_tmpl/ivy.xml new file mode 100644 index 0000000..4f9d58c --- /dev/null +++ b/tools/templates/portlet_icefaces_tmpl/ivy.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_icefaces_tmpl/test/integration/arquillian.xml b/tools/templates/portlet_icefaces_tmpl/test/integration/arquillian.xml new file mode 100644 index 0000000..e67be6c --- /dev/null +++ b/tools/templates/portlet_icefaces_tmpl/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + @jmx.remote.port@ + @app.server.tomcat.manager.password@ + @app.server.tomcat.manager.user@ + + + \ No newline at end of file diff --git a/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/faces-config.xml b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/faces-config.xml new file mode 100644 index 0000000..d629bec --- /dev/null +++ b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/faces-config.xml @@ -0,0 +1,12 @@ + + + + + com.liferay.faces.util.lifecycle.DebugPhaseListener + + \ No newline at end of file diff --git a/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/liferay-hook.xml b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/liferay-hook.xml new file mode 100644 index 0000000..d650376 --- /dev/null +++ b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/liferay-hook.xml @@ -0,0 +1,6 @@ + + + + + Language_en_US.properties + \ No newline at end of file diff --git a/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/src/Language_en_US.properties b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/src/Language_en_US.properties new file mode 100644 index 0000000..a2c08a6 --- /dev/null +++ b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/src/Language_en_US.properties @@ -0,0 +1 @@ +@portlet.name@-hello-world=Hello @portlet.display.name@! \ No newline at end of file diff --git a/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/src/log4j.properties b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/src/log4j.properties new file mode 100644 index 0000000..bdb36e3 --- /dev/null +++ b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/src/log4j.properties @@ -0,0 +1,8 @@ +log4j.rootLogger=INFO, CONSOLE + +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.EnhancedPatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}:%L] %m%n + +log4j.logger.com.liferay.faces.util.lifecycle.DebugPhaseListener=DEBUG +log4j.logger.com.liferay.sample=DEBUG \ No newline at end of file diff --git a/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/web.xml b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/web.xml new file mode 100644 index 0000000..2602df3 --- /dev/null +++ b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + com.sun.faces.expressionFactory + org.jboss.el.ExpressionFactoryImpl + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + \ No newline at end of file diff --git a/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/weblogic.xml b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/weblogic.xml new file mode 100644 index 0000000..8190f53 --- /dev/null +++ b/tools/templates/portlet_jsf_tmpl/docroot/WEB-INF/weblogic.xml @@ -0,0 +1,20 @@ + + + + + + com.sun.xml.bind.* + org.apache.commons.fileupload.* + org.apache.xerces.* + + true + true + + + jsf + + \ No newline at end of file diff --git a/tools/templates/portlet_jsf_tmpl/docroot/css/main.css b/tools/templates/portlet_jsf_tmpl/docroot/css/main.css new file mode 100644 index 0000000..eca0c22 --- /dev/null +++ b/tools/templates/portlet_jsf_tmpl/docroot/css/main.css @@ -0,0 +1,12 @@ +.portlet-msg-error { + font-style: italic; + font-weight: bold; + margin: 1px 0px 0px 0px; + padding: 1px 5px 1px 24px; +} + +.portlet-msg-info { + font-style: italic; + margin: 1px 0px 0px 0px; + padding: 1px 5px 1px 24px; +} \ No newline at end of file diff --git a/tools/templates/portlet_jsf_tmpl/docroot/views/view.xhtml b/tools/templates/portlet_jsf_tmpl/docroot/views/view.xhtml new file mode 100644 index 0000000..a2c5359 --- /dev/null +++ b/tools/templates/portlet_jsf_tmpl/docroot/views/view.xhtml @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_jsf_tmpl/ivy.xml b/tools/templates/portlet_jsf_tmpl/ivy.xml new file mode 100644 index 0000000..fb48321 --- /dev/null +++ b/tools/templates/portlet_jsf_tmpl/ivy.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_jsf_tmpl/test/integration/arquillian.xml b/tools/templates/portlet_jsf_tmpl/test/integration/arquillian.xml new file mode 100644 index 0000000..e67be6c --- /dev/null +++ b/tools/templates/portlet_jsf_tmpl/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + @jmx.remote.port@ + @app.server.tomcat.manager.password@ + @app.server.tomcat.manager.user@ + + + \ No newline at end of file diff --git a/tools/templates/portlet_liferay_faces_alloy_tmpl/docroot/views/view.xhtml b/tools/templates/portlet_liferay_faces_alloy_tmpl/docroot/views/view.xhtml new file mode 100644 index 0000000..98cd440 --- /dev/null +++ b/tools/templates/portlet_liferay_faces_alloy_tmpl/docroot/views/view.xhtml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_liferay_faces_alloy_tmpl/ivy.xml b/tools/templates/portlet_liferay_faces_alloy_tmpl/ivy.xml new file mode 100644 index 0000000..77fc6b3 --- /dev/null +++ b/tools/templates/portlet_liferay_faces_alloy_tmpl/ivy.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_liferay_faces_alloy_tmpl/test/integration/arquillian.xml b/tools/templates/portlet_liferay_faces_alloy_tmpl/test/integration/arquillian.xml new file mode 100644 index 0000000..e67be6c --- /dev/null +++ b/tools/templates/portlet_liferay_faces_alloy_tmpl/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + @jmx.remote.port@ + @app.server.tomcat.manager.password@ + @app.server.tomcat.manager.user@ + + + \ No newline at end of file diff --git a/tools/templates/portlet_primefaces_tmpl/docroot/views/view.xhtml b/tools/templates/portlet_primefaces_tmpl/docroot/views/view.xhtml new file mode 100644 index 0000000..aa6e886 --- /dev/null +++ b/tools/templates/portlet_primefaces_tmpl/docroot/views/view.xhtml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_primefaces_tmpl/ivy.xml b/tools/templates/portlet_primefaces_tmpl/ivy.xml new file mode 100644 index 0000000..52cc6c0 --- /dev/null +++ b/tools/templates/portlet_primefaces_tmpl/ivy.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_primefaces_tmpl/test/integration/arquillian.xml b/tools/templates/portlet_primefaces_tmpl/test/integration/arquillian.xml new file mode 100644 index 0000000..e67be6c --- /dev/null +++ b/tools/templates/portlet_primefaces_tmpl/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + @jmx.remote.port@ + @app.server.tomcat.manager.password@ + @app.server.tomcat.manager.user@ + + + \ No newline at end of file diff --git a/tools/templates/portlet_richfaces_tmpl/docroot/WEB-INF/web.xml b/tools/templates/portlet_richfaces_tmpl/docroot/WEB-INF/web.xml new file mode 100644 index 0000000..33c14d6 --- /dev/null +++ b/tools/templates/portlet_richfaces_tmpl/docroot/WEB-INF/web.xml @@ -0,0 +1,35 @@ + + + + + com.sun.faces.expressionFactory + org.jboss.el.ExpressionFactoryImpl + + + javax.faces.PROJECT_STAGE + Development + + + org.richfaces.resourceMapping.enabled + true + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Resource Servlet + org.richfaces.webapp.ResourceServlet + 1 + + + Resource Servlet + /org.richfaces.resources/* + + \ No newline at end of file diff --git a/tools/templates/portlet_richfaces_tmpl/docroot/WEB-INF/weblogic.xml b/tools/templates/portlet_richfaces_tmpl/docroot/WEB-INF/weblogic.xml new file mode 100644 index 0000000..e72d7ab --- /dev/null +++ b/tools/templates/portlet_richfaces_tmpl/docroot/WEB-INF/weblogic.xml @@ -0,0 +1,23 @@ + + + + + + com.sun.xml.bind.* + org.apache.commons.fileupload.* + org.apache.xerces.* + + true + true + + + jsf + + + richfaces + + \ No newline at end of file diff --git a/tools/templates/portlet_richfaces_tmpl/docroot/views/view.xhtml b/tools/templates/portlet_richfaces_tmpl/docroot/views/view.xhtml new file mode 100644 index 0000000..d47378b --- /dev/null +++ b/tools/templates/portlet_richfaces_tmpl/docroot/views/view.xhtml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_richfaces_tmpl/ivy.xml b/tools/templates/portlet_richfaces_tmpl/ivy.xml new file mode 100644 index 0000000..2b0162c --- /dev/null +++ b/tools/templates/portlet_richfaces_tmpl/ivy.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_richfaces_tmpl/test/integration/arquillian.xml b/tools/templates/portlet_richfaces_tmpl/test/integration/arquillian.xml new file mode 100644 index 0000000..e67be6c --- /dev/null +++ b/tools/templates/portlet_richfaces_tmpl/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + @jmx.remote.port@ + @app.server.tomcat.manager.password@ + @app.server.tomcat.manager.user@ + + + \ No newline at end of file diff --git a/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/jsp/view.jsp b/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/jsp/view.jsp new file mode 100644 index 0000000..9b66701 --- /dev/null +++ b/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/jsp/view.jsp @@ -0,0 +1,23 @@ +<%-- +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ +--%> + +<%@ page contentType="text/html" pageEncoding="UTF-8" %> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +This is the @portlet.display.name@ portlet.
+ +. \ No newline at end of file diff --git a/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/spring-context/portlet-application-context.xml b/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/spring-context/portlet-application-context.xml new file mode 100644 index 0000000..ba3abf7 --- /dev/null +++ b/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/spring-context/portlet-application-context.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/spring-context/portlet-context.xml b/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/spring-context/portlet-context.xml new file mode 100644 index 0000000..0b0ae59 --- /dev/null +++ b/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/spring-context/portlet-context.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/src/PortletViewController.java b/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/src/PortletViewController.java new file mode 100644 index 0000000..58ccfba --- /dev/null +++ b/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/src/PortletViewController.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package @portlet.java.package.name@; + +import com.liferay.portal.kernel.util.ReleaseInfo; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.portlet.bind.annotation.RenderMapping; + +@Controller +@RequestMapping("VIEW") +public class @portlet.java.class.name@PortletViewController { + + @RenderMapping + public String question(Model model) { + model.addAttribute("releaseInfo", ReleaseInfo.getReleaseInfo()); + + return "@portlet.name@/view"; + } + +} \ No newline at end of file diff --git a/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/web.xml b/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/web.xml new file mode 100644 index 0000000..3412378 --- /dev/null +++ b/tools/templates/portlet_spring_mvc_tmpl/docroot/WEB-INF/web.xml @@ -0,0 +1,25 @@ + + + + + contextConfigLocation + /WEB-INF/spring-context/portlet-application-context.xml + + + ViewRendererServlet + org.springframework.web.servlet.ViewRendererServlet + 1 + + + ViewRendererServlet + /WEB-INF/servlet/view + + + org.springframework.web.context.ContextLoaderListener + + \ No newline at end of file diff --git a/tools/templates/portlet_spring_mvc_tmpl/ivy.xml b/tools/templates/portlet_spring_mvc_tmpl/ivy.xml new file mode 100644 index 0000000..95a8d44 --- /dev/null +++ b/tools/templates/portlet_spring_mvc_tmpl/ivy.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_spring_mvc_tmpl/test/integration/arquillian.xml b/tools/templates/portlet_spring_mvc_tmpl/test/integration/arquillian.xml new file mode 100644 index 0000000..e67be6c --- /dev/null +++ b/tools/templates/portlet_spring_mvc_tmpl/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + @jmx.remote.port@ + @app.server.tomcat.manager.password@ + @app.server.tomcat.manager.user@ + + + \ No newline at end of file diff --git a/tools/templates/portlet_tmpl/build.xml b/tools/templates/portlet_tmpl/build.xml new file mode 100644 index 0000000..35a70c0 --- /dev/null +++ b/tools/templates/portlet_tmpl/build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_tmpl/docroot/WEB-INF/liferay-display.xml b/tools/templates/portlet_tmpl/docroot/WEB-INF/liferay-display.xml new file mode 100644 index 0000000..8dec0ee --- /dev/null +++ b/tools/templates/portlet_tmpl/docroot/WEB-INF/liferay-display.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_tmpl/docroot/WEB-INF/liferay-plugin-package.properties b/tools/templates/portlet_tmpl/docroot/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..952b1da --- /dev/null +++ b/tools/templates/portlet_tmpl/docroot/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,11 @@ +name=@portlet.display.name@ +module-group-id=liferay +module-incremental-version=1 +tags= +short-description= +long-description= +change-log= +page-url=http://www.liferay.com +author=Liferay, Inc. +licenses=LGPL +liferay-versions=6.2.0+ \ No newline at end of file diff --git a/tools/templates/portlet_tmpl/docroot/WEB-INF/liferay-portlet.xml b/tools/templates/portlet_tmpl/docroot/WEB-INF/liferay-portlet.xml new file mode 100644 index 0000000..f8cc2fb --- /dev/null +++ b/tools/templates/portlet_tmpl/docroot/WEB-INF/liferay-portlet.xml @@ -0,0 +1,28 @@ + + + + + + @portlet.name@ + /icon.png + /css/main.css + /js/main.js + @portlet.name@-portlet + + + administrator + Administrator + + + guest + Guest + + + power-user + Power User + + + user + User + + \ No newline at end of file diff --git a/tools/templates/portlet_tmpl/docroot/WEB-INF/portlet.xml b/tools/templates/portlet_tmpl/docroot/WEB-INF/portlet.xml new file mode 100644 index 0000000..c8b498b --- /dev/null +++ b/tools/templates/portlet_tmpl/docroot/WEB-INF/portlet.xml @@ -0,0 +1,34 @@ + + + + + @portlet.name@ + @portlet.display.name@ + com.liferay.util.bridges.mvc.MVCPortlet + + view-template + /view.jsp + + 0 + + text/html + + + @portlet.display.name@ + @portlet.display.name@ + @portlet.display.name@ + + + administrator + + + guest + + + power-user + + + user + + + \ No newline at end of file diff --git a/tools/templates/portlet_tmpl/docroot/css/main.css b/tools/templates/portlet_tmpl/docroot/css/main.css new file mode 100644 index 0000000..e69de29 diff --git a/tools/templates/portlet_tmpl/docroot/icon.png b/tools/templates/portlet_tmpl/docroot/icon.png new file mode 100644 index 0000000..807b862 Binary files /dev/null and b/tools/templates/portlet_tmpl/docroot/icon.png differ diff --git a/tools/templates/portlet_tmpl/docroot/js/main.js b/tools/templates/portlet_tmpl/docroot/js/main.js new file mode 100644 index 0000000..e69de29 diff --git a/tools/templates/portlet_tmpl/docroot/view.jsp b/tools/templates/portlet_tmpl/docroot/view.jsp new file mode 100644 index 0000000..1b3ecef --- /dev/null +++ b/tools/templates/portlet_tmpl/docroot/view.jsp @@ -0,0 +1,21 @@ +<% +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ +%> + +<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> + + + +This is the @portlet.display.name@ portlet. \ No newline at end of file diff --git a/tools/templates/portlet_tmpl/ivy.xml b/tools/templates/portlet_tmpl/ivy.xml new file mode 100644 index 0000000..e0efb00 --- /dev/null +++ b/tools/templates/portlet_tmpl/ivy.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_tmpl/test/integration/arquillian.xml b/tools/templates/portlet_tmpl/test/integration/arquillian.xml new file mode 100644 index 0000000..e67be6c --- /dev/null +++ b/tools/templates/portlet_tmpl/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + @jmx.remote.port@ + @app.server.tomcat.manager.password@ + @app.server.tomcat.manager.user@ + + + \ No newline at end of file diff --git a/tools/templates/portlet_vaadin_tmpl/docroot/WEB-INF/src/Application.java b/tools/templates/portlet_vaadin_tmpl/docroot/WEB-INF/src/Application.java new file mode 100644 index 0000000..4da9fd2 --- /dev/null +++ b/tools/templates/portlet_vaadin_tmpl/docroot/WEB-INF/src/Application.java @@ -0,0 +1,20 @@ +package @portlet.java.package.name@; + +import com.vaadin.Application; +import com.vaadin.ui.Label; +import com.vaadin.ui.Window; + +@SuppressWarnings("serial") +public class @portlet.java.class.name@Application extends Application { + + public void init() { + Window window = new Window(); + + setMainWindow(window); + + Label label = new Label("Hello @portlet.java.class.name@!"); + + window.addComponent(label); + } + +} \ No newline at end of file diff --git a/tools/templates/portlet_vaadin_tmpl/ivy.xml b/tools/templates/portlet_vaadin_tmpl/ivy.xml new file mode 100644 index 0000000..e0efb00 --- /dev/null +++ b/tools/templates/portlet_vaadin_tmpl/ivy.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/templates/portlet_vaadin_tmpl/test/integration/arquillian.xml b/tools/templates/portlet_vaadin_tmpl/test/integration/arquillian.xml new file mode 100644 index 0000000..e67be6c --- /dev/null +++ b/tools/templates/portlet_vaadin_tmpl/test/integration/arquillian.xml @@ -0,0 +1,15 @@ + + + + + + @jmx.remote.port@ + @app.server.tomcat.manager.password@ + @app.server.tomcat.manager.user@ + + + \ No newline at end of file diff --git a/tools/templates/theme_tmpl/build.xml b/tools/templates/theme_tmpl/build.xml new file mode 100644 index 0000000..79e16ea --- /dev/null +++ b/tools/templates/theme_tmpl/build.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tools/templates/theme_tmpl/docroot/WEB-INF/liferay-plugin-package.properties b/tools/templates/theme_tmpl/docroot/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..538a330 --- /dev/null +++ b/tools/templates/theme_tmpl/docroot/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,16 @@ +name=@theme.display.name@ +module-group-id=liferay +module-incremental-version=1 +tags= +short-description= +long-description= +change-log= +page-url=http://www.liferay.com +author=Liferay, Inc. +licenses=LGPL +liferay-versions=6.2.0+ + +#required-deployment-contexts=\ +# resources-importer-web + +resources-importer-developer-mode-enabled=true \ No newline at end of file diff --git a/tools/templates/theme_tmpl/docroot/WEB-INF/src/resources-importer/readme.txt b/tools/templates/theme_tmpl/docroot/WEB-INF/src/resources-importer/readme.txt new file mode 100644 index 0000000..bc25439 --- /dev/null +++ b/tools/templates/theme_tmpl/docroot/WEB-INF/src/resources-importer/readme.txt @@ -0,0 +1,2 @@ +See http://www.liferay.com/community/wiki/-/wiki/Main/Resources+Importer+Web +for more information about the Resources Importer. \ No newline at end of file diff --git a/tools/templates/theme_tmpl/docroot/WEB-INF/src/resources-importer/sitemap.json b/tools/templates/theme_tmpl/docroot/WEB-INF/src/resources-importer/sitemap.json new file mode 100644 index 0000000..f8b26ec --- /dev/null +++ b/tools/templates/theme_tmpl/docroot/WEB-INF/src/resources-importer/sitemap.json @@ -0,0 +1,22 @@ +{ + "layoutTemplateId": "2_columns_ii", + "privatePages": [ + { + "columns": [ + [ + { + "portletId": "58" + } + ], + [ + { + "portletId": "47" + } + ] + ], + "friendlyURL": "/home", + "name": "Welcome", + "title": "Welcome" + } + ] +} \ No newline at end of file diff --git a/tools/templates/web_tmpl/build.xml b/tools/templates/web_tmpl/build.xml new file mode 100644 index 0000000..9054f23 --- /dev/null +++ b/tools/templates/web_tmpl/build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tools/templates/web_tmpl/docroot/WEB-INF/liferay-plugin-package.properties b/tools/templates/web_tmpl/docroot/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..4858466 --- /dev/null +++ b/tools/templates/web_tmpl/docroot/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,11 @@ +name=@web.display.name@ +module-group-id=liferay +module-incremental-version=1 +tags= +short-description= +long-description= +change-log= +page-url=http://www.liferay.com +author=Liferay, Inc. +licenses=LGPL +liferay-versions=6.2.0+ \ No newline at end of file diff --git a/webs/build-common-web.xml b/webs/build-common-web.xml new file mode 100644 index 0000000..de785db --- /dev/null +++ b/webs/build-common-web.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/webs/build.xml b/webs/build.xml new file mode 100644 index 0000000..243ff76 --- /dev/null +++ b/webs/build.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + This task must be called by the create script. + + + + + + + + + + ${web.name}-web already exists. + + + + + + + + + + + + + + \ No newline at end of file diff --git a/webs/create.bat b/webs/create.bat new file mode 100644 index 0000000..499aaf6 --- /dev/null +++ b/webs/create.bat @@ -0,0 +1,25 @@ +@echo off + +if "" == "%1" goto errorCreate + +if "" == "%2" goto errorCreate + +call ant -Dweb.name=%1 -Dweb.display.name=%2 create + +rem call ant deploy + +goto end + +:errorCreate + echo. + echo Usage: create.bat hello-world "Hello World" + echo. + echo The first hello-world is your web id. A new directory will be created based on + echo the web id. + echo. + echo The second "Hello World" is the web's display name. The quotation marks are only + echo needed because there is a space in the display name. + + goto end + +:end \ No newline at end of file diff --git a/webs/create.sh b/webs/create.sh new file mode 100644 index 0000000..9db709f --- /dev/null +++ b/webs/create.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +#set -x + +if [ $# -lt 2 ]; then + echo + echo Usage: ./create.sh hello-world \"Hello World\" + echo + echo The first hello-world is your web id. A new directory will be created based on + echo the web id. + echo + echo The second \"Hello World\" is the web\'s display name. The quotation marks are only + echo needed because there is a space in the display name. + + exit 127 +fi + +ant -Dweb.name=$1 -Dweb.display.name=\"$2\" create + +#ant deploy + +exit 0 \ No newline at end of file diff --git a/webs/resources-importer-web/.classpath b/webs/resources-importer-web/.classpath new file mode 100644 index 0000000..76705bb --- /dev/null +++ b/webs/resources-importer-web/.classpath @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/webs/resources-importer-web/.project b/webs/resources-importer-web/.project new file mode 100644 index 0000000..fe51b93 --- /dev/null +++ b/webs/resources-importer-web/.project @@ -0,0 +1,28 @@ + + + resources-importer-web-6.2.x + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + 1669365750347 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/webs/resources-importer-web/build.xml b/webs/resources-importer-web/build.xml new file mode 100644 index 0000000..1de3913 --- /dev/null +++ b/webs/resources-importer-web/build.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/META-INF/custom_jsps/html/portlet/journal/article_toolbar.jsp b/webs/resources-importer-web/docroot/META-INF/custom_jsps/html/portlet/journal/article_toolbar.jsp new file mode 100644 index 0000000..ce194d6 --- /dev/null +++ b/webs/resources-importer-web/docroot/META-INF/custom_jsps/html/portlet/journal/article_toolbar.jsp @@ -0,0 +1,56 @@ +<%-- +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ +--%> + +<%@ include file="/html/portlet/journal/article_toolbar.portal.jsp" %> + +<% +String structureId = BeanParamUtil.getString(article, request, "structureId"); +%> + + + + var toolbar = A.Widget.getByNode('#articleToolbar'); + + toolbar.add( + { + icon: 'icon-download', + label: '<%= UnicodeLanguageUtil.get(pageContext, "download") %>', + on: { + click: function(event) { + event.domEvent.preventDefault(); + + var downloadArticleContent = Liferay.Util.openWindow( + { + dialog: { + bodyContent: '
<%= HtmlUtil.escapeJS(HtmlUtil.escape(article.getContent())) %>
', + modal: true + }, + id: 'articleDownload', + title: '<%= HtmlUtil.escapeJS(article.getTitle(locale)) %>' + } + ); + } + } + } + ); +
+ + +
\ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/liferay-hook.xml b/webs/resources-importer-web/docroot/WEB-INF/liferay-hook.xml new file mode 100644 index 0000000..46e222c --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/liferay-hook.xml @@ -0,0 +1,6 @@ + + + + + /META-INF/custom_jsps + \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/liferay-plugin-package.properties b/webs/resources-importer-web/docroot/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..aadab6a --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,11 @@ +name=Resources Importer +module-group-id=liferay +module-incremental-version=5 +tags=configuration, lar, layout, package, theme, web content +short-description= +long-description=The Resources Importer app allows front-end developers to package web content, portlet configurations, and layouts together in a theme without saving it as a compiled LAR file thereby allowing for greater flexibility in its usage between Liferay Portal versions.

This app will automatically create associated content when other plugins are deployed that are configured to make use of the Resources Importer app.

This app installs as a Liferay service. +change-log= +page-url=http://www.liferay.com +author=Liferay, Inc. +licenses=LGPL +liferay-versions=6.2.0+ \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/liferay-releng.changelog b/webs/resources-importer-web/docroot/WEB-INF/liferay-releng.changelog new file mode 100644 index 0000000..a88fa5b --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/liferay-releng.changelog @@ -0,0 +1,24 @@ +# +# Module Incremental Version 1 +# +c963f942b6ec873cc7ed9ca15d9c2ad000368ca8^..98f9ca2060df0a3ad6732e8b102a51eac5928be9=LPS-30463 LPS-30553 LPS-30592 LPS-31923 LPS-32328 LPS-32688 LPS-32853 LPS-32875 LPS-33103 LPS-33847 LPS-35230 LPS-35353 LPS-35834 LPS-35909 LPS-35910 LPS-36044 LPS-36506 LPS-37416 LPS-37425 LPS-39182 LPS-39703 LPS-40805 LPS-41113 + +# +# Module Incremental Version 2 +# +98f9ca2060df0a3ad6732e8b102a51eac5928be9^..a2a4d325e51f0c122bca4a743c60ddbc74999b4b=LPS-42647 LPS-43599 + +# +# Module Incremental Version 3 +# +a2a4d325e51f0c122bca4a743c60ddbc74999b4b^..ff5ec9072eae81e08dfd219ba55adab7b7bd14dc=LPS-43927 LPS-43961 + +# +# Module Incremental Version 4 +# +ff5ec9072eae81e08dfd219ba55adab7b7bd14dc^..8953b6381dbc36c8430e8840e980f314f86fbb12=LPS-31355 LPS-49570 LPS-50385 LPS-50395 LPS-50735 LPS-50736 LPS-50774 LPS-50808 LPS-50859 LPS-51096 LPS-51109 LPS-51131 LPS-51135 + +# +# Module Incremental Version 5 +# +8953b6381dbc36c8430e8840e980f314f86fbb12^..52292217d9bc0381332e1b87bad950b164eabdcb=LPS-52760 LPS-54241 LPS-54292 LPS-54576 LPS-55202 LPS-56930 LPS-57090 LPS-60723 \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/liferay-releng.changelog.md5 b/webs/resources-importer-web/docroot/WEB-INF/liferay-releng.changelog.md5 new file mode 100644 index 0000000..d8872e0 --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/liferay-releng.changelog.md5 @@ -0,0 +1 @@ +8387878b2856a4e32f1795b32f9fff04 \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/liferay-releng.properties b/webs/resources-importer-web/docroot/WEB-INF/liferay-releng.properties new file mode 100644 index 0000000..c44bca4 --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/liferay-releng.properties @@ -0,0 +1,9 @@ +bundle=true +category=Utility +demo-url= +dependent-apps= +labs=true +marketplace=true +public=true +support-url= +supported=false \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/META-INF/javadocs-all.xml b/webs/resources-importer-web/docroot/WEB-INF/src/META-INF/javadocs-all.xml new file mode 100644 index 0000000..a26b2cc --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/META-INF/javadocs-all.xml @@ -0,0 +1,1169 @@ + + + + + ResourcesImporterHotDeployMessageListener + com.liferay.resourcesimporter.messaging.ResourcesImporterHotDeployMessageListener + + + + getFileSystemImporter + + + + + + getLARImporter + + + + + + getPluginPackageProperties + + servletContext + javax.servlet.ServletContext + + + + + + + + getResourceImporter + + + + + + initialize + + message + com.liferay.portal.kernel.messaging.Message + + + + Exception + java.lang.Exception + + + + + onDeploy + + message + com.liferay.portal.kernel.messaging.Message + + + + Exception + java.lang.Exception + + + + + _RESOURCES_DIR + + + _log + + + + BaseImporter + com.liferay.resourcesimporter.util.BaseImporter + + + + afterPropertiesSet + + Exception + java.lang.Exception + + + + + getGroupId + + + + + + getTargetClassPK + + + + + + getTargetValueMap + + + + + + isExisting + + + + + + setCompanyId + + companyId + long + + + + + setResourcesDir + + resourcesDir + java.lang.String + + + + + setServletContext + + servletContext + javax.servlet.ServletContext + + + + + setServletContextName + + servletContextName + java.lang.String + + + + + setTargetClassName + + targetClassName + java.lang.String + + + + + setTargetValue + + targetValue + java.lang.String + + + + + getLayoutSetPrototype + + companyId + long + + + + name + java.lang.String + + + + + + + Exception + java.lang.Exception + + + + + companyId + + + existing + + + groupId + + + resourcesDir + + + servletContext + + + servletContextName + + + targetClassName + + + targetClassPK + + + targetValue + + + userId + + + + FileSystemImporter + com.liferay.resourcesimporter.util.FileSystemImporter + + + + importResources + + Exception + java.lang.Exception + + + + + addDDMStructures + + parentDDMStructureKey + java.lang.String + + + + structuresDirName + java.lang.String + + + + Exception + java.lang.Exception + + + + + addDDMStructures + + parentDDMStructureKey + java.lang.String + + + + fileName + java.lang.String + + + + inputStream + java.io.InputStream + + + + Exception + java.lang.Exception + + + + + addDDMTemplates + + ddmStructureKey + java.lang.String + + + + templatesDirName + java.lang.String + + + + Exception + java.lang.Exception + + + + + addDDMTemplates + + ddmStructureKey + java.lang.String + + + + fileName + java.lang.String + + + + inputStream + java.io.InputStream + + + + Exception + java.lang.Exception + + + + + addDLFileEntries + + fileEntriesDirName + java.lang.String + + + + Exception + java.lang.Exception + + + + + addDLFileEntry + + parentFolderId + long + + + + file + java.io.File + + + + Exception + java.lang.Exception + + + + + addDLFileEntry + + parentFolderId + long + + + + fileName + java.lang.String + + + + inputStream + java.io.InputStream + + + + length + long + + + + Exception + java.lang.Exception + + + + + addDLFolder + + parentFolderId + long + + + + folder + java.io.File + + + + + + + Exception + java.lang.Exception + + + + + addDLFolder + + parentFolderId + long + + + + folderName + java.lang.String + + + + + + + Exception + java.lang.Exception + + + + + addJournalArticles + + ddmStructureKey + java.lang.String + + + + ddmTemplateKey + java.lang.String + + + + articlesDirName + java.lang.String + + + + Exception + java.lang.Exception + + + + + addJournalArticles + + ddmStructureKey + java.lang.String + + + + ddmTemplateKey + java.lang.String + + + + fileName + java.lang.String + + + + inputStream + java.io.InputStream + + + + Exception + java.lang.Exception + + + + + addLayout + + privateLayout + boolean + + + + parentLayoutId + long + + + + layoutJSONObject + com.liferay.portal.kernel.json.JSONObject + + + + Exception + java.lang.Exception + + + + + addLayoutColumn + + layout + com.liferay.portal.model.Layout + + + + columnId + java.lang.String + + + + columnJSONArray + com.liferay.portal.kernel.json.JSONArray + + + + Exception + java.lang.Exception + + + + + addLayoutColumnPortlet + + layout + com.liferay.portal.model.Layout + + + + columnId + java.lang.String + + + + portletJSONObject + com.liferay.portal.kernel.json.JSONObject + + + + Exception + java.lang.Exception + + + + + addLayoutColumns + + layout + com.liferay.portal.model.Layout + + + + columnPrefix + java.lang.String + + + + columnsJSONArray + com.liferay.portal.kernel.json.JSONArray + + + + Exception + java.lang.Exception + + + + + addLayouts + + privateLayout + boolean + + + + parentLayoutId + long + + + + layoutsJSONArray + com.liferay.portal.kernel.json.JSONArray + + + + Exception + java.lang.Exception + + + + + doImportResources + + Exception + java.lang.Exception + + + + + getDDMTemplateLanguage + + fileName + java.lang.String + + + + + + + + getDefaultPortletJSONObject + + journalArticleId + java.lang.String + + + + + + + + getInputStream + + fileName + java.lang.String + + + + + + + Exception + java.lang.Exception + + + + + getJournalId + + fileName + java.lang.String + + + + + + + + getJSONArrayAsStringArray + + jsonObject + com.liferay.portal.kernel.json.JSONObject + + + + key + java.lang.String + + + + + + + + getJSONObject + + fileName + java.lang.String + + + + + + + Exception + java.lang.Exception + + + + + getMap + + locale + java.util.Locale + + + + value + java.lang.String + + + + + + + + getMap + + value + java.lang.String + + + + + + + + isJournalStructureXSD + + xsd + java.lang.String + + + + + + + Exception + java.lang.Exception + + + + + listFiles + + dir + java.io.File + + + + + + + + processJournalArticleContent + + content + java.lang.String + + + + + + + Exception + java.lang.Exception + + + + + replaceFileEntryURL + + content + java.lang.String + + + + + + + Exception + java.lang.Exception + + + + + setServiceContext + + name + java.lang.String + + + + + setupAssets + + assetsJSONArray + com.liferay.portal.kernel.json.JSONArray + + + + + setupAssets + + fileName + java.lang.String + + + + Exception + java.lang.Exception + + + + + setupSettings + + fileName + java.lang.String + + + + Exception + java.lang.Exception + + + + + setupSitemap + + fileName + java.lang.String + + + + Exception + java.lang.Exception + + + + + updateLayoutSetThemeId + + sitemapJSONObject + com.liferay.portal.kernel.json.JSONObject + + + + Exception + java.lang.Exception + + + + + serviceContext + + + _DL_DOCUMENTS_DIR_NAME + + + _JOURNAL_ARTICLES_DIR_NAME + + + _JOURNAL_DDM_STRUCTURES_DIR_NAME + + + _JOURNAL_DDM_TEMPLATES_DIR_NAME + + + _assetJSONObjectMap + + + _defaultLayoutTemplateId + + + _fileEntries + + + _fileEntryPattern + + + _resourcesDir + + + + Importer + com.liferay.resourcesimporter.util.Importer + + + + afterPropertiesSet + + Exception + java.lang.Exception + + + + + getGroupId + + + + + + getTargetClassPK + + + + + + importResources + + Exception + java.lang.Exception + + + + + isExisting + + + + + + setCompanyId + + companyId + long + + + + + setResourcesDir + + resourcesDir + java.lang.String + + + + + setServletContext + + servletContext + javax.servlet.ServletContext + + + + + setServletContextName + + servletContextName + java.lang.String + + + + + setTargetClassName + + className + java.lang.String + + + + + setTargetValue + + targetValue + java.lang.String + + + + + + ImporterException + com.liferay.resourcesimporter.util.ImporterException + + + ImporterException + + + ImporterException + + msg + java.lang.String + + + + + ImporterException + + msg + java.lang.String + + + + cause + java.lang.Throwable + + + + + ImporterException + + cause + java.lang.Throwable + + + + + + LARImporter + com.liferay.resourcesimporter.util.LARImporter + + + + importResources + + Exception + java.lang.Exception + + + + + setLARFile + + file + java.io.File + + + + + setLARInputStream + + inputStream + java.io.InputStream + + + + + setPrivateLARInputStream + + privateLARInputStream + java.io.InputStream + + + + + setPublicLARInputStream + + publicLARInputStream + java.io.InputStream + + + + + getParameterMap + + + + + + _log + + + _privateLARInputStream + + + _publicLARInputStream + + + + ResourceImporter + com.liferay.resourcesimporter.util.ResourceImporter + + + + importResources + + Exception + java.lang.Exception + + + + + addDDMStructures + + parentStructureId + java.lang.String + + + + structuresDirName + java.lang.String + + + + Exception + java.lang.Exception + + + + + addDDMTemplates + + ddmStructureKey + java.lang.String + + + + templatesDirName + java.lang.String + + + + Exception + java.lang.Exception + + + + + addDLFileEntries + + fileEntriesDirName + java.lang.String + + + + Exception + java.lang.Exception + + + + + addDLFileEntry + + resourcePath + java.lang.String + + + + Exception + java.lang.Exception + + + + + addDLFolder + + parentFolderId + long + + + + resourcePath + java.lang.String + + + + + + + Exception + java.lang.Exception + + + + + addJournalArticles + + ddmStructureKey + java.lang.String + + + + ddmTemplateKey + java.lang.String + + + + articlesDirName + java.lang.String + + + + Exception + java.lang.Exception + + + + + getInputStream + + fileName + java.lang.String + + + + + + + Exception + java.lang.Exception + + + + + _folderIds + + + \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/META-INF/javadocs-rt.xml b/webs/resources-importer-web/docroot/WEB-INF/src/META-INF/javadocs-rt.xml new file mode 100644 index 0000000..eb07e2a --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/META-INF/javadocs-rt.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/META-INF/messaging-spring.xml b/webs/resources-importer-web/docroot/WEB-INF/src/META-INF/messaging-spring.xml new file mode 100644 index 0000000..3550b19 --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/META-INF/messaging-spring.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/messaging/ResourcesImporterHotDeployMessageListener.java b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/messaging/ResourcesImporterHotDeployMessageListener.java new file mode 100644 index 0000000..fa76492 --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/messaging/ResourcesImporterHotDeployMessageListener.java @@ -0,0 +1,182 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.resourcesimporter.messaging; + +import com.liferay.portal.kernel.lar.ExportImportThreadLocal; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.messaging.HotDeployMessageListener; +import com.liferay.portal.kernel.messaging.Message; +import com.liferay.portal.kernel.messaging.MessageBusUtil; +import com.liferay.portal.kernel.servlet.ServletContextPool; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.model.Company; +import com.liferay.portal.security.auth.CompanyThreadLocal; +import com.liferay.portal.service.CompanyLocalServiceUtil; +import com.liferay.resourcesimporter.util.Importer; +import com.liferay.resourcesimporter.util.ImporterException; +import com.liferay.resourcesimporter.util.ImporterFactory; +import com.liferay.resourcesimporter.util.PluginPackageProperties; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletContext; + +/** + * @author Ryan Park + * @author Raymond Augé + */ +public class ResourcesImporterHotDeployMessageListener + extends HotDeployMessageListener { + + protected void initialize(Message message) throws Exception { + String servletContextName = message.getString("servletContextName"); + + ServletContext servletContext = ServletContextPool.get( + servletContextName); + + if (servletContext == null) { + return; + } + + PluginPackageProperties pluginPackageProperties = + new PluginPackageProperties(servletContext); + + String resourcesDir = pluginPackageProperties.getResourcesDir(); + + if ((servletContext.getResource( + ImporterFactory.RESOURCES_DIR) == null) && + (servletContext.getResource( + ImporterFactory.TEMPLATES_DIR) == null) && + Validator.isNull(resourcesDir)) { + + return; + } + + List companies = CompanyLocalServiceUtil.getCompanies(); + + try { + ExportImportThreadLocal.setLayoutImportInProcess(true); + ExportImportThreadLocal.setPortletImportInProcess(true); + + for (Company company : companies) { + importResources( + company, servletContext, pluginPackageProperties, + message.getResponseId()); + } + } + finally { + ExportImportThreadLocal.setLayoutImportInProcess(false); + ExportImportThreadLocal.setPortletImportInProcess(false); + } + } + + + protected void onDeploy(Message message) throws Exception { + initialize(message); + } + + private void importResources( + Company company, ServletContext servletContext, + PluginPackageProperties pluginPackageProperties, + String messageResponseId) + throws Exception { + + long companyId = CompanyThreadLocal.getCompanyId(); + + try { + CompanyThreadLocal.setCompanyId(company.getCompanyId()); + + ImporterFactory importerFactory = ImporterFactory.getInstance(); + + Importer importer = importerFactory.createImporter( + company.getCompanyId(), servletContext, + pluginPackageProperties); + + if (!importer.isDeveloperModeEnabled() && importer.isExisting() && + !importer.isCompanyGroup()) { + + if (_log.isInfoEnabled()) { + _log.info( + "Group or layout set prototype already exists " + + "for company " + company.getWebId()); + } + + return; + } + + long startTime = 0; + + if (_log.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + } + + importer.importResources(); + + if (_log.isInfoEnabled()) { + long endTime = System.currentTimeMillis() - startTime; + + _log.info( + "Importing resources from " + + servletContext.getServletContextName() + + " to group " + importer.getGroupId() + " takes " + + endTime + " ms"); + } + + Message message = new Message(); + + message.put("companyId", company.getCompanyId()); + message.put( + "servletContextName", servletContext.getServletContextName()); + message.put("targetClassName", importer.getTargetClassName()); + message.put("targetClassPK", importer.getTargetClassPK()); + + if (Validator.isNotNull(messageResponseId)) { + Map responseMap = new HashMap(); + + responseMap.put("groupId", importer.getTargetClassPK()); + + message.setPayload(responseMap); + + message.setResponseId(messageResponseId); + } + + MessageBusUtil.sendMessage("liferay/resources_importer", message); + } + catch (ImporterException ie) { + Message message = new Message(); + + message.put("companyId", company.getCompanyId()); + message.put("error", ie.getMessage()); + message.put( + "servletContextName", servletContext.getServletContextName()); + message.put( + "targetClassName", + pluginPackageProperties.getTargetClassName()); + message.put("targetClassPK", 0); + + MessageBusUtil.sendMessage("liferay/resources_importer", message); + } + finally { + CompanyThreadLocal.setCompanyId(companyId); + } + } + + private static Log _log = LogFactoryUtil.getLog( + ResourcesImporterHotDeployMessageListener.class); + +} \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/BaseImporter.java b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/BaseImporter.java new file mode 100644 index 0000000..7da8627 --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/BaseImporter.java @@ -0,0 +1,292 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.resourcesimporter.util; + +import com.liferay.portal.kernel.dao.orm.QueryUtil; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.util.LocaleUtil; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.model.Group; +import com.liferay.portal.model.GroupConstants; +import com.liferay.portal.model.Layout; +import com.liferay.portal.model.LayoutConstants; +import com.liferay.portal.model.LayoutPrototype; +import com.liferay.portal.model.LayoutSetPrototype; +import com.liferay.portal.model.LayoutTypePortlet; +import com.liferay.portal.model.User; +import com.liferay.portal.service.GroupLocalServiceUtil; +import com.liferay.portal.service.LayoutLocalServiceUtil; +import com.liferay.portal.service.LayoutPrototypeLocalServiceUtil; +import com.liferay.portal.service.LayoutSetPrototypeLocalServiceUtil; +import com.liferay.portal.service.ServiceContext; +import com.liferay.portal.service.UserLocalServiceUtil; + +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.ServletContext; + +/** + * @author Brian Wing Shun Chan + * @author Raymond Augé + */ +public abstract class BaseImporter implements Importer { + + + public void afterPropertiesSet() throws Exception { + User user = UserLocalServiceUtil.getDefaultUser(companyId); + + userId = user.getUserId(); + + if (isCompanyGroup()) { + return; + } + + Group group = null; + + if (targetClassName.equals(LayoutSetPrototype.class.getName())) { + LayoutSetPrototype layoutSetPrototype = getLayoutSetPrototype( + companyId, targetValue); + + if (layoutSetPrototype != null) { + existing = true; + } + else { + layoutSetPrototype = + LayoutSetPrototypeLocalServiceUtil.addLayoutSetPrototype( + userId, companyId, getTargetValueMap(), + StringPool.BLANK, true, true, new ServiceContext()); + } + + group = layoutSetPrototype.getGroup(); + + targetClassPK = layoutSetPrototype.getLayoutSetPrototypeId(); + } + else if (targetClassName.equals(Group.class.getName())) { + if (targetValue.equals(GroupConstants.GLOBAL)) { + group = GroupLocalServiceUtil.getCompanyGroup(companyId); + } + else if (targetValue.equals(GroupConstants.GUEST)) { + group = GroupLocalServiceUtil.getGroup( + companyId, GroupConstants.GUEST); + + List layouts = LayoutLocalServiceUtil.getLayouts( + group.getGroupId(), false, + LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, false, 0, 1); + + if (!layouts.isEmpty()) { + Layout layout = layouts.get(0); + + LayoutTypePortlet layoutTypePortlet = + (LayoutTypePortlet)layout.getLayoutType(); + + List portletIds = layoutTypePortlet.getPortletIds(); + + if (portletIds.size() != 2) { + existing = true; + } + + for (String portletId : portletIds) { + if (!portletId.equals("47") && + !portletId.equals("58")) { + + existing = true; + } + } + } + } + else { + group = GroupLocalServiceUtil.fetchGroup( + companyId, targetValue); + + if (group != null) { + existing = true; + } + else { + group = GroupLocalServiceUtil.addGroup( + userId, GroupConstants.DEFAULT_PARENT_GROUP_ID, + StringPool.BLANK, + GroupConstants.DEFAULT_PARENT_GROUP_ID, + GroupConstants.DEFAULT_LIVE_GROUP_ID, targetValue, + StringPool.BLANK, GroupConstants.TYPE_SITE_OPEN, true, + GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, null, + true, true, new ServiceContext()); + } + } + + targetClassPK = group.getGroupId(); + } + + if (group != null) { + groupId = group.getGroupId(); + } + } + + + public long getGroupId() { + return groupId; + } + + + public String getTargetClassName() { + return targetClassName; + } + + + public long getTargetClassPK() { + return targetClassPK; + } + + public Map getTargetValueMap() { + Map targetValueMap = new HashMap(); + + Locale locale = LocaleUtil.getDefault(); + + targetValueMap.put(locale, targetValue); + + return targetValueMap; + } + + + public boolean isCompanyGroup() throws Exception { + Group group = GroupLocalServiceUtil.fetchGroup(groupId); + + if (group == null) { + return false; + } + + return group.isCompany(); + } + + + public boolean isDeveloperModeEnabled() { + return developerModeEnabled; + } + + + public boolean isExisting() { + return existing; + } + + + public void setAppendVersion(boolean appendVersion) { + this.appendVersion = appendVersion; + } + + + public void setCompanyId(long companyId) { + this.companyId = companyId; + } + + + public void setDeveloperModeEnabled(boolean developerModeEnabled) { + this.developerModeEnabled = developerModeEnabled; + } + + + public void setGroupId(long groupId) { + this.groupId = groupId; + } + + + public void setResourcesDir(String resourcesDir) { + this.resourcesDir = resourcesDir; + } + + + public void setServletContext(ServletContext servletContext) { + this.servletContext = servletContext; + } + + + public void setServletContextName(String servletContextName) { + this.servletContextName = servletContextName; + } + + + public void setTargetClassName(String targetClassName) { + this.targetClassName = targetClassName; + } + + + public void setTargetValue(String targetValue) { + this.targetValue = targetValue; + } + + + public void setUpdateModeEnabled(boolean updateModeEnabled) { + this.updateModeEnabled = updateModeEnabled; + } + + + public void setVersion(String version) { + this.version = version; + } + + protected LayoutPrototype getLayoutPrototype(long companyId, String name) + throws SystemException { + + Locale locale = LocaleUtil.getDefault(); + + List layoutPrototypes = + LayoutPrototypeLocalServiceUtil.search( + companyId, null, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); + + for (LayoutPrototype layoutPrototype : layoutPrototypes) { + if (name.equals(layoutPrototype.getName(locale))) { + return layoutPrototype; + } + } + + return null; + } + + protected LayoutSetPrototype getLayoutSetPrototype( + long companyId, String name) + throws Exception { + + Locale locale = LocaleUtil.getDefault(); + + List layoutSetPrototypes = + LayoutSetPrototypeLocalServiceUtil.search( + companyId, null, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); + + for (LayoutSetPrototype layoutSetPrototype : layoutSetPrototypes) { + if (name.equals(layoutSetPrototype.getName(locale))) { + return layoutSetPrototype; + } + } + + return null; + } + + protected boolean appendVersion; + protected long companyId; + protected boolean developerModeEnabled; + protected boolean existing; + protected long groupId; + protected String resourcesDir; + protected ServletContext servletContext; + protected String servletContextName; + protected String targetClassName; + protected long targetClassPK; + protected String targetValue; + protected boolean updateModeEnabled; + protected long userId; + protected String version; + +} \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/FileSystemImporter.java b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/FileSystemImporter.java new file mode 100644 index 0000000..f795d19 --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/FileSystemImporter.java @@ -0,0 +1,1885 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.resourcesimporter.util; + +import com.liferay.portal.kernel.dao.orm.QueryUtil; +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.json.JSONArray; +import com.liferay.portal.kernel.json.JSONFactoryUtil; +import com.liferay.portal.kernel.json.JSONObject; +import com.liferay.portal.kernel.lar.ExportImportThreadLocal; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.repository.model.FileEntry; +import com.liferay.portal.kernel.search.Indexer; +import com.liferay.portal.kernel.search.IndexerRegistryUtil; +import com.liferay.portal.kernel.search.SearchEngineUtil; +import com.liferay.portal.kernel.search.SearchException; +import com.liferay.portal.kernel.template.TemplateConstants; +import com.liferay.portal.kernel.util.ArrayUtil; +import com.liferay.portal.kernel.util.FileUtil; +import com.liferay.portal.kernel.util.GetterUtil; +import com.liferay.portal.kernel.util.LocaleUtil; +import com.liferay.portal.kernel.util.LocalizationUtil; +import com.liferay.portal.kernel.util.MimeTypesUtil; +import com.liferay.portal.kernel.util.PropsKeys; +import com.liferay.portal.kernel.util.PropsUtil; +import com.liferay.portal.kernel.util.StringBundler; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.StringUtil; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.kernel.workflow.WorkflowConstants; +import com.liferay.portal.kernel.xml.Attribute; +import com.liferay.portal.kernel.xml.Document; +import com.liferay.portal.kernel.xml.Element; +import com.liferay.portal.kernel.xml.SAXReaderUtil; +import com.liferay.portal.model.Group; +import com.liferay.portal.model.Layout; +import com.liferay.portal.model.LayoutConstants; +import com.liferay.portal.model.LayoutPrototype; +import com.liferay.portal.model.LayoutSet; +import com.liferay.portal.model.LayoutSetPrototype; +import com.liferay.portal.model.LayoutTypePortlet; +import com.liferay.portal.model.LayoutTypePortletConstants; +import com.liferay.portal.model.PortletConstants; +import com.liferay.portal.model.Theme; +import com.liferay.portal.service.LayoutLocalServiceUtil; +import com.liferay.portal.service.LayoutPrototypeLocalServiceUtil; +import com.liferay.portal.service.LayoutSetLocalServiceUtil; +import com.liferay.portal.service.LayoutSetPrototypeLocalServiceUtil; +import com.liferay.portal.service.RepositoryLocalServiceUtil; +import com.liferay.portal.service.ServiceContext; +import com.liferay.portal.service.ServiceContextThreadLocal; +import com.liferay.portal.service.ThemeLocalServiceUtil; +import com.liferay.portal.util.PortalUtil; +import com.liferay.portal.util.PortletKeys; +import com.liferay.portlet.PortletPreferencesFactoryUtil; +import com.liferay.portlet.asset.model.AssetCategory; +import com.liferay.portlet.asset.model.AssetEntry; +import com.liferay.portlet.asset.model.AssetTag; +import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; +import com.liferay.portlet.blogs.model.BlogsEntry; +import com.liferay.portlet.documentlibrary.DuplicateFileException; +import com.liferay.portlet.documentlibrary.model.DLFileEntry; +import com.liferay.portlet.documentlibrary.model.DLFolder; +import com.liferay.portlet.documentlibrary.model.DLFolderConstants; +import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; +import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; +import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil; +import com.liferay.portlet.documentlibrary.util.DLUtil; +import com.liferay.portlet.dynamicdatalists.model.DDLRecordSet; +import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; +import com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants; +import com.liferay.portlet.dynamicdatamapping.model.DDMTemplate; +import com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants; +import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalServiceUtil; +import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil; +import com.liferay.portlet.journal.model.JournalArticle; +import com.liferay.portlet.journal.model.JournalArticleConstants; +import com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil; +import com.liferay.portlet.journal.service.JournalArticleServiceUtil; +import com.liferay.portlet.journal.util.JournalConverterUtil; +import com.liferay.portlet.wiki.model.WikiPage; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.Serializable; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.portlet.PortletPreferences; + +/** + * @author Ryan Park + * @author Raymond Augé + */ +public class FileSystemImporter extends BaseImporter { + + + public void importResources() throws Exception { + _resourcesDir = new File(resourcesDir); + + if (!_resourcesDir.isDirectory() || !_resourcesDir.canRead()) { + throw new IllegalArgumentException( + "Unaccessible resource directory " + resourcesDir); + } + + doImportResources(); + } + + protected void addApplicationDisplayTemplate( + String script, File file, long classNameId) + throws PortalException, SystemException { + + String fileName = FileUtil.stripExtension(file.getName()); + + String name = getName(fileName); + + DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.fetchTemplate( + groupId, classNameId, getKey(fileName)); + + if (ddmTemplate != null) { + if (!developerModeEnabled) { + if (_log.isInfoEnabled()) { + _log.info( + "DDM template with name " + name + " and version " + + version + " already exists"); + } + + return; + } + + if (!updateModeEnabled) { + DDMTemplateLocalServiceUtil.deleteTemplate(ddmTemplate); + } + } + + try { + if (!updateModeEnabled || (ddmTemplate == null)) { + DDMTemplateLocalServiceUtil.addTemplate( + userId, groupId, classNameId, 0, getKey(fileName), + getMap(name), null, + DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, + StringPool.BLANK, getDDMTemplateLanguage(file.getName()), + script, true, false, StringPool.BLANK, null, + serviceContext); + } + else { + DDMTemplateLocalServiceUtil.updateTemplate( + ddmTemplate.getTemplateId(), ddmTemplate.getClassPK(), + getMap(name), null, + DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, + StringPool.BLANK, getDDMTemplateLanguage(file.getName()), + script, ddmTemplate.getCacheable(), serviceContext); + } + } + catch (PortalException e) { + if (_log.isWarnEnabled()) { + _log.warn( + "Unable to import application display template " + + file.getName(), + e); + } + + throw e; + } + } + + protected void addApplicationDisplayTemplate( + String parentDirName, String dirName, long classNameId) + throws Exception { + + File dir = new File( + _resourcesDir, parentDirName + StringPool.SLASH + dirName); + + if (!dir.isDirectory() || !dir.canRead()) { + return; + } + + File[] files = listFiles(dir); + + for (File file : files) { + String script = StringUtil.read(getInputStream(file)); + + if (Validator.isNull(script)) { + continue; + } + + addApplicationDisplayTemplate(script, file, classNameId); + } + } + + protected void addApplicationDisplayTemplates(String dirName) + throws Exception { + + for (Object[] applicationDisplayTemplateType : + _APPLICATION_DISPLAY_TEMPLATE_TYPES) { + + Class clazz = (Class)applicationDisplayTemplateType[1]; + + addApplicationDisplayTemplate( + dirName, (String)applicationDisplayTemplateType[0], + PortalUtil.getClassNameId(clazz)); + } + } + + protected void addDDLDisplayTemplates( + String ddmStructureKey, String dirName, String fileName) + throws Exception { + + DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure( + groupId, PortalUtil.getClassNameId(DDLRecordSet.class), + ddmStructureKey); + + File dir = new File( + _resourcesDir, dirName + StringPool.SLASH + fileName); + + if (!dir.isDirectory() || !dir.canRead()) { + return; + } + + File[] files = listFiles(dir); + + for (File file : files) { + String script = StringUtil.read(getInputStream(file)); + + if (Validator.isNull(script)) { + return; + } + + addDDMTemplate( + groupId, ddmStructure.getStructureId(), file.getName(), + getDDMTemplateLanguage(file.getName()), script, + DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, null); + } + } + + protected void addDDLFormTemplates( + String ddmStructureKey, String dirName, String fileName) + throws Exception { + + DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure( + groupId, PortalUtil.getClassNameId(DDLRecordSet.class), + ddmStructureKey); + + File dir = new File( + _resourcesDir, dirName + StringPool.SLASH + fileName); + + if (!dir.isDirectory() || !dir.canRead()) { + return; + } + + File[] files = listFiles(dir); + + for (File file : files) { + String script = StringUtil.read(getInputStream(file)); + + if (Validator.isNull(script)) { + return; + } + + addDDMTemplate( + groupId, ddmStructure.getStructureId(), file.getName(), "xsd", + script, DDMTemplateConstants.TEMPLATE_TYPE_FORM, + DDMTemplateConstants.TEMPLATE_MODE_CREATE); + } + } + + protected void addDDLStructures(String dirName) throws Exception { + File dir = new File(_resourcesDir, dirName); + + if (!dir.isDirectory() || !dir.canRead()) { + return; + } + + File[] files = listFiles(dir); + + for (File file : files) { + String fileName = FileUtil.stripExtension(file.getName()); + + addDDMStructures(fileName, getInputStream(file)); + } + } + + protected void addDDMStructures(String fileName, InputStream inputStream) + throws Exception { + + fileName = FileUtil.stripExtension(fileName); + + String name = getName(fileName); + + DDMStructure ddmStructure = DDMStructureLocalServiceUtil.fetchStructure( + groupId, PortalUtil.getClassNameId(DDLRecordSet.class), + getKey(fileName)); + + if (ddmStructure != null) { + if (!developerModeEnabled) { + if (_log.isInfoEnabled()) { + _log.info( + "DDM structure with name " + name + " and version " + + version + " already exists"); + } + + return; + } + + if (!updateModeEnabled) { + DDMStructureLocalServiceUtil.deleteDDMStructure(ddmStructure); + } + } + + try { + if (!updateModeEnabled || (ddmStructure == null)) { + ddmStructure = DDMStructureLocalServiceUtil.addStructure( + userId, groupId, + DDMStructureConstants.DEFAULT_PARENT_STRUCTURE_ID, + PortalUtil.getClassNameId(DDLRecordSet.class), + getKey(fileName), getMap(name), null, + StringUtil.read(inputStream), + PropsUtil.get(PropsKeys.DYNAMIC_DATA_LISTS_STORAGE_TYPE), + DDMStructureConstants.TYPE_DEFAULT, serviceContext); + } + else { + ddmStructure = DDMStructureLocalServiceUtil.updateStructure( + ddmStructure.getStructureId(), + DDMStructureConstants.DEFAULT_PARENT_STRUCTURE_ID, + getMap(name), null, StringUtil.read(inputStream), + serviceContext); + } + } + catch (Exception e) { + if (_log.isWarnEnabled()) { + _log.warn("Unable to import DDM structure " + fileName, e); + } + + throw e; + } + + addDDLDisplayTemplates( + ddmStructure.getStructureKey(), + _DDL_STRUCTURE_DISPLAY_TEMPLATE_DIR_NAME, fileName); + + addDDLFormTemplates( + ddmStructure.getStructureKey(), + _DDL_STRUCTURE_FORM_TEMPLATE_DIR_NAME, fileName); + } + + protected void addDDMStructures( + String parentDDMStructureKey, String dirName) + throws Exception { + + File dir = new File(_resourcesDir, dirName); + + if (!dir.isDirectory() || !dir.canRead()) { + return; + } + + File[] files = listFiles(dir); + + for (File file : files) { + InputStream inputStream = null; + + try { + inputStream = new BufferedInputStream( + new FileInputStream(file)); + + addDDMStructures( + parentDDMStructureKey, file.getName(), inputStream); + } + finally { + if (inputStream != null) { + inputStream.close(); + } + } + } + } + + protected void addDDMStructures( + String parentDDMStructureKey, String fileName, + InputStream inputStream) + throws Exception { + + fileName = FileUtil.stripExtension(fileName); + + String name = getName(fileName); + + DDMStructure ddmStructure = DDMStructureLocalServiceUtil.fetchStructure( + groupId, PortalUtil.getClassNameId(JournalArticle.class), + getKey(fileName)); + + if (ddmStructure != null) { + if (!developerModeEnabled) { + if (_log.isInfoEnabled()) { + _log.info( + "DDM structure with name " + name + " and version " + + version + " already exists"); + } + + return; + } + + if (!updateModeEnabled) { + DDMStructureLocalServiceUtil.deleteDDMStructure(ddmStructure); + } + } + + String xsd = StringUtil.read(inputStream); + + if (isJournalStructureXSD(xsd)) { + xsd = JournalConverterUtil.getDDMXSD(xsd); + } + + setServiceContext(fileName); + + try { + if (!updateModeEnabled || (ddmStructure == null)) { + ddmStructure = DDMStructureLocalServiceUtil.addStructure( + userId, groupId, parentDDMStructureKey, + PortalUtil.getClassNameId(JournalArticle.class), + getKey(fileName), getMap(name), null, xsd, + PropsUtil.get(PropsKeys.JOURNAL_ARTICLE_STORAGE_TYPE), + DDMStructureConstants.TYPE_DEFAULT, serviceContext); + } + else { + DDMStructure parentStructure = + DDMStructureLocalServiceUtil.fetchStructure( + groupId, + PortalUtil.getClassNameId(JournalArticle.class), + parentDDMStructureKey); + + long parentDDMStructureId = + DDMStructureConstants.DEFAULT_PARENT_STRUCTURE_ID; + + if (parentStructure != null) { + parentDDMStructureId = parentStructure.getStructureId(); + } + + ddmStructure = DDMStructureLocalServiceUtil.updateStructure( + ddmStructure.getStructureId(), parentDDMStructureId, + getMap(name), null, xsd, serviceContext); + } + } + catch (PortalException e) { + if (_log.isWarnEnabled()) { + _log.warn("Unable to import DDM structure " + fileName, e); + } + + throw e; + } + + _ddmStructures.add(ddmStructure.getStructureKey()); + + addDDMTemplates( + ddmStructure.getStructureKey(), + _JOURNAL_DDM_TEMPLATES_DIR_NAME + fileName); + + if (Validator.isNull(parentDDMStructureKey)) { + addDDMStructures( + ddmStructure.getStructureKey(), + _JOURNAL_DDM_STRUCTURES_DIR_NAME + fileName); + } + } + + protected void addDDMTemplate( + long templateGroupId, long ddmStructureId, String fileName, + String language, String script, String type, String mode) + throws Exception { + + fileName = FileUtil.getShortFileName(fileName); + + fileName = FileUtil.stripExtension(fileName); + + String name = getName(fileName); + + DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.fetchTemplate( + groupId, PortalUtil.getClassNameId(DDMStructure.class), + getKey(fileName)); + + if (ddmTemplate != null) { + if (!developerModeEnabled) { + if (_log.isInfoEnabled()) { + _log.info( + "DDM template with name " + name + " and version " + + version + " already exists"); + } + + return; + } + + if (!updateModeEnabled) { + DDMTemplateLocalServiceUtil.deleteTemplate(ddmTemplate); + } + } + + try { + if (!updateModeEnabled || (ddmTemplate == null)) { + DDMTemplateLocalServiceUtil.addTemplate( + userId, templateGroupId, + PortalUtil.getClassNameId(DDMStructure.class), + ddmStructureId, getKey(fileName), getMap(name), null, type, + mode, language, script, true, false, StringPool.BLANK, null, + serviceContext); + } + else { + DDMTemplateLocalServiceUtil.updateTemplate( + ddmTemplate.getTemplateId(), + PortalUtil.getClassNameId(DDMStructure.class), getMap(name), + null, DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, null, + language, script, ddmTemplate.getCacheable(), + serviceContext); + } + } + catch (PortalException e) { + if (_log.isWarnEnabled()) { + _log.warn("Unable to import DDM template " + fileName, e); + } + + throw e; + } + } + + protected void addDDMTemplates(String ddmStructureKey, String dirName) + throws Exception { + + File dir = new File(_resourcesDir, dirName); + + if (!dir.isDirectory() || !dir.canRead()) { + return; + } + + File[] files = listFiles(dir); + + for (File file : files) { + InputStream inputStream = null; + + try { + inputStream = new BufferedInputStream( + new FileInputStream(file)); + + addDDMTemplates(ddmStructureKey, file.getName(), inputStream); + } + finally { + if (inputStream != null) { + inputStream.close(); + } + } + } + } + + protected void addDDMTemplates( + String ddmStructureKey, String fileName, InputStream inputStream) + throws Exception { + + String language = getDDMTemplateLanguage(fileName); + + fileName = FileUtil.stripExtension(fileName); + + String name = getName(fileName); + + String xsl = StringUtil.read(inputStream); + + setServiceContext(fileName); + + DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure( + groupId, PortalUtil.getClassNameId(JournalArticle.class), + ddmStructureKey); + + DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.fetchTemplate( + groupId, PortalUtil.getClassNameId(DDMStructure.class), + getKey(fileName)); + + if (ddmTemplate != null) { + if (!developerModeEnabled) { + if (_log.isInfoEnabled()) { + _log.info( + "DDM template with name " + name + " and version " + + version + " already exists"); + } + + return; + } + + if (!updateModeEnabled) { + DDMTemplateLocalServiceUtil.deleteTemplate(ddmTemplate); + } + } + + try { + if (!updateModeEnabled || (ddmTemplate == null)) { + ddmTemplate = DDMTemplateLocalServiceUtil.addTemplate( + userId, groupId, + PortalUtil.getClassNameId(DDMStructure.class), + ddmStructure.getStructureId(), getKey(fileName), + getMap(name), null, + DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, null, language, + replaceFileEntryURL(xsl), true, false, null, null, + serviceContext); + } + else { + ddmTemplate = DDMTemplateLocalServiceUtil.updateTemplate( + ddmTemplate.getTemplateId(), + PortalUtil.getClassNameId(DDMStructure.class), getMap(name), + null, DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, null, + language, replaceFileEntryURL(xsl), + ddmTemplate.getCacheable(), serviceContext); + } + } + catch (PortalException e) { + if (_log.isWarnEnabled()) { + _log.warn("Unable to import DDM template " + fileName, e); + } + + throw e; + } + + addJournalArticles( + ddmStructureKey, ddmTemplate.getTemplateKey(), + _JOURNAL_ARTICLES_DIR_NAME + fileName); + } + + protected void addDLFileEntries(String dirName) throws Exception { + File dir = new File(_resourcesDir, dirName); + + if (!dir.isDirectory()|| !dir.canRead()) { + return; + } + + File[] files = dir.listFiles(); + + if (ArrayUtil.isEmpty(files)) { + return; + } + + for (File file : files) { + if (file.isDirectory()) { + addDLFolder(DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, file); + } + else { + addDLFileEntry( + DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, file); + } + } + } + + protected void addDLFileEntry(long parentFolderId, File file) + throws Exception { + + InputStream inputStream = null; + + try { + inputStream = new BufferedInputStream(new FileInputStream(file)); + + addDLFileEntry( + parentFolderId, file.getName(), inputStream, file.length()); + } + finally { + if (inputStream != null) { + inputStream.close(); + } + } + } + + protected void addDLFileEntry( + long parentFolderId, String fileName, InputStream inputStream, + long length) + throws Exception { + + String title = FileUtil.stripExtension(fileName); + + setServiceContext(fileName); + + FileEntry fileEntry = null; + + try { + try { + fileEntry = DLAppLocalServiceUtil.addFileEntry( + userId, groupId, parentFolderId, fileName, + MimeTypesUtil.getContentType(fileName), title, + StringPool.BLANK, StringPool.BLANK, inputStream, length, + serviceContext); + } + catch (DuplicateFileException dfe) { + fileEntry = DLAppLocalServiceUtil.getFileEntry( + groupId, parentFolderId, title); + + String previousVersion = fileEntry.getVersion(); + + fileEntry = DLAppLocalServiceUtil.updateFileEntry( + userId, fileEntry.getFileEntryId(), fileName, + MimeTypesUtil.getContentType(fileName), title, + StringPool.BLANK, StringPool.BLANK, true, inputStream, + length, serviceContext); + + DLFileEntryLocalServiceUtil.deleteFileVersion( + fileEntry.getUserId(), fileEntry.getFileEntryId(), + previousVersion); + } + } + catch (PortalException e) { + if (_log.isWarnEnabled()) { + _log.warn("Unable to import DL file entry " + fileName, e); + } + + throw e; + } + + addPrimaryKey(DLFileEntry.class.getName(), fileEntry.getPrimaryKey()); + + _fileEntries.put(fileName, fileEntry); + } + + protected long addDLFolder(long parentFolderId, File folder) + throws Exception { + + long folderId = addDLFolder(parentFolderId, folder.getName()); + + File[] files = folder.listFiles(); + + if (ArrayUtil.isEmpty(files)) { + return folderId; + } + + for (File file : files) { + if (file.isDirectory()) { + addDLFolder(folderId, file); + } + else { + addDLFileEntry(folderId, file); + } + } + + return folderId; + } + + protected long addDLFolder(long parentFolderId, String folderName) + throws Exception { + + DLFolder dlFolder = DLFolderLocalServiceUtil.fetchFolder( + groupId, parentFolderId, folderName); + + if (dlFolder == null) { + dlFolder = DLFolderLocalServiceUtil.addFolder( + userId, groupId, groupId, false, parentFolderId, folderName, + null, false, serviceContext); + } + + addPrimaryKey(DLFolder.class.getName(), dlFolder.getPrimaryKey()); + + return dlFolder.getFolderId(); + } + + protected void addJournalArticles( + String ddmStructureKey, String ddmTemplateKey, String dirName) + throws Exception { + + File dir = new File(_resourcesDir, dirName); + + if (!dir.isDirectory() || !dir.canRead()) { + return; + } + + File[] files = listFiles(dir); + + for (File file : files) { + InputStream inputStream = null; + + try { + inputStream = new BufferedInputStream( + new FileInputStream(file)); + + addJournalArticles( + ddmStructureKey, ddmTemplateKey, file.getName(), + inputStream); + } + finally { + if (inputStream != null) { + inputStream.close(); + } + } + } + } + + protected void addJournalArticles( + String ddmStructureKey, String ddmTemplateKey, String fileName, + InputStream inputStream) + throws Exception { + + String title = FileUtil.stripExtension(fileName); + + JSONObject assetJSONObject = _assetJSONObjectMap.get(fileName); + + Map descriptionMap = null; + + boolean indexable = true; + + if (assetJSONObject != null) { + String abstractSummary = assetJSONObject.getString( + "abstractSummary"); + + descriptionMap = getMap(abstractSummary); + + indexable = GetterUtil.getBoolean( + assetJSONObject.getString("indexable"), true); + } + + String content = StringUtil.read(inputStream); + + content = processJournalArticleContent(content); + + Locale articleDefaultLocale = LocaleUtil.fromLanguageId( + LocalizationUtil.getDefaultLanguageId(content)); + + boolean smallImage = false; + String smallImageURL = StringPool.BLANK; + + if (assetJSONObject != null) { + String smallImageFileName = assetJSONObject.getString("smallImage"); + + if (Validator.isNotNull(smallImageFileName)) { + smallImage = true; + + FileEntry fileEntry = _fileEntries.get(smallImageFileName); + + if (fileEntry != null) { + smallImageURL = DLUtil.getPreviewURL( + fileEntry, fileEntry.getFileVersion(), null, + StringPool.BLANK); + } + } + } + + setServiceContext(fileName); + + String journalArticleId = getJournalId(fileName); + + JournalArticle journalArticle = + JournalArticleLocalServiceUtil.fetchLatestArticle( + groupId, journalArticleId, WorkflowConstants.STATUS_ANY); + + try { + if (journalArticle == null) { + journalArticle = JournalArticleLocalServiceUtil.addArticle( + userId, groupId, 0, 0, 0, journalArticleId, false, + JournalArticleConstants.VERSION_DEFAULT, + getMap(articleDefaultLocale, title), descriptionMap, + content, "general", ddmStructureKey, ddmTemplateKey, + StringPool.BLANK, 1, 1, 2010, 0, 0, 0, 0, 0, 0, 0, true, 0, + 0, 0, 0, 0, true, indexable, smallImage, smallImageURL, + null, new HashMap(), StringPool.BLANK, + serviceContext); + } + else { + journalArticle = + JournalArticleLocalServiceUtil.updateArticle( + userId, groupId, 0, journalArticleId, + journalArticle.getVersion(), + getMap(articleDefaultLocale, title), descriptionMap, + content, "general", ddmStructureKey, ddmTemplateKey, + StringPool.BLANK, 1, 1, 2010, 0, 0, 0, 0, 0, 0, 0, true, + 0, 0, 0, 0, 0, true, indexable, smallImage, + smallImageURL, null, new HashMap(), + StringPool.BLANK, serviceContext); + } + + JournalArticleLocalServiceUtil.updateStatus( + userId, groupId, journalArticle.getArticleId(), + journalArticle.getVersion(), WorkflowConstants.STATUS_APPROVED, + StringPool.BLANK, new HashMap(), + serviceContext); + } + catch (PortalException e) { + if (_log.isWarnEnabled()) { + _log.warn("Unable to import journal article " + fileName, e); + } + + throw e; + } + + addPrimaryKey( + JournalArticle.class.getName(), journalArticle.getPrimaryKey()); + } + + protected void addLayout( + boolean privateLayout, long parentLayoutId, + JSONObject layoutJSONObject) + throws Exception { + + if (targetClassName.equals(LayoutSetPrototype.class.getName())) { + privateLayout = true; + } + + Map nameMap = getMap(layoutJSONObject, "name"); + Map titleMap = getMap(layoutJSONObject, "title"); + + String type = layoutJSONObject.getString("type"); + + if (Validator.isNull(type)) { + type = LayoutConstants.TYPE_PORTLET; + } + + String typeSettings = layoutJSONObject.getString("typeSettings"); + + boolean hidden = layoutJSONObject.getBoolean("hidden"); + + Map friendlyURLMap = new HashMap(); + + String friendlyURL = layoutJSONObject.getString("friendlyURL"); + + if (Validator.isNotNull(friendlyURL) && + !friendlyURL.startsWith(StringPool.SLASH)) { + + friendlyURL = StringPool.SLASH + friendlyURL; + } + + friendlyURLMap.put(LocaleUtil.getDefault(), friendlyURL); + + ServiceContext serviceContext = new ServiceContext(); + + serviceContext.setCompanyId(companyId); + serviceContext.setScopeGroupId(groupId); + serviceContext.setUserId(userId); + + ServiceContextThreadLocal.pushServiceContext(serviceContext); + + try { + String layoutPrototypeName = layoutJSONObject.getString( + "layoutPrototypeName"); + + String layoutPrototypeUuid = null; + + if (Validator.isNotNull(layoutPrototypeName)) { + LayoutPrototype layoutPrototype = getLayoutPrototype( + companyId, layoutPrototypeName); + + layoutPrototypeUuid = layoutPrototype.getUuid(); + } + else { + layoutPrototypeUuid = layoutJSONObject.getString( + "layoutPrototypeUuid"); + } + + if (Validator.isNotNull(layoutPrototypeUuid)) { + boolean layoutPrototypeLinkEnabled = GetterUtil.getBoolean( + layoutJSONObject.getString("layoutPrototypeLinkEnabled"), + false); + + serviceContext.setAttribute( + "layoutPrototypeLinkEnabled", layoutPrototypeLinkEnabled); + + serviceContext.setAttribute( + "layoutPrototypeUuid", layoutPrototypeUuid); + } + + Layout layout = LayoutLocalServiceUtil.fetchLayoutByFriendlyURL( + groupId, privateLayout, friendlyURL); + + if (layout != null) { + if (!developerModeEnabled) { + if (_log.isInfoEnabled()) { + _log.info( + "Layout with friendly URL " + friendlyURL + + " already exists"); + } + + return; + } + + if (!updateModeEnabled) { + LayoutLocalServiceUtil.deleteLayout(layout); + } + } + + if (!updateModeEnabled || (layout == null)) { + layout = LayoutLocalServiceUtil.addLayout( + userId, groupId, privateLayout, parentLayoutId, nameMap, + titleMap, null, null, null, type, typeSettings, hidden, + friendlyURLMap, serviceContext); + } + else { + layout = LayoutLocalServiceUtil.updateLayout( + groupId, privateLayout, layout.getLayoutId(), + parentLayoutId, nameMap, titleMap, + layout.getDescriptionMap(), layout.getKeywordsMap(), + layout.getRobotsMap(), type, hidden, friendlyURLMap, + layout.getIconImage(), null, serviceContext); + } + + LayoutTypePortlet layoutTypePortlet = + (LayoutTypePortlet)layout.getLayoutType(); + + String layoutTemplateId = layoutJSONObject.getString( + "layoutTemplateId", _defaultLayoutTemplateId); + + if (Validator.isNotNull(layoutTemplateId)) { + layoutTypePortlet.setLayoutTemplateId( + userId, layoutTemplateId, false); + } + + JSONArray columnsJSONArray = layoutJSONObject.getJSONArray( + "columns"); + + addLayoutColumns( + layout, LayoutTypePortletConstants.COLUMN_PREFIX, + columnsJSONArray); + + LayoutLocalServiceUtil.updateLayout( + groupId, layout.isPrivateLayout(), layout.getLayoutId(), + layout.getTypeSettings()); + + JSONArray layoutsJSONArray = layoutJSONObject.getJSONArray( + "layouts"); + + addLayouts(privateLayout, layout.getLayoutId(), layoutsJSONArray); + } + catch (Exception e) { + if (_log.isWarnEnabled()) { + _log.warn("Unable to import layout " + layoutJSONObject, e); + } + + throw e; + } + finally { + ServiceContextThreadLocal.popServiceContext(); + } + } + + protected void addLayoutColumn( + Layout layout, String columnId, JSONArray columnJSONArray) + throws Exception { + + if (columnJSONArray == null) { + return; + } + + for (int i = 0; i < columnJSONArray.length(); i++) { + JSONObject portletJSONObject = columnJSONArray.getJSONObject(i); + + if (portletJSONObject == null) { + String journalArticleId = getJournalId( + columnJSONArray.getString(i)); + + portletJSONObject = getDefaultPortletJSONObject( + journalArticleId); + } + + addLayoutColumnPortlet(layout, columnId, portletJSONObject); + } + } + + protected void addLayoutColumnPortlet( + Layout layout, String columnId, JSONObject portletJSONObject) + throws Exception { + + LayoutTypePortlet layoutTypePortlet = + (LayoutTypePortlet)layout.getLayoutType(); + + String rootPortletId = portletJSONObject.getString("portletId"); + + if (Validator.isNull(rootPortletId)) { + throw new ImporterException("portletId is not specified"); + } + + String portletId = layoutTypePortlet.addPortletId( + userId, rootPortletId, columnId, -1, false); + + if (portletId == null) { + return; + } + + JSONObject portletPreferencesJSONObject = + portletJSONObject.getJSONObject("portletPreferences"); + + if ((portletPreferencesJSONObject == null) || + (portletPreferencesJSONObject.length() == 0)) { + + return; + } + + PortletPreferences portletSetup = + PortletPreferencesFactoryUtil.getLayoutPortletSetup( + layout, portletId); + + Iterator iterator = portletPreferencesJSONObject.keys(); + + while (iterator.hasNext()) { + String key = iterator.next(); + + String value = portletPreferencesJSONObject.getString(key); + + if (rootPortletId.equals(PortletKeys.JOURNAL_CONTENT) && + key.equals("articleId")) { + + value = getJournalId(value); + } + + portletSetup.setValue(key, value); + } + + portletSetup.store(); + + if (rootPortletId.equals(PortletKeys.NESTED_PORTLETS)) { + JSONArray columnsJSONArray = + portletPreferencesJSONObject.getJSONArray("columns"); + + StringBundler sb = new StringBundler(4); + + sb.append(StringPool.UNDERLINE); + sb.append(portletId); + sb.append(StringPool.DOUBLE_UNDERLINE); + sb.append(LayoutTypePortletConstants.COLUMN_PREFIX); + + addLayoutColumns(layout, sb.toString(), columnsJSONArray); + } + } + + protected void addLayoutColumns( + Layout layout, String columnPrefix, JSONArray columnsJSONArray) + throws Exception { + + if (columnsJSONArray == null) { + return; + } + + for (int i = 0; i < columnsJSONArray.length(); i++) { + JSONArray columnJSONArray = columnsJSONArray.getJSONArray(i); + + addLayoutColumn(layout, columnPrefix + (i + 1), columnJSONArray); + } + } + + protected void addLayoutPrototype(InputStream inputStream) + throws Exception { + + String content = StringUtil.read(inputStream); + + if (Validator.isNull(content)) { + return; + } + + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(content); + + JSONObject layoutTemplateJSONObject = jsonObject.getJSONObject( + "layoutTemplate"); + + Map nameMap = getMap( + layoutTemplateJSONObject.getString("name")); + + String name = nameMap.get(Locale.getDefault()); + + Map descriptionMap = getMap( + layoutTemplateJSONObject, "description"); + + String uuid = layoutTemplateJSONObject.getString("uuid"); + + LayoutPrototype layoutPrototype = getLayoutPrototype(companyId, name); + + if (layoutPrototype != null) { + if (!developerModeEnabled) { + if (_log.isInfoEnabled()) { + _log.info( + "Layout prototype with name " + name + + " already exists for company " + companyId); + } + + return; + } + + if (!updateModeEnabled) { + LayoutPrototypeLocalServiceUtil.deleteLayoutPrototype( + layoutPrototype); + } + } + + ServiceContext serviceContext = new ServiceContext(); + + serviceContext.setCompanyId(companyId); + serviceContext.setUserId(userId); + + if (Validator.isNotNull(uuid)) { + serviceContext.setUuid(uuid); + } + + try { + if (!updateModeEnabled || (layoutPrototype == null)) { + layoutPrototype = + LayoutPrototypeLocalServiceUtil.addLayoutPrototype( + userId, companyId, getMap(name), + descriptionMap.get(LocaleUtil.getDefault()), true, + serviceContext); + } + else { + layoutPrototype = + LayoutPrototypeLocalServiceUtil.updateLayoutPrototype( + layoutPrototype.getLayoutPrototypeId(), getMap(name), + descriptionMap.get(LocaleUtil.getDefault()), + layoutPrototype.isActive(), serviceContext); + } + } + catch (Exception e) { + if (_log.isWarnEnabled()) { + _log.warn("Unable to import layout prototype " + name, e); + } + + throw e; + } + + JSONArray columnsJSONArray = layoutTemplateJSONObject.getJSONArray( + "columns"); + + Layout layout = layoutPrototype.getLayout(); + + addLayoutColumns( + layout, LayoutTypePortletConstants.COLUMN_PREFIX, columnsJSONArray); + + LayoutLocalServiceUtil.updateLayout( + layout.getGroupId(), layout.isPrivateLayout(), layout.getLayoutId(), + layout.getTypeSettings()); + } + + protected void addLayoutPrototype(String dirName) throws Exception { + File layoutTemplatesDir = new File(_resourcesDir, dirName); + + if (!layoutTemplatesDir.isDirectory() || + !layoutTemplatesDir.canRead()) { + + return; + } + + File[] files = listFiles(layoutTemplatesDir); + + for (File file : files) { + addLayoutPrototype(getInputStream(file)); + } + } + + protected void addLayouts( + boolean privateLayout, long parentLayoutId, + JSONArray layoutsJSONArray) + throws Exception { + + if (layoutsJSONArray == null) { + return; + } + + for (int i = 0; i < layoutsJSONArray.length(); i++) { + JSONObject layoutJSONObject = layoutsJSONArray.getJSONObject(i); + + addLayout(privateLayout, parentLayoutId, layoutJSONObject); + } + } + + protected void addPrimaryKey(String className, long primaryKey) { + Set primaryKeys = _primaryKeys.get(className); + + if (primaryKeys == null) { + primaryKeys = new HashSet(); + + _primaryKeys.put(className, primaryKeys); + } + + primaryKeys.add(primaryKey); + } + + protected void doImportResources() throws Exception { + serviceContext = new ServiceContext(); + + serviceContext.setAddGroupPermissions(true); + serviceContext.setAddGuestPermissions(true); + serviceContext.setScopeGroupId(groupId); + + boolean indexReadOnly = SearchEngineUtil.isIndexReadOnly(); + + boolean layoutImportInProcess = + ExportImportThreadLocal.isLayoutImportInProcess(); + boolean portletImportInProcess = + ExportImportThreadLocal.isPortletImportInProcess(); + + try { + SearchEngineUtil.setIndexReadOnly(true); + + setUpAssets("assets.json"); + setUpSettings("settings.json"); + setUpSitemap("sitemap.json"); + + SearchEngineUtil.setIndexReadOnly(false); + + ExportImportThreadLocal.setLayoutImportInProcess(false); + ExportImportThreadLocal.setPortletImportInProcess(false); + + long startTime = System.currentTimeMillis(); + + if (_log.isDebugEnabled()) { + _log.debug("Commence indexing"); + } + + index(); + + if (_log.isDebugEnabled()) { + _log.debug( + "Indexing completed in " + + (System.currentTimeMillis() - startTime) + "ms"); + } + } + finally { + SearchEngineUtil.setIndexReadOnly(indexReadOnly); + + ExportImportThreadLocal.setLayoutImportInProcess( + layoutImportInProcess); + ExportImportThreadLocal.setPortletImportInProcess( + portletImportInProcess); + } + } + + protected String getDDMTemplateLanguage(String fileName) { + String extension = FileUtil.getExtension(fileName); + + if (extension.equals(TemplateConstants.LANG_TYPE_CSS) || + extension.equals(TemplateConstants.LANG_TYPE_FTL) || + extension.equals(TemplateConstants.LANG_TYPE_VM) || + extension.equals(TemplateConstants.LANG_TYPE_XSL)) { + + return extension; + } + + return TemplateConstants.LANG_TYPE_VM; + } + + protected JSONObject getDefaultPortletJSONObject(String journalArticleId) { + JSONObject portletJSONObject = JSONFactoryUtil.createJSONObject(); + + portletJSONObject.put("portletId", PortletKeys.JOURNAL_CONTENT); + + JSONObject portletPreferencesJSONObject = + JSONFactoryUtil.createJSONObject(); + + portletPreferencesJSONObject.put("articleId", journalArticleId); + portletPreferencesJSONObject.put("groupId", groupId); + portletPreferencesJSONObject.put("portletSetupShowBorders", false); + + portletJSONObject.put( + "portletPreferences", portletPreferencesJSONObject); + + return portletJSONObject; + } + + protected InputStream getInputStream(File file) throws Exception { + if (!file.exists() || file.isDirectory() || !file.canRead()) { + return null; + } + + return new BufferedInputStream(new FileInputStream(file)); + } + + protected InputStream getInputStream(String fileName) throws Exception { + File file = new File(_resourcesDir, fileName); + + return getInputStream(file); + } + + protected String getJournalId(String fileName) { + String id = FileUtil.stripExtension(fileName); + + id = StringUtil.toUpperCase(id); + + return StringUtil.replace(id, StringPool.SPACE, StringPool.DASH); + } + + protected String[] getJSONArrayAsStringArray( + JSONObject jsonObject, String key) { + + JSONArray jsonArray = jsonObject.getJSONArray(key); + + if (jsonArray != null) { + return ArrayUtil.toStringArray(jsonArray); + } + + return new String[0]; + } + + protected JSONObject getJSONObject(String fileName) throws Exception { + String json = null; + + InputStream inputStream = getInputStream(fileName); + + if (inputStream == null) { + return null; + } + + try { + json = StringUtil.read(inputStream); + } + finally { + inputStream.close(); + } + + json = StringUtil.replace( + json, new String[] {"${companyId}", "${groupId}", "${userId}"}, + new String[] { + String.valueOf(companyId), String.valueOf(groupId), + String.valueOf(userId) + }); + + return JSONFactoryUtil.createJSONObject(json); + } + + protected String getKey(String name) { + name = StringUtil.replace(name, StringPool.SPACE, StringPool.DASH); + + name = StringUtil.toUpperCase(name); + + if (appendVersion) { + name = name + StringPool.DASH + version; + } + + return name; + } + + protected Map getMap( + JSONObject layoutJSONObject, String name) { + + Map map = new HashMap(); + + JSONObject jsonObject = layoutJSONObject.getJSONObject( + name.concat("Map")); + + if (jsonObject != null) { + map = (Map)LocalizationUtil.deserialize(jsonObject); + + if (!map.containsKey(LocaleUtil.getDefault())) { + Collection values = map.values(); + + Iterator iterator = values.iterator(); + + map.put(LocaleUtil.getDefault(), iterator.next()); + } + } + else { + String value = layoutJSONObject.getString(name); + + map.put(LocaleUtil.getDefault(), value); + } + + return map; + } + + protected Map getMap(Locale locale, String value) { + Map map = new HashMap(); + + map.put(locale, value); + + return map; + } + + protected Map getMap(String value) { + return getMap(LocaleUtil.getDefault(), value); + } + + protected String getName(String name) { + if (!appendVersion) { + return name; + } + + return name + " - " + version; + } + + protected void index() throws Exception { + for (Map.Entry> primaryKeysEntry : + _primaryKeys.entrySet()) { + + String className = primaryKeysEntry.getKey(); + + Set primaryKeys = primaryKeysEntry.getValue(); + + Indexer indexer = IndexerRegistryUtil.getIndexer(className); + + if (indexer == null) { + if (_log.isWarnEnabled()) { + _log.warn( + "No indexer within the IndexerRegistry for: " + + className); + } + + continue; + } + + if (_log.isDebugEnabled()) { + _log.debug("Indexing: " + className); + } + + for (long primaryKey : primaryKeys) { + try { + indexer.reindex(className, primaryKey); + } + catch (SearchException e) { + if (_log.isWarnEnabled()) { + _log.warn( + "Cannot index entry: className=" + className + + ", primaryKey=" + primaryKey, + e); + } + } + } + } + + if (_ddmStructures.isEmpty()) { + return; + } + + Set primaryKeys = _primaryKeys.get( + JournalArticle.class.getName()); + + Indexer indexer = IndexerRegistryUtil.getIndexer( + JournalArticle.class.getName()); + + for (String ddmStructureKey : _ddmStructures) { + List journalArticles = + JournalArticleServiceUtil.getArticlesByStructureId( + getGroupId(), ddmStructureKey, QueryUtil.ALL_POS, + QueryUtil.ALL_POS, null); + + for (JournalArticle journalArticle : journalArticles) { + if ((primaryKeys != null) && + primaryKeys.contains(journalArticle.getPrimaryKey())) { + + continue; + } + + try { + indexer.reindex( + JournalArticle.class.getName(), + journalArticle.getPrimaryKey()); + } + catch (SearchException e) { + if (_log.isWarnEnabled()) { + _log.warn( + "Cannot index entry: className=" + + JournalArticle.class.getName() + + ", primaryKey=" + + journalArticle.getPrimaryKey(), + e); + } + } + } + } + } + + protected boolean isJournalStructureXSD(String xsd) throws Exception { + Document document = SAXReaderUtil.read(xsd); + + Element rootElement = document.getRootElement(); + + Attribute availableLocalesAttribute = rootElement.attribute( + "available-locales"); + + if (availableLocalesAttribute == null) { + return true; + } + + return false; + } + + protected File[] listFiles(File dir) { + File[] files = dir.listFiles(); + + if (files == null) { + return new File[0]; + } + + List filesList = new ArrayList(); + + for (File file : files) { + if (file.isFile()) { + filesList.add(file); + } + } + + return filesList.toArray(new File[filesList.size()]); + } + + protected String processJournalArticleContent(String content) + throws Exception { + + content = replaceFileEntryURL(content); + + if (content.contains(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + + return sb.toString(); + } + + protected String replaceFileEntryURL(String content) throws Exception { + Matcher matcher = _fileEntryPattern.matcher(content); + + while (matcher.find()) { + String fileName = matcher.group(1); + + FileEntry fileEntry = _fileEntries.get(fileName); + + String fileEntryURL = StringPool.BLANK; + + if (fileEntry != null) { + fileEntryURL = DLUtil.getPreviewURL( + fileEntry, fileEntry.getFileVersion(), null, + StringPool.BLANK); + } + + content = matcher.replaceFirst(fileEntryURL); + + matcher.reset(content); + } + + return content; + } + + protected void setServiceContext(String name) { + JSONObject assetJSONObject = _assetJSONObjectMap.get(name); + + String[] assetTagNames = null; + + if (assetJSONObject != null) { + assetTagNames = getJSONArrayAsStringArray(assetJSONObject, "tags"); + } + + serviceContext.setAssetTagNames(assetTagNames); + } + + protected void setUpAssets(JSONArray assetsJSONArray) { + if (assetsJSONArray == null) { + return; + } + + for (int i = 0; i < assetsJSONArray.length(); i++) { + JSONObject assetJSONObject = assetsJSONArray.getJSONObject(i); + + String name = assetJSONObject.getString("name"); + + _assetJSONObjectMap.put(name, assetJSONObject); + } + } + + protected void setUpAssets(String fileName) throws Exception { + if (!updateModeEnabled && !isCompanyGroup()) { + List assetTags = AssetTagLocalServiceUtil.getGroupTags( + groupId); + + for (AssetTag assetTag : assetTags) { + AssetTagLocalServiceUtil.deleteAssetTag(assetTag); + } + + RepositoryLocalServiceUtil.deleteRepositories(groupId); + + JournalArticleLocalServiceUtil.deleteArticles(groupId); + + DDMTemplateLocalServiceUtil.deleteTemplates(groupId); + + DDMStructureLocalServiceUtil.deleteStructures(groupId); + } + + JSONObject jsonObject = getJSONObject(fileName); + + if (jsonObject != null) { + JSONArray assetsJSONArray = jsonObject.getJSONArray("assets"); + + setUpAssets(assetsJSONArray); + } + + addDLFileEntries(_DL_DOCUMENTS_DIR_NAME); + + addApplicationDisplayTemplates(_APPLICATION_DISPLAY_TEMPLATE_DIR_NAME); + + addDDLStructures(_DDL_STRUCTURE_DIR_NAME); + + addDDMStructures(StringPool.BLANK, _JOURNAL_DDM_STRUCTURES_DIR_NAME); + + addDDMTemplates(StringPool.BLANK, _JOURNAL_DDM_TEMPLATES_DIR_NAME); + + addJournalArticles( + StringPool.BLANK, StringPool.BLANK, _JOURNAL_ARTICLES_DIR_NAME); + + addLayoutPrototype(_LAYOUT_PROTOTYPE_DIR_NAME); + } + + protected void setUpSettings(String fileName) throws Exception { + if (targetClassName.equals(Group.class.getName())) { + return; + } + + JSONObject jsonObject = getJSONObject(fileName); + + if (jsonObject == null) { + return; + } + + LayoutSetPrototype layoutSetPrototype = + LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype( + getTargetClassPK()); + + String layoutSetPrototypeSettings = jsonObject.getString( + "layoutSetPrototypeSettings", StringPool.BLANK); + + layoutSetPrototype.setSettings(layoutSetPrototypeSettings); + + LayoutSetPrototypeLocalServiceUtil.updateLayoutSetPrototype( + layoutSetPrototype); + } + + protected void setUpSitemap(String fileName) throws Exception { + if (!updateModeEnabled) { + LayoutLocalServiceUtil.deleteLayouts( + groupId, true, new ServiceContext()); + + LayoutLocalServiceUtil.deleteLayouts( + groupId, false, new ServiceContext()); + } + + JSONObject jsonObject = getJSONObject(fileName); + + if (jsonObject == null) { + return; + } + + _defaultLayoutTemplateId = jsonObject.getString( + "layoutTemplateId", StringPool.BLANK); + + updateLayoutSetThemeId(jsonObject); + + JSONArray layoutsJSONArray = jsonObject.getJSONArray("layouts"); + + if (layoutsJSONArray != null) { + addLayouts( + false, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, + layoutsJSONArray); + } + else { + JSONArray publicPagesJSONArray = jsonObject.getJSONArray( + "publicPages"); + + if (publicPagesJSONArray != null) { + addLayouts( + false, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, + publicPagesJSONArray); + } + + JSONArray privatePagesJSONArray = jsonObject.getJSONArray( + "privatePages"); + + if (privatePagesJSONArray != null) { + addLayouts( + true, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, + privatePagesJSONArray); + } + } + } + + protected void updateLayoutSetThemeId(JSONObject sitemapJSONObject) + throws Exception { + + String themeId = sitemapJSONObject.getString("themeId"); + + if (Validator.isNotNull(themeId)) { + Theme theme = ThemeLocalServiceUtil.fetchTheme(companyId, themeId); + + if (theme == null) { + themeId = null; + } + } + + if (Validator.isNull(themeId)) { + int pos = servletContextName.indexOf("-theme"); + + if (pos != -1) { + themeId = + servletContextName.substring(0, pos) + + PortletConstants.WAR_SEPARATOR + servletContextName; + + themeId = PortalUtil.getJsSafePortletId(themeId); + + Theme theme = ThemeLocalServiceUtil.fetchTheme( + companyId, themeId); + + if (theme == null) { + themeId = null; + } + } + } + + if (Validator.isNotNull(themeId)) { + LayoutSetLocalServiceUtil.updateLookAndFeel( + groupId, themeId, null, null, false); + } + } + + protected ServiceContext serviceContext; + + private static final String _APPLICATION_DISPLAY_TEMPLATE_DIR_NAME = + "/templates/application_display"; + + private static final Object[][] _APPLICATION_DISPLAY_TEMPLATE_TYPES = + new Object[][] { + {"asset_category", AssetCategory.class}, + {"asset_entry", AssetEntry.class}, {"asset_tag", AssetTag.class}, + {"blogs_entry", BlogsEntry.class}, + {"document_library",FileEntry.class}, {"site_map", LayoutSet.class}, + {"wiki_page", WikiPage.class} + }; + + private static final String _DDL_STRUCTURE_DIR_NAME = + "/templates/dynamic_data_list/structure"; + + private static final String _DDL_STRUCTURE_DISPLAY_TEMPLATE_DIR_NAME = + "/templates/dynamic_data_list/display_template"; + + private static final String _DDL_STRUCTURE_FORM_TEMPLATE_DIR_NAME = + "/templates/dynamic_data_list/form_template"; + + private static final String _DL_DOCUMENTS_DIR_NAME = + "/document_library/documents/"; + + private static final String _JOURNAL_ARTICLES_DIR_NAME = + "/journal/articles/"; + + private static final String _JOURNAL_DDM_STRUCTURES_DIR_NAME = + "/journal/structures/"; + + private static final String _JOURNAL_DDM_TEMPLATES_DIR_NAME = + "/journal/templates/"; + + private static final String _LAYOUT_PROTOTYPE_DIR_NAME = "/templates/page"; + + private static Log _log = LogFactoryUtil.getLog(FileSystemImporter.class); + + private Map _assetJSONObjectMap = + new HashMap(); + private Set _ddmStructures = new HashSet(); + private String _defaultLayoutTemplateId; + private Map _fileEntries = + new HashMap(); + private Pattern _fileEntryPattern = Pattern.compile( + "\\[\\$FILE=([^\\$]+)\\$\\]"); + private Map> _primaryKeys = + new HashMap>(); + private File _resourcesDir; + +} \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/Importer.java b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/Importer.java new file mode 100644 index 0000000..8719c3c --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/Importer.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.resourcesimporter.util; + +import javax.servlet.ServletContext; + +/** + * @author Brian Wing Shun Chan + * @author Raymond Augé + */ +public interface Importer { + + public void afterPropertiesSet() throws Exception; + + public long getGroupId(); + + public String getTargetClassName(); + + public long getTargetClassPK(); + + public void importResources() throws Exception; + + public boolean isCompanyGroup() throws Exception; + + public boolean isDeveloperModeEnabled(); + + public boolean isExisting(); + + public void setAppendVersion(boolean appendVersion); + + public void setCompanyId(long companyId); + + public void setDeveloperModeEnabled(boolean developerModeEnabled); + + public void setGroupId(long groupId); + + public void setResourcesDir(String resourcesDir); + + public void setServletContext(ServletContext servletContext); + + public void setServletContextName(String servletContextName); + + public void setTargetClassName(String className); + + public void setTargetValue(String targetValue); + + public void setUpdateModeEnabled(boolean updateModeEnabled); + + public void setVersion(String version); + +} \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/ImporterException.java b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/ImporterException.java new file mode 100644 index 0000000..ba2bd25 --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/ImporterException.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.resourcesimporter.util; + +import com.liferay.portal.kernel.exception.PortalException; + +/** + * @author Brian Wing Shun Chan + */ +public class ImporterException extends PortalException { + + public ImporterException() { + super(); + } + + public ImporterException(String msg) { + super(msg); + } + + public ImporterException(String msg, Throwable cause) { + super(msg, cause); + } + + public ImporterException(Throwable cause) { + super(cause); + } + +} \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/ImporterFactory.java b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/ImporterFactory.java new file mode 100644 index 0000000..f0d0511 --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/ImporterFactory.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.resourcesimporter.util; + +import com.liferay.portal.kernel.deploy.DeployManagerUtil; +import com.liferay.portal.kernel.plugin.PluginPackage; +import com.liferay.portal.kernel.util.TextFormatter; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.model.Group; +import com.liferay.portal.service.GroupLocalServiceUtil; + +import java.net.URL; +import java.net.URLConnection; + +import java.util.Set; + +import javax.servlet.ServletContext; + +/** + * @author Michael C. Han + */ +public class ImporterFactory { + + public static final String RESOURCES_DIR = + "/WEB-INF/classes/resources-importer/"; + + public static final String TEMPLATES_DIR = + "/WEB-INF/classes/templates-importer/"; + + public static ImporterFactory getInstance() { + return _instance; + } + + public Importer createImporter( + long companyId, ServletContext servletContext, + PluginPackageProperties pluginPackageProperties) + throws Exception { + + String resourcesDir = pluginPackageProperties.getResourcesDir(); + + Set resourcePaths = servletContext.getResourcePaths( + RESOURCES_DIR); + Set templatePaths = servletContext.getResourcePaths( + TEMPLATES_DIR); + + URL privateLARURL = null; + URL publicLARURL = servletContext.getResource( + RESOURCES_DIR.concat("archive.lar")); + + if (publicLARURL == null) { + privateLARURL = servletContext.getResource( + RESOURCES_DIR.concat("private.lar")); + + publicLARURL = servletContext.getResource( + RESOURCES_DIR.concat("public.lar")); + } + + Importer importer = null; + + if ((privateLARURL != null) || (publicLARURL != null)) { + LARImporter larImporter = getLARImporter(); + + URLConnection privateLARURLConnection = null; + + if (privateLARURL != null) { + privateLARURLConnection = privateLARURL.openConnection(); + + larImporter.setPrivateLARInputStream( + privateLARURLConnection.getInputStream()); + } + + URLConnection publicLARURLConnection = null; + + if (publicLARURL != null) { + publicLARURLConnection = publicLARURL.openConnection(); + + larImporter.setPublicLARInputStream( + publicLARURLConnection.getInputStream()); + } + + importer = larImporter; + } + else if ((resourcePaths != null) && !resourcePaths.isEmpty()) { + importer = getResourceImporter(); + + importer.setResourcesDir(RESOURCES_DIR); + } + else if ((templatePaths != null) && !templatePaths.isEmpty()) { + importer = getResourceImporter(); + + Group group = GroupLocalServiceUtil.getCompanyGroup(companyId); + + importer.setGroupId(group.getGroupId()); + importer.setResourcesDir(TEMPLATES_DIR); + } + else if (Validator.isNotNull(resourcesDir)) { + importer = getFileSystemImporter(); + + importer.setResourcesDir(resourcesDir); + } + + if (importer == null) { + throw new ImporterException("No valid importer found"); + } + + configureImporter( + companyId, importer, servletContext, pluginPackageProperties); + + return importer; + } + + protected void configureImporter( + long companyId, Importer importer, ServletContext servletContext, + PluginPackageProperties pluginPackageProperties) + throws Exception { + + importer.setAppendVersion(pluginPackageProperties.isAppendVersion()); + + importer.setCompanyId(companyId); + + importer.setDeveloperModeEnabled( + pluginPackageProperties.isDeveloperModeEnabled()); + + importer.setServletContext(servletContext); + importer.setServletContextName(servletContext.getServletContextName()); + + importer.setTargetClassName( + pluginPackageProperties.getTargetClassName()); + + String targetValue = pluginPackageProperties.getTargetValue(); + + if (Validator.isNull(targetValue)) { + targetValue = TextFormatter.format( + servletContext.getServletContextName(), TextFormatter.J); + } + + importer.setTargetValue(targetValue); + + importer.setUpdateModeEnabled( + pluginPackageProperties.isUpdateModeEnabled()); + + PluginPackage pluginPackage = + DeployManagerUtil.getInstalledPluginPackage( + servletContext.getServletContextName()); + + importer.setVersion(pluginPackage.getVersion()); + + importer.afterPropertiesSet(); + } + + protected FileSystemImporter getFileSystemImporter() { + return new FileSystemImporter(); + } + + protected LARImporter getLARImporter() { + return new LARImporter(); + } + + protected ResourceImporter getResourceImporter() { + return new ResourceImporter(); + } + + private static ImporterFactory _instance = new ImporterFactory(); + +} \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/LARImporter.java b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/LARImporter.java new file mode 100644 index 0000000..1ec4d2e --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/LARImporter.java @@ -0,0 +1,141 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.resourcesimporter.util; + +import com.liferay.portal.kernel.lar.PortletDataHandlerKeys; +import com.liferay.portal.kernel.lar.UserIdStrategy; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.service.LayoutLocalServiceUtil; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author Ryan Park + * @author Raymond Augé + */ +public class LARImporter extends BaseImporter { + + + public void importResources() throws Exception { + if (_privateLARInputStream != null) { + LayoutLocalServiceUtil.importLayouts( + userId, groupId, true, getParameterMap(), + _privateLARInputStream); + } + + if (_publicLARInputStream != null) { + LayoutLocalServiceUtil.importLayouts( + userId, groupId, false, getParameterMap(), + _publicLARInputStream); + } + } + + public void setLARFile(File file) { + try { + setPublicLARInputStream( + new BufferedInputStream(new FileInputStream(file))); + } + catch (FileNotFoundException fnfe) { + _log.error(fnfe, fnfe); + } + } + + public void setLARInputStream(InputStream inputStream) { + setPublicLARInputStream(inputStream); + } + + public void setPrivateLARInputStream(InputStream privateLARInputStream) { + _privateLARInputStream = privateLARInputStream; + } + + public void setPublicLARInputStream(InputStream publicLARInputStream) { + _publicLARInputStream = publicLARInputStream; + } + + protected Map getParameterMap() { + Map parameters = new HashMap(); + + parameters.put( + PortletDataHandlerKeys.DELETE_MISSING_LAYOUTS, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.DELETE_PORTLET_DATA, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.LAYOUT_SET_PROTOTYPE_LINK_ENABLED, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.LAYOUT_SET_SETTINGS, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE, + new String[] { + PortletDataHandlerKeys. + LAYOUTS_IMPORT_MODE_MERGE_BY_LAYOUT_UUID + }); + parameters.put( + PortletDataHandlerKeys.LOGO, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.PERMISSIONS, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.PORTLET_ARCHIVED_SETUPS, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.PORTLET_CONFIGURATION, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.PORTLET_CONFIGURATION_ALL, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.PORTLET_DATA, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.PORTLET_DATA_ALL, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.PORTLET_SETUP_ALL, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.PORTLET_USER_PREFERENCES, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.PORTLETS_MERGE_MODE, + new String[] {PortletDataHandlerKeys.PORTLETS_MERGE_MODE_REPLACE}); + parameters.put( + PortletDataHandlerKeys.THEME_REFERENCE, + new String[] {Boolean.TRUE.toString()}); + parameters.put( + PortletDataHandlerKeys.USER_ID_STRATEGY, + new String[] {UserIdStrategy.CURRENT_USER_ID}); + + return parameters; + } + + private static Log _log = LogFactoryUtil.getLog(LARImporter.class); + + private InputStream _privateLARInputStream; + private InputStream _publicLARInputStream; + +} \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/PluginPackageProperties.java b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/PluginPackageProperties.java new file mode 100644 index 0000000..c934c3d --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/PluginPackageProperties.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.resourcesimporter.util; + +import com.liferay.portal.kernel.util.GetterUtil; +import com.liferay.portal.kernel.util.PortalRunMode; +import com.liferay.portal.kernel.util.PropertiesUtil; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.StringUtil; +import com.liferay.portal.model.LayoutSetPrototype; + +import java.io.IOException; +import java.io.InputStream; + +import java.util.Properties; + +import javax.servlet.ServletContext; + +/** + * @author Michael C. Han + */ +public class PluginPackageProperties { + + public PluginPackageProperties(ServletContext servletContext) + throws IOException { + + InputStream inputStream = servletContext.getResourceAsStream( + "/WEB-INF/liferay-plugin-package.properties"); + + if (inputStream == null) { + return; + } + + String propertiesString = StringUtil.read(inputStream); + + String contextPath = servletContext.getRealPath(StringPool.SLASH); + + contextPath = StringUtil.replace( + contextPath, StringPool.BACK_SLASH, StringPool.SLASH); + + propertiesString = propertiesString.replace( + "${context.path}", contextPath); + + PropertiesUtil.load(_properties, propertiesString); + } + + public String getProperty(String key) { + return _properties.getProperty(key); + } + + public String getResourcesDir() { + return _properties.getProperty("resources-importer-external-dir"); + } + + public String getTargetClassName() { + return _properties.getProperty( + "resources-importer-target-class-name", + LayoutSetPrototype.class.getName()); + } + + public String getTargetValue() { + return _properties.getProperty("resources-importer-target-value"); + } + + public boolean isAppendVersion() { + return GetterUtil.getBoolean( + _properties.getProperty("resources-importer-append-version"), true); + } + + public boolean isDeveloperModeEnabled() { + return GetterUtil.getBoolean( + _properties.getProperty( + "resources-importer-developer-mode-enabled")) || + PortalRunMode.isTestMode(); + } + + public boolean isUpdateModeEnabled() { + return GetterUtil.getBoolean( + _properties.getProperty("resources-importer-update-mode-enabled")); + } + + private Properties _properties = new Properties(); + +} \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/ResourceImporter.java b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/ResourceImporter.java new file mode 100644 index 0000000..f602ca5 --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/src/com/liferay/resourcesimporter/util/ResourceImporter.java @@ -0,0 +1,378 @@ +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +package com.liferay.resourcesimporter.util; + +import com.liferay.portal.kernel.util.FileUtil; +import com.liferay.portal.kernel.util.StringBundler; +import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.StringUtil; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.util.PortalUtil; +import com.liferay.portlet.documentlibrary.model.DLFolderConstants; +import com.liferay.portlet.dynamicdatalists.model.DDLRecordSet; +import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; +import com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants; +import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalServiceUtil; + +import java.io.File; +import java.io.InputStream; + +import java.net.URL; +import java.net.URLConnection; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +/** + * @author Raymond Augé + * @author Ryan Park + */ +public class ResourceImporter extends FileSystemImporter { + + + public void importResources() throws Exception { + doImportResources(); + } + + + protected void addApplicationDisplayTemplate( + String parentDirName, String dirName, long classNameId) + throws Exception { + + StringBundler sb = new StringBundler(4); + + sb.append(resourcesDir); + sb.append(parentDirName); + sb.append("/"); + sb.append(dirName); + + Set resourcePaths = servletContext.getResourcePaths( + sb.toString()); + + if (resourcePaths == null) { + return; + } + + for (String resourcePath : resourcePaths) { + URL url = servletContext.getResource(resourcePath); + + URLConnection urlConnection = url.openConnection(); + + String script = StringUtil.read(urlConnection.getInputStream()); + + if (Validator.isNull(script)) { + continue; + } + + File file = new File(resourcePath); + + addApplicationDisplayTemplate(script, file, classNameId); + } + } + + + protected void addDDLDisplayTemplates( + String ddmStructureKey, String dirName, String fileName) + throws Exception { + + DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure( + groupId, PortalUtil.getClassNameId(DDLRecordSet.class), + ddmStructureKey); + + StringBundler sb = new StringBundler(4); + + sb.append(resourcesDir); + sb.append(dirName); + sb.append(StringPool.SLASH); + sb.append(fileName); + + Set resourcePaths = servletContext.getResourcePaths( + sb.toString()); + + if (resourcePaths == null) { + return; + } + + for (String resourcePath : resourcePaths) { + URL url = servletContext.getResource(resourcePath); + + URLConnection urlConnection = url.openConnection(); + + String script = StringUtil.read(urlConnection.getInputStream()); + + if (Validator.isNull(script)) { + return; + } + + addDDMTemplate( + groupId, ddmStructure.getStructureId(), resourcePath, + getDDMTemplateLanguage(resourcePath), script, + DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, StringPool.BLANK); + } + } + + + protected void addDDLFormTemplates( + String ddmStructureKey, String dirName, String fileName) + throws Exception { + + DDMStructure ddmStructure = DDMStructureLocalServiceUtil.getStructure( + groupId, PortalUtil.getClassNameId(DDLRecordSet.class), + ddmStructureKey); + + StringBundler sb = new StringBundler(4); + + sb.append(resourcesDir); + sb.append(dirName); + sb.append(StringPool.SLASH); + sb.append(fileName); + + Set resourcePaths = servletContext.getResourcePaths( + sb.toString()); + + if (resourcePaths == null) { + return; + } + + for (String resourcePath : resourcePaths) { + URL url = servletContext.getResource(resourcePath); + + URLConnection urlConnection = url.openConnection(); + + String script = StringUtil.read(urlConnection.getInputStream()); + + if (Validator.isNull(script)) { + return; + } + + addDDMTemplate( + groupId, ddmStructure.getStructureId(), resourcePath, "xsd", + script, DDMTemplateConstants.TEMPLATE_TYPE_FORM, + DDMTemplateConstants.TEMPLATE_MODE_CREATE); + } + } + + + protected void addDDLStructures(String dirName) throws Exception { + Set resourcePaths = servletContext.getResourcePaths( + resourcesDir.concat(dirName)); + + if (resourcePaths == null) { + return; + } + + for (String resourcePath : resourcePaths) { + File file = new File(resourcePath); + + URL url = servletContext.getResource(resourcePath); + + URLConnection urlConnection = url.openConnection(); + + addDDMStructures( + FileUtil.stripExtension(file.getName()), + urlConnection.getInputStream()); + } + } + + + protected void addDDMStructures(String parentStructureId, String dirName) + throws Exception { + + Set resourcePaths = servletContext.getResourcePaths( + resourcesDir.concat(dirName)); + + if (resourcePaths == null) { + return; + } + + for (String resourcePath : resourcePaths) { + if (resourcePath.endsWith(StringPool.SLASH)) { + continue; + } + + String name = FileUtil.getShortFileName(resourcePath); + + URL url = servletContext.getResource(resourcePath); + + URLConnection urlConnection = url.openConnection(); + + addDDMStructures( + parentStructureId, name, urlConnection.getInputStream()); + } + } + + + protected void addDDMTemplates(String ddmStructureKey, String dirName) + throws Exception { + + Set resourcePaths = servletContext.getResourcePaths( + resourcesDir.concat(dirName)); + + if (resourcePaths == null) { + return; + } + + for (String resourcePath : resourcePaths) { + if (resourcePath.endsWith(StringPool.SLASH)) { + continue; + } + + String name = FileUtil.getShortFileName(resourcePath); + + URL url = servletContext.getResource(resourcePath); + + URLConnection urlConnection = url.openConnection(); + + addDDMTemplates( + ddmStructureKey, name, urlConnection.getInputStream()); + } + } + + + protected void addDLFileEntries(String dirName) throws Exception { + Set resourcePaths = servletContext.getResourcePaths( + resourcesDir.concat(dirName)); + + if (resourcePaths == null) { + return; + } + + for (String resourcePath : resourcePaths) { + if (resourcePath.endsWith(StringPool.SLASH)) { + addDLFolder( + DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, resourcePath); + } + else { + addDLFileEntry(resourcePath); + } + } + } + + protected void addDLFileEntry(String resourcePath) throws Exception { + Long parentFolderId = _folderIds.get( + FileUtil.getPath(resourcePath) + StringPool.SLASH); + + if (parentFolderId == null) { + parentFolderId = 0L; + } + + URL url = servletContext.getResource(resourcePath); + + URLConnection urlConnection = url.openConnection(); + + addDLFileEntry( + parentFolderId, FileUtil.getShortFileName(resourcePath), + urlConnection.getInputStream(), urlConnection.getContentLength()); + } + + + protected long addDLFolder(long parentFolderId, String resourcePath) + throws Exception { + + long folderId = super.addDLFolder( + parentFolderId, + FileUtil.getShortFileName(FileUtil.getPath(resourcePath))); + + _folderIds.put(resourcePath, folderId); + + Set resourcePaths = servletContext.getResourcePaths( + resourcePath); + + if ((resourcePaths == null) || resourcePaths.isEmpty()) { + return folderId; + } + + for (String curResourcePath : resourcePaths) { + if (curResourcePath.endsWith(StringPool.SLASH)) { + addDLFolder(folderId, curResourcePath); + } + else { + addDLFileEntry(curResourcePath); + } + } + + return folderId; + } + + + protected void addJournalArticles( + String ddmStructureKey, String ddmTemplateKey, String dirName) + throws Exception { + + Set resourcePaths = servletContext.getResourcePaths( + resourcesDir.concat(dirName)); + + if (resourcePaths == null) { + return; + } + + for (String resourcePath : resourcePaths) { + if (resourcePath.endsWith(StringPool.SLASH)) { + continue; + } + + String name = FileUtil.getShortFileName(resourcePath); + + URL url = servletContext.getResource(resourcePath); + + URLConnection urlConnection = url.openConnection(); + + addJournalArticles( + ddmStructureKey, ddmTemplateKey, name, + urlConnection.getInputStream()); + } + } + + + protected void addLayoutPrototype(String dirName) throws Exception { + Set resourcePaths = servletContext.getResourcePaths( + resourcesDir.concat(dirName)); + + if (resourcePaths == null) { + return; + } + + for (String resourcePath : resourcePaths) { + String extension = FileUtil.getExtension(resourcePath); + + if (!extension.equals("json")) { + return; + } + + URL url = servletContext.getResource(resourcePath); + + URLConnection urlConnection = url.openConnection(); + + addLayoutPrototype(urlConnection.getInputStream()); + } + } + + + protected InputStream getInputStream(String fileName) throws Exception { + URL url = servletContext.getResource(resourcesDir.concat(fileName)); + + if (url == null) { + return null; + } + + URLConnection urlConnection = url.openConnection(); + + return urlConnection.getInputStream(); + } + + private Map _folderIds = new HashMap(); + +} \ No newline at end of file diff --git a/webs/resources-importer-web/docroot/WEB-INF/web.xml b/webs/resources-importer-web/docroot/WEB-INF/web.xml new file mode 100644 index 0000000..d8dae2a --- /dev/null +++ b/webs/resources-importer-web/docroot/WEB-INF/web.xml @@ -0,0 +1,8 @@ + + + + + portalContextConfigLocation + /WEB-INF/classes/META-INF/messaging-spring.xml + + \ No newline at end of file