Sfoglia il codice sorgente

Fake booleans

master
Salvatore La Manna 4 anni fa
parent
commit
e571fc986e
  1. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties
  2. 1
      liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/.gitignore
  3. BIN
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/commons-collections.jar
  4. BIN
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/commons-io.jar
  5. BIN
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/commons-lang.jar
  6. BIN
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/commons-logging.jar
  7. BIN
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/javassist.jar
  8. BIN
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/jstl-api.jar
  9. BIN
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/jstl-impl.jar
  10. BIN
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/log4j.jar
  11. BIN
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/util-bridges.jar
  12. BIN
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/util-taglib.jar
  13. 572
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/tld/c.tld
  14. 1
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Parameters.java
  15. 26
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Response.java
  16. 16
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Status.java
  17. 6
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Application.java
  18. 26
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/ApplicationType.java
  19. 15
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Field.java
  20. 8
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/ListItem.java
  21. 24
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Value.java
  22. 9
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/Command.java
  23. 9
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/CommandList.java
  24. 15
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/AddApplication.java
  25. 13
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/DeleteApplication.java
  26. 3
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetApplications.java
  27. 10
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListApplications.java
  28. 10
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListDocuments.java
  29. 56
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListFields.java
  30. 14
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListUses.java
  31. 55
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListValues.java
  32. 7
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Login.java
  33. 41
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Manual.java
  34. 193
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ManualHtml.java
  35. 3
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Nop.java
  36. 46
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/SetFields.java
  37. 103
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/SetUse.java
  38. 3
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/util/ApiUtil.java
  39. 175
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/util/DettPraticaUtil.java
  40. 55
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/css/api/v1/api.css
  41. 4
      liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/service.properties

4
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
## ##
build.namespace=portos_bo build.namespace=portos_bo
build.number=3203 build.number=3204
build.date=1624539251511 build.date=1624550365014
build.auto.upgrade=true build.auto.upgrade=true
## ##

1
liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/.gitignore vendored

@ -0,0 +1 @@
/classes/

BIN
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/commons-collections.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/commons-io.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/commons-lang.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/commons-logging.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/javassist.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/jstl-api.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/jstl-impl.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/log4j.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/util-bridges.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/lib/util-taglib.jar

File binario non mostrato.

572
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/tld/c.tld

@ -0,0 +1,572 @@
<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">
<description>JSTL 1.2 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.2</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri>
<validator>
<description>
Provides core validation features for JSTL tags.
</description>
<validator-class>
org.apache.taglibs.standard.tlv.JstlCoreTLV
</validator-class>
</validator>
<tag>
<description>
Catches any Throwable that occurs in its body and optionally
exposes it.
</description>
<name>catch</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
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.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Simple conditional tag that establishes a context for
mutually exclusive conditional operations, marked by
&lt;when&gt; and &lt;otherwise&gt;
</description>
<name>choose</name>
<tag-class>com.liferay.taglib.core.ChooseTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<description>
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
</description>
<name>if</name>
<tag-class>com.liferay.taglib.core.IfTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The test condition that determines whether or
not the body content should be processed.
</description>
<name>test</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resulting value of the test condition. The type
of the scoped variable is Boolean.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Retrieves an absolute or relative URL and exposes its contents
to either the page, a String in 'var', or a Reader in 'varReader'.
</description>
<name>import</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
<description>
The URL of the resource to import.
</description>
<name>url</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resource's content. The type of the scoped
variable is String.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resource's content. The type of the scoped
variable is Reader.
</description>
<name>varReader</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when accessing a relative
URL resource that belongs to a foreign
context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Character encoding of the content at the input
resource.
</description>
<name>charEncoding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
The basic iteration tag, accepting many different
collection types and supporting subsetting and other
functionality
</description>
<name>forEach</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
<description>
Collection of items to iterate over.
</description>
<name>items</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
<deferred-value>
<type>java.lang.Object</type>
</deferred-value>
</attribute>
<attribute>
<description>
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.
</description>
<name>begin</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
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.
</description>
<name>end</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration will only process every step items of
the collection, starting with the first one.
</description>
<name>step</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
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.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
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.
</description>
<name>varStatus</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Iterates over tokens, separated by the supplied delimeters
</description>
<name>forTokens</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
String of tokens to iterate over.
</description>
<name>items</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
<deferred-value>
<type>java.lang.String</type>
</deferred-value>
</attribute>
<attribute>
<description>
The set of delimiters (the characters that
separate the tokens in the string).
</description>
<name>delims</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
Iteration begins at the token located at the
specified index. First token has index 0.
</description>
<name>begin</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration ends at the token located at the
specified index (inclusive).
</description>
<name>end</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration will only process every step tokens
of the string, starting with the first one.
</description>
<name>step</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
current item of the iteration. This scoped
variable has nested visibility.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
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.
</description>
<name>varStatus</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Like &lt;%= ... &gt;, but for expressions.
</description>
<name>out</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Expression to be evaluated.
</description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Default value if the resulting value is null.
</description>
<name>default</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Determines whether characters &lt;,&gt;,&amp;,'," in the
resulting string should be converted to their
corresponding character entity codes. Default value is
true.
</description>
<name>escapeXml</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
and runs only if all of the prior conditions evaluated to
'false'
</description>
<name>otherwise</name>
<tag-class>com.liferay.taglib.core.OtherwiseTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<description>
Adds a parameter to a containing 'import' tag's URL.
</description>
<name>param</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the query string parameter.
</description>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Value of the parameter.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Redirects to a new URL.
</description>
<name>redirect</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The URL of the resource to redirect to.
</description>
<name>url</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when redirecting to a relative URL
resource that belongs to a foreign context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Removes a scoped variable (from a particular scope, if specified).
</description>
<name>remove</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
<body-content>empty</body-content>
<attribute>
<description>
Name of the scoped variable to be removed.
</description>
<name>var</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Sets the result of an expression evaluation in a 'scope'
</description>
<name>set</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
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.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Expression to be evaluated.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<deferred-value>
<type>java.lang.Object</type>
</deferred-value>
</attribute>
<attribute>
<description>
Target object whose property will be set. Must evaluate to
a JavaBeans object with setter property property, or to a
java.util.Map object.
</description>
<name>target</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the property to be set in the target object.
</description>
<name>property</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Creates a URL with optional query parameters.
</description>
<name>url</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable for the
processed url. The type of the scoped variable is
String.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
URL to be processed.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when specifying a relative URL
resource that belongs to a foreign context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Subtag of &lt;choose&gt; that includes its body if its
condition evalutes to 'true'
</description>
<name>when</name>
<tag-class>com.liferay.taglib.core.WhenTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The test condition that determines whether or not the
body content should be processed.
</description>
<name>test</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
</tag>
</taglib>

1
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Parameters.java

@ -13,6 +13,7 @@ public class Parameters {
public static final String FIRST_NAME = "firstName"; public static final String FIRST_NAME = "firstName";
public static final String LAST_NAME = "lastName"; public static final String LAST_NAME = "lastName";
public static final String NAME = "name"; public static final String NAME = "name";
public static final String NULLABLE = "nullable";
public static final String PASSWORD = "password"; public static final String PASSWORD = "password";
public static final String STATUS_CODE = "statusCode"; public static final String STATUS_CODE = "statusCode";
public static final String STATUS_MESSAGE = "statusMessage"; public static final String STATUS_MESSAGE = "statusMessage";

26
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Response.java

@ -6,17 +6,21 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONSerializer; import com.liferay.portal.kernel.json.JSONSerializer;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
public class Response { public class Response {
private static final JSONSerializer serializer = JSONFactoryUtil.createJSONSerializer().exclude("*.class"); private static final JSONSerializer serializer = JSONFactoryUtil.createJSONSerializer().exclude("*.class");
public static String get(int statusCode, Map<String, Serializable> extraData, List<String> additionalInfo) { public static void write(HttpServletResponse response, int statusCode, Map<String, Serializable> extraData,
List<String> additionalInfo) throws IOException {
Map<String, Serializable> map = new LinkedHashMap<>(); Map<String, Serializable> map = new LinkedHashMap<>();
map.put(Parameters.STATUS_CODE, statusCode); map.put(Parameters.STATUS_CODE, statusCode);
@ -24,21 +28,25 @@ public class Response {
if (null != extraData) { if (null != extraData) {
map.putAll(extraData); map.putAll(extraData);
} }
if (null != additionalInfo) { if ((null != additionalInfo) && !additionalInfo.isEmpty()) {
map.put(Parameters.ADDITIONAL_INFO, StringUtils.join(additionalInfo, StringPool.NEW_LINE)); map.put(Parameters.ADDITIONAL_INFO, StringUtils.join(additionalInfo, StringPool.NEW_LINE));
} }
return serializer.serializeDeep(map); ServletResponseUtil.write(response, serializer.serializeDeep(map));
} }
public static String get(int statusCode) throws IOException { public static void write(HttpServletResponse response, int statusCode) throws IOException {
return get(statusCode, null, null); write(response, statusCode, null, null);
} }
public static String get(int statusCode, Map<String, Serializable> extraData) { public static void write(HttpServletResponse response, int statusCode, Map<String, Serializable> extraData)
return get(statusCode, extraData, null); throws IOException {
write(response, statusCode, extraData, null);
} }
public static String get(int statusCode, List<String> additionalInfo) { public static void write(HttpServletResponse response, int statusCode, List<String> additionalInfo)
return get(statusCode, null, additionalInfo); throws IOException {
write(response, statusCode, null, additionalInfo);
} }
} }

16
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Status.java

@ -6,18 +6,20 @@ import java.util.Map;
public class Status { public class Status {
public static final int OK = 0; public static final int OK = 0;
public static final int EXPIRED_TOKEN = 1; public static final int ACCESS_DENIED = 1;
public static final int INACTIVE_USER = 2; public static final int EXPIRED_TOKEN = 2;
public static final int INVALID_INPUT = 3; public static final int INACTIVE_USER = 3;
public static final int INVALID_TOKEN = 4; public static final int INVALID_INPUT = 4;
public static final int MALFORMED_REQUEST = 5; public static final int INVALID_TOKEN = 5;
public static final int SERVER_ERROR = 6; public static final int MALFORMED_REQUEST = 6;
public static final int WRONG_USERNAME_OR_PASSWORD = 7; public static final int SERVER_ERROR = 7;
public static final int WRONG_USERNAME_OR_PASSWORD = 8;
@SuppressWarnings("serial") @SuppressWarnings("serial")
private static final Map<Integer, String> messages = new HashMap<Integer, String>() { private static final Map<Integer, String> messages = new HashMap<Integer, String>() {
{ {
put(OK, "OK"); put(OK, "OK");
put(ACCESS_DENIED, "Accesso negato");
put(EXPIRED_TOKEN, "Questo token è scaduto"); put(EXPIRED_TOKEN, "Questo token è scaduto");
put(INACTIVE_USER, "L'utente non è attivo"); put(INACTIVE_USER, "L'utente non è attivo");
put(INVALID_INPUT, "Dati forniti non validi"); put(INVALID_INPUT, "Dati forniti non validi");

6
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Application.java

@ -5,9 +5,9 @@ import java.io.Serializable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class Application implements Serializable { public class Application implements Serializable {
private long applicationId; private final long applicationId;
private String code; private final String code;
private String vatId; private final String vatId;
public Application(long applicationId, String code, String vatId) { public Application(long applicationId, String code, String vatId) {

26
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/ApplicationType.java

@ -1,26 +0,0 @@
package it.mwg.sicilia.sue.api.v1.bean;
import java.io.Serializable;
@SuppressWarnings("serial")
public class ApplicationType implements Serializable {
private String code;
private String description;
public ApplicationType(String code, String description) {
this.code = code;
this.description = description;
}
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
}

15
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Field.java

@ -2,17 +2,19 @@ package it.mwg.sicilia.sue.api.v1.bean;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter; import it.mwg.sicilia.sue.api.v1.parameter.Parameter;
public class Field { public class Field implements Comparable<Field> {
private final String name; private final String name;
private final String description; private final String description;
private final Parameter.TYPES type; private final Parameter.TYPES type;
private final boolean nullable;
public Field(String name, String description, Parameter.TYPES type) { public Field(String name, String description, Parameter.TYPES type, boolean nullable) {
this.name = name; this.name = name;
this.description = description; this.description = description;
this.type = type; this.type = type;
this.nullable = nullable;
} }
public String getName() { public String getName() {
@ -26,4 +28,13 @@ public class Field {
public Parameter.TYPES getType() { public Parameter.TYPES getType() {
return type; return type;
} }
@Override
public int compareTo(Field o) {
return this.name.compareTo(o.getName());
}
public boolean isNullable() {
return nullable;
}
} }

8
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/ListElement.java → liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/ListItem.java

@ -3,12 +3,12 @@ package it.mwg.sicilia.sue.api.v1.bean;
import java.io.Serializable; import java.io.Serializable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ListElement implements Serializable { public class ListItem implements Serializable {
private String code; private final String code;
private String description; private final String description;
public ListElement(String code, String description) { public ListItem(String code, String description) {
this.code = code; this.code = code;
this.description = description; this.description = description;

24
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Value.java

@ -0,0 +1,24 @@
package it.mwg.sicilia.sue.api.v1.bean;
import java.io.Serializable;
@SuppressWarnings("serial")
public class Value implements Serializable {
private final Serializable value;
private final String description;
public Value(Serializable value, String description) {
this.value = value;
this.description = description;
}
public Serializable getValue() {
return value;
}
public String getDescription() {
return description;
}
}

9
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/Command.java

@ -29,7 +29,6 @@ import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.servlet.HttpMethods; import com.liferay.portal.kernel.servlet.HttpMethods;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.util.ContentTypes; import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
@ -143,13 +142,13 @@ public abstract class Command {
accessToken = new AccessToken(token); accessToken = new AccessToken(token);
sportello = SportelloLocalServiceUtil.getSportello(accessToken.getSportelloId()); sportello = SportelloLocalServiceUtil.getSportello(accessToken.getSportelloId());
} catch (InvalidTokenException e) { } catch (InvalidTokenException e) {
ServletResponseUtil.write(response, Response.get(Status.INVALID_TOKEN)); Response.write(response, Status.INVALID_TOKEN);
} catch (ExpiredTokenException e) { } catch (ExpiredTokenException e) {
ServletResponseUtil.write(response, Response.get(Status.EXPIRED_TOKEN)); Response.write(response, Status.EXPIRED_TOKEN);
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
ServletResponseUtil.write(response, Response.get(Status.INACTIVE_USER)); Response.write(response, Status.INACTIVE_USER);
} catch (Exception e) { } catch (Exception e) {
ServletResponseUtil.write(response, Response.get(Status.SERVER_ERROR)); Response.write(response, Status.SERVER_ERROR);
} }
return true; return true;
} catch (IOException e) { } catch (IOException e) {

9
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/CommandList.java

@ -6,13 +6,12 @@ import it.mwg.sicilia.sue.api.v1.command.impl.GetApplications;
import it.mwg.sicilia.sue.api.v1.command.impl.ListApplications; import it.mwg.sicilia.sue.api.v1.command.impl.ListApplications;
import it.mwg.sicilia.sue.api.v1.command.impl.ListDocuments; import it.mwg.sicilia.sue.api.v1.command.impl.ListDocuments;
import it.mwg.sicilia.sue.api.v1.command.impl.ListFields; import it.mwg.sicilia.sue.api.v1.command.impl.ListFields;
import it.mwg.sicilia.sue.api.v1.command.impl.ListUses; import it.mwg.sicilia.sue.api.v1.command.impl.ListValues;
import it.mwg.sicilia.sue.api.v1.command.impl.Login; import it.mwg.sicilia.sue.api.v1.command.impl.Login;
import it.mwg.sicilia.sue.api.v1.command.impl.Manual; import it.mwg.sicilia.sue.api.v1.command.impl.Manual;
import it.mwg.sicilia.sue.api.v1.command.impl.ManualHtml; import it.mwg.sicilia.sue.api.v1.command.impl.ManualHtml;
import it.mwg.sicilia.sue.api.v1.command.impl.Nop; import it.mwg.sicilia.sue.api.v1.command.impl.Nop;
import it.mwg.sicilia.sue.api.v1.command.impl.SetFields; import it.mwg.sicilia.sue.api.v1.command.impl.SetFields;
import it.mwg.sicilia.sue.api.v1.command.impl.SetUse;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -37,14 +36,12 @@ public class CommandList {
addCommand(new ListDocuments("Elenco dei documenti riconosciuti dal portale", HttpMethods.GET, HttpMethods.POST)); addCommand(new ListDocuments("Elenco dei documenti riconosciuti dal portale", HttpMethods.GET, HttpMethods.POST));
addCommand(new ListFields("Elenco dei dati dell'istanza accettati dal portale", HttpMethods.GET, addCommand(new ListFields("Elenco dei dati dell'istanza accettati dal portale", HttpMethods.GET,
HttpMethods.POST)); HttpMethods.POST));
addCommand(new ListUses("Elenco delle destinazioni d'uso riconosciute dal portale", HttpMethods.GET, addCommand(new ListValues("Elenca i valori ammissibili per un campo a selezione obbligata"));
HttpMethods.POST));
// Istanze // Istanze
addCommand(new AddApplication( addCommand(new AddApplication(
"Crea una nuova istanza di endoprocedimento, crea l'utente se non esiste ancora sul portale")); "Crea una nuova istanza di endoprocedimento, crea l'utente se non esiste ancora sul portale"));
addCommand(new SetFields("Imposta i valori dei dati dell'istanza, l'elenco è fornito dal comando /" addCommand(new SetFields("Imposta i valori dei dati dell'istanza, l'elenco dei campi valorizzabili è fornito dal comando /"
+ Command.getCommandName(ListFields.class))); + Command.getCommandName(ListFields.class)));
addCommand(new SetUse("Imposta la destinazione d'uso dell'immobile relativo all'istanza"));
addCommand(new GetApplications("Elenca le istanze in lavorazione da questo SUE", HttpMethods.GET, addCommand(new GetApplications("Elenca le istanze in lavorazione da questo SUE", HttpMethods.GET,
HttpMethods.POST)); HttpMethods.POST));
addCommand(new DeleteApplication("Elimina un'istanza")); addCommand(new DeleteApplication("Elimina un'istanza"));

15
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/AddApplication.java

@ -28,7 +28,6 @@ import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.util.MapUtil; import com.liferay.portal.kernel.util.MapUtil;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
@ -57,7 +56,7 @@ public class AddApplication extends Command {
add(new Parameter(Parameters.APPLICATION_ID, TYPES.INTEGER, add(new Parameter(Parameters.APPLICATION_ID, TYPES.INTEGER,
"Identificatore del procedimento creato, da utilizzare nelle successive operazioni")); "Identificatore del procedimento creato, da utilizzare nelle successive operazioni"));
add(new Parameter(Parameters.ADDITIONAL_INFO, TYPES.STRING, add(new Parameter(Parameters.ADDITIONAL_INFO, TYPES.STRING,
"Eventuali informazioni aggiuntive sull'operazione o sugli errori incontrati")); "Eventuali informazioni aggiuntive sull'operazione o sugli errori incontrati", false));
} }
}; };
@ -73,14 +72,14 @@ public class AddApplication extends Command {
String screenName = MapUtil.getString(parameters, Parameters.VAT_ID); String screenName = MapUtil.getString(parameters, Parameters.VAT_ID);
if (Validator.isNull(screenName)) { if (Validator.isNull(screenName)) {
additionalInfo.add("Parametro " + Parameters.VAT_ID + " mancante"); additionalInfo.add("Parametro " + Parameters.VAT_ID + " mancante");
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo)); Response.write(response, Status.MALFORMED_REQUEST, additionalInfo);
return; return;
} }
String tipoProcedura = MapUtil.getString(parameters, Parameters.CODE); String tipoProcedura = MapUtil.getString(parameters, Parameters.CODE);
if (Validator.isNull(tipoProcedura) if (Validator.isNull(tipoProcedura)
|| !IntPraticaLocalServiceUtil.getTipiProcedure().containsKey(tipoProcedura)) { || !IntPraticaLocalServiceUtil.getTipiProcedure().containsKey(tipoProcedura)) {
additionalInfo.add("Tipo pratica non specificato o non valido"); additionalInfo.add("Tipo pratica non specificato o non valido");
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo)); Response.write(response, Status.MALFORMED_REQUEST, additionalInfo);
return; return;
} }
String lastName = MapUtil.getString(parameters, Parameters.LAST_NAME, screenName); String lastName = MapUtil.getString(parameters, Parameters.LAST_NAME, screenName);
@ -92,7 +91,7 @@ public class AddApplication extends Command {
territorio = TerritorioLocalServiceUtil.findByComuneId(comune.getComuneId(), 0, 1).get(0); territorio = TerritorioLocalServiceUtil.findByComuneId(comune.getComuneId(), 0, 1).get(0);
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
additionalInfo.add("Errore del server durante il caricamento del comune"); additionalInfo.add("Errore del server durante il caricamento del comune");
ServletResponseUtil.write(response, Response.get(Status.INACTIVE_USER, additionalInfo)); Response.write(response, Status.INACTIVE_USER, additionalInfo);
return; return;
} }
Date date = new Date(); Date date = new Date();
@ -137,7 +136,7 @@ public class AddApplication extends Command {
} }
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
additionalInfo.add("Errore durante la creazione dell'utente " + screenName); additionalInfo.add("Errore durante la creazione dell'utente " + screenName);
ServletResponseUtil.write(response, Response.get(Status.SERVER_ERROR, additionalInfo)); Response.write(response, Status.SERVER_ERROR, additionalInfo);
return; return;
} }
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
@ -160,12 +159,12 @@ public class AddApplication extends Command {
IntPraticaLocalServiceUtil.updateIntPratica(intPratica); IntPraticaLocalServiceUtil.updateIntPratica(intPratica);
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
additionalInfo.add("Errore durante la creazione dell'istanza"); additionalInfo.add("Errore durante la creazione dell'istanza");
ServletResponseUtil.write(response, Response.get(Status.SERVER_ERROR, additionalInfo)); Response.write(response, Status.SERVER_ERROR, additionalInfo);
return; return;
} }
Map<String, Serializable> result = new HashMap<>(); Map<String, Serializable> result = new HashMap<>();
result.put(Parameters.APPLICATION_ID, dettPratica.getIntPraticaId()); result.put(Parameters.APPLICATION_ID, dettPratica.getIntPraticaId());
ServletResponseUtil.write(response, Response.get(Status.OK, result, additionalInfo)); Response.write(response, Status.OK, result, additionalInfo);
} }
} }

13
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/DeleteApplication.java

@ -19,7 +19,6 @@ import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.util.MapUtil; import com.liferay.portal.kernel.util.MapUtil;
public class DeleteApplication extends Command { public class DeleteApplication extends Command {
@ -36,7 +35,7 @@ public class DeleteApplication extends Command {
{ {
addAll(BASE_OUTPUT_PARAMETERS); addAll(BASE_OUTPUT_PARAMETERS);
add(new Parameter(Parameters.ADDITIONAL_INFO, TYPES.STRING, add(new Parameter(Parameters.ADDITIONAL_INFO, TYPES.STRING,
"Eventuali informazioni aggiuntive sull'operazione o sugli errori incontrati")); "Eventuali informazioni aggiuntive sull'operazione o sugli errori incontrati", false));
} }
}; };
@ -51,7 +50,7 @@ public class DeleteApplication extends Command {
List<String> additionalInfo = new ArrayList<String>(); List<String> additionalInfo = new ArrayList<String>();
if (!parameters.containsKey(Parameters.APPLICATION_ID)) { if (!parameters.containsKey(Parameters.APPLICATION_ID)) {
additionalInfo.add("Parametro " + Parameters.APPLICATION_ID + " mancante"); additionalInfo.add("Parametro " + Parameters.APPLICATION_ID + " mancante");
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo)); Response.write(response, Status.MALFORMED_REQUEST, additionalInfo);
return; return;
} }
long applicationId = MapUtil.getLong(parameters, Parameters.APPLICATION_ID); long applicationId = MapUtil.getLong(parameters, Parameters.APPLICATION_ID);
@ -60,23 +59,23 @@ public class DeleteApplication extends Command {
intPratica = IntPraticaLocalServiceUtil.getIntPratica(applicationId); intPratica = IntPraticaLocalServiceUtil.getIntPratica(applicationId);
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
additionalInfo.add("Istanza " + applicationId + " non trovata"); additionalInfo.add("Istanza " + applicationId + " non trovata");
ServletResponseUtil.write(response, Response.get(Status.INVALID_INPUT, additionalInfo)); Response.write(response, Status.INVALID_INPUT, additionalInfo);
return; return;
} }
try { try {
Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
if (territorio.getComuneId() != sportello.getComuneId() || !intPratica.isInLavorazioneSue()) { if (territorio.getComuneId() != sportello.getComuneId() || !intPratica.isInLavorazioneSue()) {
additionalInfo.add("Istanza " + applicationId + " non modificabile"); additionalInfo.add("Istanza " + applicationId + " non modificabile");
ServletResponseUtil.write(response, Response.get(Status.INVALID_INPUT, additionalInfo)); Response.write(response, Status.INVALID_INPUT, additionalInfo);
return; return;
} }
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
additionalInfo.add("Errore del server durante il caricamento dell'istanza"); additionalInfo.add("Errore del server durante il caricamento dell'istanza");
ServletResponseUtil.write(response, Response.get(Status.INVALID_INPUT, additionalInfo)); Response.write(response, Status.INVALID_INPUT, additionalInfo);
return; return;
} }
IntPraticaLocalServiceUtil.deleteIntPratica(intPratica, true); IntPraticaLocalServiceUtil.deleteIntPratica(intPratica, true);
ServletResponseUtil.write(response, Response.get(Status.OK)); Response.write(response, Status.OK);
} }
} }

3
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetApplications.java

@ -22,7 +22,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.dao.orm.QueryUtil; import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
public class GetApplications extends Command { public class GetApplications extends Command {
@ -57,7 +56,7 @@ public class GetApplications extends Command {
} }
Map<String, Serializable> result = new HashMap<>(); Map<String, Serializable> result = new HashMap<>();
result.put(Parameters.APPLICATIONS, (Serializable) applications); result.put(Parameters.APPLICATIONS, (Serializable) applications);
ServletResponseUtil.write(response, Response.get(Status.OK, result)); Response.write(response, Status.OK, result);
} }
} }

10
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListApplications.java

@ -3,7 +3,7 @@ package it.mwg.sicilia.sue.api.v1.command.impl;
import it.mwg.sicilia.sue.api.v1.Parameters; import it.mwg.sicilia.sue.api.v1.Parameters;
import it.mwg.sicilia.sue.api.v1.Response; import it.mwg.sicilia.sue.api.v1.Response;
import it.mwg.sicilia.sue.api.v1.Status; import it.mwg.sicilia.sue.api.v1.Status;
import it.mwg.sicilia.sue.api.v1.bean.ListElement; import it.mwg.sicilia.sue.api.v1.bean.ListItem;
import it.mwg.sicilia.sue.api.v1.command.Command; import it.mwg.sicilia.sue.api.v1.command.Command;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter; import it.mwg.sicilia.sue.api.v1.parameter.Parameter;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES; import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES;
@ -19,8 +19,6 @@ import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
public class ListApplications extends Command { public class ListApplications extends Command {
private static final List<Parameter> OUTPUT_PARAMETERS = new ArrayList<>(); private static final List<Parameter> OUTPUT_PARAMETERS = new ArrayList<>();
@ -40,13 +38,13 @@ public class ListApplications extends Command {
public void run(HttpServletRequest request, HttpServletResponse response) throws Exception { public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, String> procedure = IntPraticaLocalServiceUtil.getTipiProcedure(); Map<String, String> procedure = IntPraticaLocalServiceUtil.getTipiProcedure();
List<ListElement> list = new ArrayList<>(procedure.size()); List<ListItem> list = new ArrayList<>(procedure.size());
for (Entry<String, String> entry : procedure.entrySet()) { for (Entry<String, String> entry : procedure.entrySet()) {
list.add(new ListElement(entry.getKey(), entry.getValue())); list.add(new ListItem(entry.getKey(), entry.getValue()));
} }
Map<String, Serializable> result = new HashMap<>(); Map<String, Serializable> result = new HashMap<>();
result.put(Parameters.APPLICATIONS, (Serializable) list); result.put(Parameters.APPLICATIONS, (Serializable) list);
ServletResponseUtil.write(response, Response.get(Status.OK, result)); Response.write(response, Status.OK, result);
} }
@Override @Override

10
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListDocuments.java

@ -3,7 +3,7 @@ package it.mwg.sicilia.sue.api.v1.command.impl;
import it.mwg.sicilia.sue.api.v1.Parameters; import it.mwg.sicilia.sue.api.v1.Parameters;
import it.mwg.sicilia.sue.api.v1.Response; import it.mwg.sicilia.sue.api.v1.Response;
import it.mwg.sicilia.sue.api.v1.Status; import it.mwg.sicilia.sue.api.v1.Status;
import it.mwg.sicilia.sue.api.v1.bean.ListElement; import it.mwg.sicilia.sue.api.v1.bean.ListItem;
import it.mwg.sicilia.sue.api.v1.command.Command; import it.mwg.sicilia.sue.api.v1.command.Command;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter; import it.mwg.sicilia.sue.api.v1.parameter.Parameter;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES; import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES;
@ -19,8 +19,6 @@ import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
public class ListDocuments extends Command { public class ListDocuments extends Command {
private static final List<Parameter> OUTPUT_PARAMETERS = new ArrayList<>(); private static final List<Parameter> OUTPUT_PARAMETERS = new ArrayList<>();
@ -40,13 +38,13 @@ public class ListDocuments extends Command {
public void run(HttpServletRequest request, HttpServletResponse response) throws Exception { public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, String> documents = DocumentiPraticaUtil.getTipiDocDomanda(); Map<String, String> documents = DocumentiPraticaUtil.getTipiDocDomanda();
List<ListElement> list = new ArrayList<>(documents.size()); List<ListItem> list = new ArrayList<>(documents.size());
for (Entry<String, String> entry : documents.entrySet()) { for (Entry<String, String> entry : documents.entrySet()) {
list.add(new ListElement(entry.getKey(), entry.getValue())); list.add(new ListItem(entry.getKey(), entry.getValue()));
} }
Map<String, Serializable> result = new HashMap<>(); Map<String, Serializable> result = new HashMap<>();
result.put(Parameters.DOCUMENTS, (Serializable) list); result.put(Parameters.DOCUMENTS, (Serializable) list);
ServletResponseUtil.write(response, Response.get(Status.OK, result)); Response.write(response, Status.OK, result);
} }
@Override @Override

56
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListFields.java

@ -7,6 +7,7 @@ import it.mwg.sicilia.sue.api.v1.bean.Field;
import it.mwg.sicilia.sue.api.v1.command.Command; import it.mwg.sicilia.sue.api.v1.command.Command;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter; import it.mwg.sicilia.sue.api.v1.parameter.Parameter;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES; import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES;
import it.mwg.sicilia.sue.api.v1.util.DettPraticaUtil;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import java.io.Serializable; import java.io.Serializable;
@ -14,12 +15,15 @@ import java.sql.Types;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.servlet.ServletResponseUtil; import com.liferay.portal.kernel.language.LanguageUtil;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
public class ListFields extends Command { public class ListFields extends Command {
@ -32,6 +36,8 @@ public class ListFields extends Command {
p.addSubParameter(new Parameter(Parameters.DESCRIPTION, TYPES.STRING, "Descrizione del parametro")); p.addSubParameter(new Parameter(Parameters.DESCRIPTION, TYPES.STRING, "Descrizione del parametro"));
p.addSubParameter(new Parameter(Parameters.TYPE, TYPES.STRING, "Tipo del parametro (" + TYPES.STRING + ", " p.addSubParameter(new Parameter(Parameters.TYPE, TYPES.STRING, "Tipo del parametro (" + TYPES.STRING + ", "
+ TYPES.INTEGER + ", ecc.)")); + TYPES.INTEGER + ", ecc.)"));
p.addSubParameter(new Parameter(Parameters.NULLABLE, TYPES.BOOLEAN,
"Se true il campo può essere impostato al valore NULL"));
OUTPUT_PARAMETERS.add(p); OUTPUT_PARAMETERS.add(p);
}; };
@ -42,25 +48,58 @@ public class ListFields extends Command {
@Override @Override
public void run(HttpServletRequest request, HttpServletResponse response) throws Exception { public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
List<Field> list = new ArrayList<>(); Set<Field> list = new TreeSet<>();
Map<String, Integer> fieldTypes = DettPraticaLocalServiceUtil.getDettPraticaFieldsTypes(); Map<String, Integer> fieldTypes = DettPraticaLocalServiceUtil.getDettPraticaFieldsTypes();
List<String> fields = DettPraticaLocalServiceUtil.getDettPraticaFields(); List<String> fields = DettPraticaLocalServiceUtil.getDettPraticaFields();
for (String field : fields) { for (String field : fields) {
String description = StringPool.BLANK; String description = LanguageUtil.get(Locale.ITALIAN, field.replaceAll("([A-Z])", "-$1").toLowerCase())
.replace("<strong>", StringPool.BLANK).replace("</strong>", StringPool.BLANK)
.replace("<br/>", StringPool.SPACE);
boolean insert = true; boolean insert = true;
boolean nullable = false;
Integer fieldType = fieldTypes.get(field);
switch (field) { switch (field) {
case "dccCoperturaAltroDesrizione":
description += " diventa obbligatorio quando dccCoperturaAltro = true";
break;
case "dccElemNonStrutAltroDescrizione":
description += " diventa obbligatorio quando dccElemNonStrutAltro = true";
break;
case "dccOpereDiRinforzoAltroDescrizione":
description += " diventa obbligatorio quando dccOpereDiRinforzoAltro = true";
break;
case "dccOrizzontamentiAltroDescrizione":
description += " diventa obbligatorio quando dccOrizzontamentiAltro = true";
break;
case "dccStruttureEleAltroDescrizione":
description += " diventa obbligatorio quando dccStruttureEleAltro = true";
break;
case "destinazione": case "destinazione":
description = "Codice della destinazione d'uso, l'elenco è fornito dal comando /" description = "Codice della destinazione d'uso, l'elenco è fornito dal comando /"
+ getCommandName(ListUses.class); + getCommandName(ListUses.class);
break; break;
default: case "destinazioneAltroIntervento":
description += " diventa obbligatorio quando destinazione = 3";
break;
case "dcAllegato":
case "dcFoglio":
case "dcParticelle":
insert = false; insert = false;
break;
case "deInfAltroDesc":
description += " diventa obbligatorio quando deInfAltro = true";
break;
}
String values = DettPraticaUtil.getFieldValues(field);
if (null != values) {
description += ". Unici valori ammessi: " + values + StringPool.PERIOD;
} }
if (insert) { if (insert) {
TYPES type = TYPES.UNKNOWN; TYPES type = TYPES.UNKNOWN;
switch (fieldTypes.get(field)) { switch (fieldType) {
case Types.BIGINT: case Types.BIGINT:
case Types.INTEGER: case Types.INTEGER:
case Types.TIMESTAMP:
type = TYPES.INTEGER; type = TYPES.INTEGER;
break; break;
case Types.BOOLEAN: case Types.BOOLEAN:
@ -69,19 +108,16 @@ public class ListFields extends Command {
case Types.DOUBLE: case Types.DOUBLE:
type = TYPES.FLOAT; type = TYPES.FLOAT;
break; break;
case Types.TIMESTAMP:
type = TYPES.FLOAT;
break;
case Types.VARCHAR: case Types.VARCHAR:
type = TYPES.STRING; type = TYPES.STRING;
break; break;
} }
list.add(new Field(field, description, type)); list.add(new Field(field, description, type, nullable));
} }
} }
Map<String, Serializable> result = new HashMap<>(); Map<String, Serializable> result = new HashMap<>();
result.put(Parameters.FIELDS, (Serializable) list); result.put(Parameters.FIELDS, (Serializable) list);
ServletResponseUtil.write(response, Response.get(Status.OK, result)); Response.write(response, Status.OK, result);
} }
@Override @Override

14
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListUses.java

@ -3,24 +3,20 @@ package it.mwg.sicilia.sue.api.v1.command.impl;
import it.mwg.sicilia.sue.api.v1.Parameters; import it.mwg.sicilia.sue.api.v1.Parameters;
import it.mwg.sicilia.sue.api.v1.Response; import it.mwg.sicilia.sue.api.v1.Response;
import it.mwg.sicilia.sue.api.v1.Status; import it.mwg.sicilia.sue.api.v1.Status;
import it.mwg.sicilia.sue.api.v1.bean.ListElement;
import it.mwg.sicilia.sue.api.v1.command.Command; import it.mwg.sicilia.sue.api.v1.command.Command;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter; import it.mwg.sicilia.sue.api.v1.parameter.Parameter;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES; import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; import it.mwg.sicilia.sue.api.v1.util.DettPraticaUtil;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
public class ListUses extends Command { public class ListUses extends Command {
private static final List<Parameter> OUTPUT_PARAMETERS = new ArrayList<>(); private static final List<Parameter> OUTPUT_PARAMETERS = new ArrayList<>();
@ -39,13 +35,9 @@ public class ListUses extends Command {
@Override @Override
public void run(HttpServletRequest request, HttpServletResponse response) throws Exception { public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
List<ListElement> uses = new ArrayList<>();
for (Entry<String, String> e : DettPraticaLocalServiceUtil.getDestinazioniUso().entrySet()) {
uses.add(new ListElement(e.getKey(), e.getValue()));
}
Map<String, Serializable> result = new HashMap<>(); Map<String, Serializable> result = new HashMap<>();
result.put(Parameters.USES, (Serializable) uses); result.put(Parameters.USES, (Serializable) DettPraticaUtil.getUses());
ServletResponseUtil.write(response, Response.get(Status.OK, result)); Response.write(response, Status.OK, result);
} }
@Override @Override

55
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListValues.java

@ -0,0 +1,55 @@
package it.mwg.sicilia.sue.api.v1.command.impl;
import it.mwg.sicilia.sue.api.v1.Parameters;
import it.mwg.sicilia.sue.api.v1.command.Command;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ListValues extends Command {
@SuppressWarnings("serial")
private static final List<Parameter> INPUT_PARAMETERS = new ArrayList<Parameter>() {
{
add(new Parameter(Parameters.NAME, TYPES.STRING, "Nome del campo per il quale si richiede l'elenco"));
}
};
private static final List<Parameter> OUTPUT_PARAMETERS = new ArrayList<>();
static {
OUTPUT_PARAMETERS.addAll(BASE_OUTPUT_PARAMETERS);
Parameter p = new Parameter(Parameters.USES, TYPES.ARRAY, "Elenco di valori ammissibili");
p.addSubParameter(new Parameter(Parameters.VALUE, TYPES.STRING, "Valore per il campo"));
p.addSubParameter(new Parameter(Parameters.DESCRIPTION, TYPES.STRING, "Descrizione del valore, se disponibile",
false));
OUTPUT_PARAMETERS.add(p);
};
public ListValues(String description, String... methods) {
super(description, methods);
}
@Override
public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
}
@Override
public List<Parameter> getInputParameters() {
return INPUT_PARAMETERS;
}
@Override
public List<Parameter> getOutputParameters() {
return OUTPUT_PARAMETERS;
}
@Override
public boolean isSecure() {
return false;
}
}

7
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Login.java

@ -21,7 +21,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
public class Login extends Command { public class Login extends Command {
@ -61,13 +60,13 @@ public class Login extends Command {
} catch (NoSuchSportelloException | SystemException e) { } catch (NoSuchSportelloException | SystemException e) {
} }
if (Validator.isNull(sportello) || !sportello.checkPassword(password)) { if (Validator.isNull(sportello) || !sportello.checkPassword(password)) {
ServletResponseUtil.write(response, Response.get(Status.WRONG_USERNAME_OR_PASSWORD)); Response.write(response, Status.WRONG_USERNAME_OR_PASSWORD);
} else if (!sportello.isAttivo()) { } else if (!sportello.isAttivo()) {
ServletResponseUtil.write(response, Response.get(Status.INACTIVE_USER)); Response.write(response, Status.INACTIVE_USER);
} else { } else {
Map<String, Serializable> result = new HashMap<>(); Map<String, Serializable> result = new HashMap<>();
result.put(Parameters.TOKEN, new AccessToken(sportello).getToken()); result.put(Parameters.TOKEN, new AccessToken(sportello).getToken());
ServletResponseUtil.write(response, Response.get(Status.OK, result)); Response.write(response, Status.OK, result);
} }
} }
} }

41
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Manual.java

@ -88,7 +88,7 @@ public class Manual extends Command {
} }
} }
} }
result.append("Esempio:\n").append(getCurlExample(command, getBaseUrl(request))); result.append("Esempio:\n").append(getCurlExample(command, getBaseUrl(request), StringPool.TAB));
if (commands.hasNext()) { if (commands.hasNext()) {
result.append("================================================================================\n"); result.append("================================================================================\n");
} }
@ -102,15 +102,22 @@ public class Manual extends Command {
protected String getCurlExample(Command command, String baseUrl) { protected String getCurlExample(Command command, String baseUrl) {
return getCurlExample(command, baseUrl, StringPool.BLANK);
}
protected String getCurlExample(Command command, String baseUrl, String prefix) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("\tcurl "); sb.append(prefix).append("curl ");
if (command.isSecure()) { if (command.isSecure()) {
sb.append("--header \"").append(Parameters.X_AUTH_TOKEN).append(": $TOKEN\"").append(" \\\n\t\t"); sb.append("--header \"").append(Parameters.X_AUTH_TOKEN).append(": $TOKEN\"").append(" \\\n")
.append(prefix).append(StringPool.TAB);
} }
if (command.getMethods().contains(HttpMethods.GET)) { if (command.getMethods().contains(HttpMethods.GET)) {
} else { } else {
sb.append("--header \"Content-Type: application/json; charset=UTF-8\" \\\n\t\t"); sb.append("--header \"Content-Type: application/json; charset=UTF-8\" \\\n").append(prefix)
sb.append("--request POST \\\n\t\t"); .append(StringPool.TAB);
sb.append("--request POST \\\n").append(prefix).append(StringPool.TAB);
Map<String, Serializable> data = new LinkedHashMap<>(); Map<String, Serializable> data = new LinkedHashMap<>();
for (Parameter parameter : command.getInputParameters()) { for (Parameter parameter : command.getInputParameters()) {
if (parameter.getType().equals(TYPES.STRING)) { if (parameter.getType().equals(TYPES.STRING)) {
@ -121,10 +128,32 @@ public class Manual extends Command {
data.put(parameter.getName(), 123456); data.put(parameter.getName(), 123456);
} else if (parameter.getType().equals(TYPES.BOOLEAN)) { } else if (parameter.getType().equals(TYPES.BOOLEAN)) {
data.put(parameter.getName(), true); data.put(parameter.getName(), true);
} else if (parameter.getType().equals(TYPES.ARRAY)) {
List<Map<String, Serializable>> list = new ArrayList<>();
for (int i = 1; i < 3; i++) {
Map<String, Serializable> item = new LinkedHashMap<>();
for (Parameter subParameter : parameter.getSubParameters()) {
if (subParameter.getType().equals(TYPES.STRING)
|| (subParameter.getType().equals(TYPES.VARYING) && (i % 2 == 1))) {
String value = subParameter.getName().substring(0, 1).toUpperCase()
+ subParameter.getName().substring(1);
value = value.replaceAll("([A-Z])", " $1").substring(1) + StringPool.SPACE + i;
item.put(subParameter.getName(), value);
} else if (subParameter.getType().equals(TYPES.INTEGER)
|| subParameter.getType().equals(TYPES.VARYING)) {
item.put(subParameter.getName(), i * 123);
} else if (subParameter.getType().equals(TYPES.BOOLEAN)) {
item.put(subParameter.getName(), i % 2 == 1);
}
}
list.add(item);
}
data.put(parameter.getName(), (Serializable) list);
} }
} }
if (data.size() > 0) { if (data.size() > 0) {
sb.append("--data '").append(serializer.serialize(data)).append("' \\\n\t\t"); sb.append("--data '").append(serializer.serializeDeep(data)).append("' \\\n").append(prefix)
.append(StringPool.TAB);
} }
} }
sb.append(baseUrl).append(command.getVerb()).append(StringPool.NEW_LINE); sb.append(baseUrl).append(command.getVerb()).append(StringPool.NEW_LINE);

193
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ManualHtml.java

@ -13,8 +13,6 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import com.liferay.portal.kernel.servlet.ServletResponseUtil; import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
@ -42,118 +40,121 @@ public class ManualHtml extends Manual {
.append("<head><title>Manual</title>").append("<link rel=\"stylesheet\" href=\"") .append("<head><title>Manual</title>").append("<link rel=\"stylesheet\" href=\"")
.append(request.getContextPath()).append(cssFile).append("?v=") .append(request.getContextPath()).append(cssFile).append("?v=")
.append(new File(request.getServletContext().getRealPath(cssFile)).lastModified()).append("\">") .append(new File(request.getServletContext().getRealPath(cssFile)).lastModified()).append("\">")
.append("<link rel=\"stylesheet\" href=\"").append(request.getContextPath()) .append("<link rel=\"stylesheet\" href=\"").append(request.getContextPath()).append(bootstrapFile)
.append(bootstrapFile).append("\">") .append("\">").append("</head><body class=''>");
.append("</head><body class=''>");
result.append("<div class='container'>"); result.append("<div class='container'>");
result.append("<div class='row'>");
result.append("<div class='col-12 pt-4'>");
result.append("<h1>Sicilia SUE API v1</h1>");
result.append("</div>");
result.append("</div>");
for (Command command : CommandList.getList()) {
result.append("<div class='row'>"); result.append("<div class='row'>");
result.append("<div class='col-12 pt-4'>"); result.append("<div class='col-12 mb-5'>");
result.append("<h1>Sicilia SUE API v1</h1>"); result.append("<h2 class='mb-3 mt-2'>/").append(command.getVerb());
result.append("</div>"); if (command.isSecure())
result.append(" <small>[T]</small>");
result.append("</h2>");
result.append("<p class='description text-secondary mb-3'>").append(command.getDescription())
.append(".</p>");
result.append("<div class='w-100 mb-2'>");
for (String cmd : command.getMethods()) {
result.append("<span class='badge badge-success mr-2 py-1 px-2' data-type='").append(cmd.toLowerCase())
.append("'>").append(cmd).append("</span>");
}
result.append("</div>"); result.append("</div>");
for (Command command : CommandList.getList()) { result.append("<div class='d-flex w-100 mb-3'><pre class='container-fluid py-2'>");
result.append("<div class='row'>"); result.append(getCurlExample(command, getBaseUrl(request)));
result.append("<div class='col-12 mb-5'>"); result.append("</pre></div>");
result.append("<h2 class='mb-3 mt-2'>/").append(command.getVerb()); List<Parameter> parameters = command.getInputParameters();
if (command.isSecure()) result.append("<div class='w-100 mb-3 mt-4'>");
result.append(" <small>[T]</small>"); result.append("<h4 class='w-100'>Parametri</h4>");
result.append("</h2>"); if (parameters.isEmpty()) {
result.append("<p>Nessuno</p>");
result.append("<p class='description text-secondary mb-3'>").append(command.getDescription()).append(".</p>"); } else {
result.append("<table class='table table-sm table-bordered'>");
result.append("<div class='w-100 mb-2'>"); result.append("<thead class='thead-light font-weight-bold'>");
for(String cmd : command.getMethods() ){ result.append("<tr>");
result.append("<span class='badge badge-success mr-2 py-1 px-2' data-type='" + cmd.toLowerCase() + "'>"+cmd+"</span>"); result.append("<th>Campo</th>");
} result.append("<th>Obbligatorio</th>");
result.append("</div>"); result.append("<th>Tipo</th>");
result.append("<th>Descrizione</th>");
result.append("<div class='d-flex w-100 mb-3'><kbd class='container-fluid py-2'>"); result.append("</tr>");
result.append(getCurlExample(command, getBaseUrl(request))); result.append("</thead>");
result.append("</kbd></div>"); result.append("<tbody>");
result.append(printTableParameters(parameters, 0, false));
List<Parameter> parameters = command.getInputParameters(); result.append("</tbody>");
result.append("<div class='w-100 mb-3 mt-4'>"); result.append("</table>");
result.append("<h4 class='w-100'>Parametri</h4>");
if (parameters.isEmpty()) {
result.append("<p>Nessuno</p>");
} else {
result.append("<table class='table table-sm table-bordered'>");
result.append("<thead class='thead-light font-weight-bold'>");
result.append("<tr>");
result.append("<th>Campo</th>");
result.append("<th>Obbligatorio</th>");
result.append("<th>Tipo</th>");
result.append("<th>Descrizione</th>");
result.append("</tr>");
result.append("</thead>");
result.append("<tbody>");
result.append(printTableParameters(parameters, 1));
result.append("</tbody>");
result.append("</table>");
}
result.append("</div>");
parameters = command.getOutputParameters();
result.append("<div class='w-100 mb-3 mt-4'>");
result.append("<h4 clsas='w-100'>Risposta</h4>");
if (parameters.isEmpty()) {
result.append("<p>Nessuno</p>");
} else {
result.append("<table class='table table-sm table-bordered'>");
result.append("<thead class='thead-light font-weight-bold'>");
result.append("<tr>");
result.append("<th>Campo</th>");
result.append("<th>Obbligatorio</th>");
result.append("<th>Tipo</th>");
result.append("<th>Descrizione</th>");
result.append("</tr>");
result.append("</thead>");
result.append("<tbody>");
result.append(printTableParameters(parameters, 1));
result.append("</tbody>");
result.append("</table>");
}
result.append("</div>");
result.append("</div>");
result.append("</div>");
} }
result.append("<div class='row'>");
result.append("<div class='col-12 pt-4'>");
result.append("<p>");
result.append("<b>Note</b><br>[T] = Richiede token di autenticazione: header di richiesta \"");
result.append(Parameters.X_AUTH_TOKEN).append("\" oppure parametro \"").append(Parameters.TOKEN);
result.append("\"</p>");
result.append("</div>");
result.append("</div>"); result.append("</div>");
parameters = command.getOutputParameters();
result.append("<div class='w-100 mb-3 mt-4'>");
result.append("<h4 clsas='w-100'>Risposta</h4>");
if (parameters.isEmpty()) {
result.append("<p>Nessuno</p>");
} else {
result.append("<table class='table table-sm table-bordered'>");
result.append("<thead class='thead-light font-weight-bold'>");
result.append("<tr>");
result.append("<th>Campo</th>");
result.append("<th>Opzionale</th>");
result.append("<th>Tipo</th>");
result.append("<th>Descrizione</th>");
result.append("</tr>");
result.append("</thead>");
result.append("<tbody>");
result.append(printTableParameters(parameters, 0, true));
result.append("</tbody>");
result.append("</table>");
}
result.append("</div>");
result.append("</div>");
result.append("</div>");
}
result.append("<div class='row'>");
result.append("<div class='col-12 pt-4'>");
result.append("<p>");
result.append("<b>Note</b><br>[T] = Richiede token di autenticazione: header di richiesta \"");
result.append(Parameters.X_AUTH_TOKEN).append("\" oppure parametro JSON \"").append(Parameters.TOKEN);
result.append("\"</p>");
result.append("</div>");
result.append("</div>");
result.append("</div>"); result.append("</div>");
result.append("</body></html>"); result.append("</body></html>");
setTextHtml(response); setTextHtml(response);
ServletResponseUtil.write(response, result.toString()); ServletResponseUtil.write(response, result.toString());
} }
private String printTableParameters(List<Parameter> parameters, int level){ private String printTableParameters(List<Parameter> parameters, int level, boolean output) {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
for (Parameter parameter : parameters) { for (Parameter parameter : parameters) {
result.append("<tr>"); result.append("<tr>");
result.append("<td style='padding-left:" + (0.75 * level) + "rem'>" + parameter.getName() + "</td>"); result.append("<td style='padding-left:").append(0.75 + 2 * level).append("rem'>")
result.append("<td>"); .append(parameter.getName()).append("</td>");
if (parameter.isRequired()) result.append("<td>");
result.append("Sì"); if (output) {
else if (parameter.isRequired()) {
result.append("No"); result.append("No");
result.append("</td>"); } else {
result.append("<td>" + parameter.getType().toString() + "</td>"); result.append("Sì");
result.append("<td>" + parameter.getDescription() + "</td>"); }
} else {
if (parameter.isRequired()) {
result.append("Sì");
} else {
result.append("No");
}
}
result.append("</td>");
result.append("<td>").append(parameter.getType().toString()).append("</td>");
result.append("<td>").append(parameter.getDescription()).append("</td>");
result.append("</tr>"); result.append("</tr>");
if (parameter.getType().equals(TYPES.ARRAY)) { if (parameter.getType().equals(TYPES.ARRAY)) {
printTableParameters(parameter.getSubParameters(), level++); result.append(printTableParameters(parameter.getSubParameters(), level + 1, output));
} }
} }
return result.toString(); return result.toString();
} }
@Override @Override

3
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Nop.java

@ -10,7 +10,6 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
public class Nop extends Command { public class Nop extends Command {
@ -28,7 +27,7 @@ public class Nop extends Command {
public void run(HttpServletRequest request, HttpServletResponse response) throws Exception { public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
if (verifyAccessToken(request, response)) { if (verifyAccessToken(request, response)) {
ServletResponseUtil.write(response, Response.get(Status.OK)); Response.write(response, Status.OK);
} }
} }

46
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/SetFields.java

@ -1,12 +1,13 @@
package it.mwg.sicilia.sue.api.v1.command.impl; package it.mwg.sicilia.sue.api.v1.command.impl;
import it.mwg.sicilia.sue.api.v1.ApiUtil;
import it.mwg.sicilia.sue.api.v1.Parameters; import it.mwg.sicilia.sue.api.v1.Parameters;
import it.mwg.sicilia.sue.api.v1.Response; import it.mwg.sicilia.sue.api.v1.Response;
import it.mwg.sicilia.sue.api.v1.Status; import it.mwg.sicilia.sue.api.v1.Status;
import it.mwg.sicilia.sue.api.v1.command.Command; import it.mwg.sicilia.sue.api.v1.command.Command;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter; import it.mwg.sicilia.sue.api.v1.parameter.Parameter;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES; import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES;
import it.mwg.sicilia.sue.api.v1.util.ApiUtil;
import it.mwg.sicilia.sue.api.v1.util.DettPraticaUtil;
import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.model.IntPratica;
import it.tref.liferay.portos.bo.model.Territorio; import it.tref.liferay.portos.bo.model.Territorio;
@ -24,7 +25,6 @@ import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.util.MapUtil; import com.liferay.portal.kernel.util.MapUtil;
public class SetFields extends Command { public class SetFields extends Command {
@ -33,10 +33,21 @@ public class SetFields extends Command {
static { static {
INPUT_PARAMETERS.add(new Parameter(Parameters.APPLICATION_ID, TYPES.INTEGER, "Id dell'istanza")); INPUT_PARAMETERS.add(new Parameter(Parameters.APPLICATION_ID, TYPES.INTEGER, "Id dell'istanza"));
Parameter p = new Parameter(Parameters.FIELDS, TYPES.ARRAY, "Elenco di campi da impostare"); Parameter p = new Parameter(Parameters.FIELDS, TYPES.ARRAY, "Elenco di campi da impostare");
p.addSubParameter(new Parameter(Parameters.NAME, TYPES.STRING, "Nome del campo")); p.addSubParameter(new Parameter(Parameters.NAME, TYPES.STRING, "Nome del campo come restituito da /"
+ getCommandName(ListFields.class)));
p.addSubParameter(new Parameter(Parameters.VALUE, TYPES.VARYING, "Valore da impostare per il campo")); p.addSubParameter(new Parameter(Parameters.VALUE, TYPES.VARYING, "Valore da impostare per il campo"));
INPUT_PARAMETERS.add(p);
} }
@SuppressWarnings("serial")
private static final List<Parameter> OUTPUT_PARAMETERS = new ArrayList<Parameter>() {
{
addAll(BASE_OUTPUT_PARAMETERS);
add(new Parameter(Parameters.ADDITIONAL_INFO, TYPES.STRING,
"Eventuali informazioni aggiuntive sull'operazione o sugli errori incontrati", false));
}
};
public SetFields(String description, String... methods) { public SetFields(String description, String... methods) {
super(description, methods); super(description, methods);
} }
@ -48,18 +59,18 @@ public class SetFields extends Command {
List<String> additionalInfo = new ArrayList<String>(); List<String> additionalInfo = new ArrayList<String>();
if (!parameters.containsKey(Parameters.APPLICATION_ID)) { if (!parameters.containsKey(Parameters.APPLICATION_ID)) {
additionalInfo.add("Parametro " + Parameters.APPLICATION_ID + " mancante"); additionalInfo.add("Parametro " + Parameters.APPLICATION_ID + " mancante");
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo)); Response.write(response, Status.MALFORMED_REQUEST, additionalInfo);
return; return;
} }
if (!parameters.containsKey(Parameters.FIELDS)) { if (!parameters.containsKey(Parameters.FIELDS)) {
additionalInfo.add("Parametro " + Parameters.FIELDS + " mancante"); additionalInfo.add("Parametro " + Parameters.FIELDS + " mancante");
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo)); Response.write(response, Status.MALFORMED_REQUEST, additionalInfo);
return; return;
} }
Map<String, Serializable> fields = ApiUtil.getMapStringSerializable(parameters.get(Parameters.FIELDS)); Map<String, Serializable> fields = ApiUtil.getMapStringSerializable(parameters.get(Parameters.FIELDS));
if (null == fields) { if (null == fields) {
additionalInfo.add("Parametro " + Parameters.FIELDS + " non corretto"); additionalInfo.add("Parametro " + Parameters.FIELDS + " non corretto");
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo)); Response.write(response, Status.MALFORMED_REQUEST, additionalInfo);
return; return;
} }
long applicationId = MapUtil.getLong(parameters, Parameters.APPLICATION_ID); long applicationId = MapUtil.getLong(parameters, Parameters.APPLICATION_ID);
@ -68,7 +79,7 @@ public class SetFields extends Command {
intPratica = IntPraticaLocalServiceUtil.getIntPratica(applicationId); intPratica = IntPraticaLocalServiceUtil.getIntPratica(applicationId);
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
additionalInfo.add("Istanza " + applicationId + " non trovata"); additionalInfo.add("Istanza " + applicationId + " non trovata");
ServletResponseUtil.write(response, Response.get(Status.INVALID_INPUT, additionalInfo)); Response.write(response, Status.INVALID_INPUT, additionalInfo);
return; return;
} }
DettPratica dettPratica = null; DettPratica dettPratica = null;
@ -76,16 +87,29 @@ public class SetFields extends Command {
Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
if (territorio.getComuneId() != sportello.getComuneId() || !intPratica.isInLavorazioneSue()) { if (territorio.getComuneId() != sportello.getComuneId() || !intPratica.isInLavorazioneSue()) {
additionalInfo.add("Istanza " + applicationId + " non modificabile"); additionalInfo.add("Istanza " + applicationId + " non modificabile");
ServletResponseUtil.write(response, Response.get(Status.INVALID_INPUT, additionalInfo)); Response.write(response, Status.ACCESS_DENIED, additionalInfo);
return; return;
} }
dettPratica = DettPraticaLocalServiceUtil.getLastEditableByIntPratica(applicationId); dettPratica = DettPraticaLocalServiceUtil.getLastEditableByIntPratica(applicationId);
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
additionalInfo.add("Errore del server durante il caricamento dell'istanza"); additionalInfo.add("Errore del server durante il caricamento dell'istanza");
ServletResponseUtil.write(response, Response.get(Status.INVALID_INPUT, additionalInfo)); Response.write(response, Status.SERVER_ERROR, additionalInfo);
return;
}
List<String> errors = DettPraticaUtil.checkValues(fields);
if (!errors.isEmpty()) {
additionalInfo.addAll(errors);
Response.write(response, Status.INVALID_INPUT, additionalInfo);
return;
}
String field = DettPraticaUtil.setFields(dettPratica, fields);
if (null != field) {
additionalInfo.add("Il campo " + field + " non esiste o non è modificabile");
Response.write(response, Status.INVALID_INPUT, additionalInfo);
return; return;
} }
ServletResponseUtil.write(response, Response.get(Status.OK)); DettPraticaLocalServiceUtil.updateDettPratica(dettPratica);
Response.write(response, Status.OK, additionalInfo);
} }
} }
@ -96,7 +120,7 @@ public class SetFields extends Command {
@Override @Override
public List<Parameter> getOutputParameters() { public List<Parameter> getOutputParameters() {
return BASE_OUTPUT_PARAMETERS; return OUTPUT_PARAMETERS;
} }
} }

103
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/SetUse.java

@ -1,103 +0,0 @@
package it.mwg.sicilia.sue.api.v1.command.impl;
import it.mwg.sicilia.sue.api.v1.Parameters;
import it.mwg.sicilia.sue.api.v1.Response;
import it.mwg.sicilia.sue.api.v1.Status;
import it.mwg.sicilia.sue.api.v1.command.Command;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter.TYPES;
import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.model.IntPratica;
import it.tref.liferay.portos.bo.model.Territorio;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.util.MapUtil;
public class SetUse extends Command {
@SuppressWarnings("serial")
private static final List<Parameter> INPUT_PARAMETERS = new ArrayList<Parameter>() {
{
add(new Parameter(Parameters.APPLICATION_ID, TYPES.INTEGER, "Id dell'istanza"));
add(new Parameter(Parameters.CODE, TYPES.STRING, "Codice della destinazione d'uso come restituito da /"
+ getCommandName(ListUses.class)));
add(new Parameter(Parameters.DESCRIPTION, TYPES.STRING,
"Descrizione della destinazione d'uso, obbligatoria* se " + Parameters.CODE + " = 3", false));
}
};
public SetUse(String description, String... methods) {
super(description, methods);
}
@Override
public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
if (verifyAccessToken(request, response)) {
List<String> additionalInfo = new ArrayList<String>();
if (!parameters.containsKey(Parameters.APPLICATION_ID)) {
additionalInfo.add("Parametro " + Parameters.APPLICATION_ID + " mancante");
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo));
return;
}
if (!parameters.containsKey(Parameters.CODE)) {
additionalInfo.add("Parametro " + Parameters.CODE + " mancante");
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo));
return;
}
long applicationId = MapUtil.getLong(parameters, Parameters.APPLICATION_ID);
String code = MapUtil.getString(parameters, Parameters.CODE);
if (!DettPraticaLocalServiceUtil.getDestinazioniUso().containsKey(code)) {
additionalInfo.add("Parametro " + Parameters.CODE + " = " + code + " non valido");
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo));
return;
}
IntPratica intPratica = null;
try {
intPratica = IntPraticaLocalServiceUtil.getIntPratica(applicationId);
} catch (PortalException | SystemException e) {
additionalInfo.add("Istanza " + applicationId + " non trovata");
ServletResponseUtil.write(response, Response.get(Status.INVALID_INPUT, additionalInfo));
return;
}
DettPratica dettPratica = null;
try {
Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
if (territorio.getComuneId() != sportello.getComuneId() || !intPratica.isInLavorazioneSue()) {
additionalInfo.add("Istanza " + applicationId + " non modificabile");
ServletResponseUtil.write(response, Response.get(Status.INVALID_INPUT, additionalInfo));
return;
}
dettPratica = DettPraticaLocalServiceUtil.getLastEditableByIntPratica(applicationId);
} catch (PortalException | SystemException e) {
additionalInfo.add("Errore del server durante il caricamento dell'istanza");
ServletResponseUtil.write(response, Response.get(Status.INVALID_INPUT, additionalInfo));
return;
}
dettPratica.setDestinazione(code);
DettPraticaLocalServiceUtil.updateDettPratica(dettPratica);
ServletResponseUtil.write(response, Response.get(Status.OK));
}
}
@Override
public List<Parameter> getInputParameters() {
return INPUT_PARAMETERS;
}
@Override
public List<Parameter> getOutputParameters() {
return BASE_OUTPUT_PARAMETERS;
}
}

3
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/ApiUtil.java → liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/util/ApiUtil.java

@ -1,5 +1,6 @@
package it.mwg.sicilia.sue.api.v1; package it.mwg.sicilia.sue.api.v1.util;
import it.mwg.sicilia.sue.api.v1.ApiConstants;
import it.mwg.sicilia.sue.service.ApiSettingLocalServiceUtil; import it.mwg.sicilia.sue.service.ApiSettingLocalServiceUtil;
import java.io.Serializable; import java.io.Serializable;

175
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/util/DettPraticaUtil.java

@ -0,0 +1,175 @@
package it.mwg.sicilia.sue.api.v1.util;
import it.mwg.sicilia.sue.api.v1.bean.Value;
import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.sql.Types;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class DettPraticaUtil {
private static final List<String> FIELDS = DettPraticaLocalServiceUtil.getDettPraticaFields();
private static final Map<String, Integer> FIELD_TYPES;
private static final Map<String, List<Value>> FIELD_VALUES = new HashMap<>();
public static String setFields(DettPratica dettPratica, Map<String, Serializable> fields) {
for (String fieldName : fields.keySet()) {
if (!FIELDS.contains(fieldName)) {
return fieldName;
}
String methodName = "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
Serializable field = fields.get(fieldName);
Class<?> clazz = field.getClass();
try {
Method method;
if (Boolean.class.equals(clazz)) {
method = dettPratica.getClass().getMethod(methodName, boolean.class);
} else if (Long.class.equals(clazz)) {
try {
method = dettPratica.getClass().getMethod(methodName, long.class);
} catch (NoSuchMethodException e) {
method = dettPratica.getClass().getMethod(methodName, int.class);
field = ((Long) field).intValue();
}
} else {
method = dettPratica.getClass().getMethod(methodName, clazz);
}
method.invoke(dettPratica, field);
} catch (Exception e) {
return fieldName;
}
}
return null;
}
public static List<String> checkValues(Map<String, Serializable> fields) {
List<String> result = new ArrayList<>();
for (String fieldName : fields.keySet()) {
Serializable field = fields.get(fieldName);
Class<?> clazz = null;
switch (FIELD_TYPES.get(fieldName)) {
case Types.BIGINT:
case Types.INTEGER:
case Types.TIMESTAMP:
clazz = Long.class;
break;
case Types.BOOLEAN:
clazz = Boolean.class;
break;
case Types.DOUBLE:
clazz = Double.class;
break;
case Types.VARCHAR:
clazz = String.class;
break;
}
if (!field.getClass().equals(clazz)) {
result.add("Tipo dati non corretto per il campo " + fieldName);
}
}
for (String field : fields.keySet()) {
// if (FIELD_MAPS.containsKey(field)) {
// Serializable value = fields.get(field);
// if (!FIELD_MAPS.get(field).keySet().contains(value)) {
// result.add("Valore " + value + " non valido per il campo " + field);
// }
// } else if (FIELD_VALUES.containsKey(field)) {
// Serializable value = fields.get(field);
// if (!FIELD_VALUES.get(field).contains(value)) {
// result.add("Valore non valido " + field + " = " + value);
// }
// }
}
return result;
}
public static String getFieldValues(String fieldName) {
String result = getLabelsString(fieldName);
if (null == result) {
result = getValuesString(fieldName);
}
return result;
}
private static String getLabelsString(String fieldName) {
String result = null;
// if (FIELD_MAPS.containsKey(fieldName)) {
// StringBuilder sb = new StringBuilder();
// for (Serializable value : FIELD_MAPS.get(fieldName)) {
// if (sb.length() > 0) {
// sb.append(StringPool.COMMA_AND_SPACE);
// }
// sb.append(StringPool.QUOTE).append(value).append(StringPool.QUOTE);
// }
// result = sb.toString();
// }
return result;
}
private static String getValuesString(String fieldName) {
String result = null;
// if (FIELD_VALUES.containsKey(fieldName)) {
// StringBuilder sb = new StringBuilder();
// for (Serializable value : FIELD_VALUES.get(fieldName)) {
// if (sb.length() > 0) {
// sb.append(StringPool.COMMA_AND_SPACE);
// }
// if (String.class.equals(value.getClass())) {
// sb.append(StringPool.QUOTE).append(value).append(StringPool.QUOTE);
// } else {
// sb.append(value);
// }
// }
// result = sb.toString();
// }
return result;
}
private static List<Value> withoutLabel(Serializable... values) {
List<Value> result = new ArrayList<>();
for (int i = 0; i < values.length; i++) {
result.add(new Value(values[i], (String) values[i]));
}
return result;
}
private static List<Value> withLabel(Serializable... values) {
List<Value> result = new ArrayList<>();
for (int i = 0; i < values.length; i += 2) {
result.add(new Value(values[i], (String) values[i + 1]));
}
return result;
}
static {
FIELD_TYPES = DettPraticaLocalServiceUtil.getDettPraticaFieldsTypes();
FIELD_TYPES.put("geoConsolidamento", Types.BOOLEAN);
FIELD_TYPES.put("geoEvidenzeGeologiche", Types.BOOLEAN);
FIELD_TYPES.put("geoEvidenzeGeomorfiche", Types.BOOLEAN);
FIELD_TYPES.put("geoOperaRilevante", Types.BOOLEAN);
FIELD_TYPES.put("geoOpereDiSostegno", Types.BOOLEAN);
FIELD_TYPES.put("geoPresenzaPrescrizioni", Types.BOOLEAN);
List<Value> uses = new ArrayList<>();
for (Entry<String, String> e : DettPraticaLocalServiceUtil.getDestinazioniUso().entrySet()) {
uses.add(new Value(e.getKey(), e.getValue()));
}
FIELD_VALUES.put("destinazione", uses);
FIELD_VALUES.put("geoClasseIndagine",
withLabel("1", "1", "2", "2", "3", "3", "4", "4", "NA", "Non applicabile"));
FIELD_VALUES.put("geoOperaRilevante", withLabel(null, "NULL", true, "Sì", false, "No"));
}
}

55
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/css/api/v1/api.css

@ -1,51 +1,10 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain) */
/*html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}*/
/* End reset.css */
.badge.badge-success[data-type="post"] { .badge.badge-success[data-type="post"] {
background-color: #007bff; background-color: #007bff;
} }
pre {
padding: 0.2rem 0.4rem !important;
font-size: 87.5% !important;
color: #fff !important;
background-color: #212529;
border-radius: 0.2rem;
}

4
liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
## ##
build.namespace=Kaleo build.namespace=Kaleo
build.number=50 build.number=51
build.date=1624450810353 build.date=1624550499018
build.auto.upgrade=true build.auto.upgrade=true
## ##

Caricamento…
Annulla
Salva