Mattia Gosetto
4 anni fa
40 ha cambiato i file con 1134 aggiunte e 385 eliminazioni
@ -0,0 +1 @@
|
||||
/classes/ |
File binario non mostrato.
File binario non mostrato.
File binario non mostrato.
File binario non mostrato.
File binario non mostrato.
File binario non mostrato.
File binario non mostrato.
File binario non mostrato.
File binario non mostrato.
File binario non mostrato.
@ -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 |
||||
<when> and <otherwise> |
||||
</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 <%= ... >, 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 <,>,&,'," 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 <choose> that follows <when> 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 <choose> 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,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; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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 java.io.Serializable; |
@ -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")); |
||||
} |
||||
} |
@ -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"] { |
||||
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; |
||||
} |
||||
|
Caricamento…
Reference in new issue