- <%
- String copertura = BeanPropertiesUtil.getString(dettPratica, "dccCopertura");
- %>
-
<%= LanguageUtil.get(pageContext, "dcc-copertura-c-a-acciaio") %>
diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java
index 80cf1e11..a7db0ed2 100644
--- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java
+++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java
@@ -1011,7 +1011,6 @@ public class FascicoloFePortlet extends MVCPortlet {
boolean deInfAltraInfrastruttura = ParamUtil.getBoolean(actionRequest, "deInfAltraInfrastruttura");
boolean deInfAltro = ParamUtil.getBoolean(actionRequest, "deInfAltro");
String deInfAltroDesc = ParamUtil.getString(actionRequest, "deInfAltroDesc");
- String dccFondazioni = ParamUtil.getString(actionRequest, "dccFondazioni");
boolean dccStruttureEleMuraturePietrame = ParamUtil
.getBoolean(actionRequest, "dccStruttureEleMuraturePietrame");
boolean dccStruttureEleMuratureLaterizio = ParamUtil.getBoolean(actionRequest,
@@ -1019,9 +1018,6 @@ public class FascicoloFePortlet extends MVCPortlet {
boolean dccStruttureEleMuratureMisto = ParamUtil.getBoolean(actionRequest, "dccStruttureEleMuratureMisto");
boolean dccStruttureEleMuratureStoriche = ParamUtil
.getBoolean(actionRequest, "dccStruttureEleMuratureStoriche");
- String dccStruttureEleAcciaio = ParamUtil.getString(actionRequest, "dccStruttureEleAcciaio");
- String dccStruttureEleCA = ParamUtil.getString(actionRequest, "dccStruttureEleCA");
- String dccStruttureEleLegno = ParamUtil.getString(actionRequest, "dccStruttureEleLegno");
boolean dccStruttureEleMistoCA = ParamUtil.getBoolean(actionRequest, "dccStruttureEleMistoCA");
boolean dccStruttureEleMistoAcciaio = ParamUtil.getBoolean(actionRequest, "dccStruttureEleMistoAcciaio");
boolean dccStruttureEleMistoMuratura = ParamUtil.getBoolean(actionRequest, "dccStruttureEleMistoMuratura");
@@ -1038,7 +1034,6 @@ public class FascicoloFePortlet extends MVCPortlet {
boolean dccOrizzontamentiAltro = ParamUtil.getBoolean(actionRequest, "dccOrizzontamentiAltro");
String dccOrizzontamentiAltroDescrizione = ParamUtil.getString(actionRequest,
"dccOrizzontamentiAltroDescrizione");
- String dccCopertura = ParamUtil.getString(actionRequest, "dccCopertura");
boolean dccCoperturaCAAcciaio = ParamUtil.getBoolean(actionRequest, "dccCoperturaCAAcciaio");
boolean dccCoperturaLegno = ParamUtil.getBoolean(actionRequest, "dccCoperturaLegno");
boolean dccCoperturaLegnoCA = ParamUtil.getBoolean(actionRequest, "dccCoperturaLegnoCA");
@@ -1126,8 +1121,6 @@ public class FascicoloFePortlet extends MVCPortlet {
boolean normArt3com4 = ParamUtil.getBoolean(actionRequest, "normArt3com4");
boolean suap = ParamUtil.getBoolean(actionRequest, "suap");
boolean normSismaBonus = ParamUtil.getBoolean(actionRequest, "normSismaBonus");
- String clRischioPreInt = ParamUtil.getString(actionRequest, "clRischioPreInt");
- String clRischioPostInt = ParamUtil.getString(actionRequest, "clRischioPostInt");
boolean intervFinPub = ParamUtil.getBoolean(actionRequest, "intervFinPub");
String intervFinPubDesc = ParamUtil.getString(actionRequest, "intervFinPubDesc");
boolean intervInAreaDiInteresse = ParamUtil.getBoolean(actionRequest, "intervInAreaDiInteresse");
@@ -1155,14 +1148,13 @@ public class FascicoloFePortlet extends MVCPortlet {
dePubblica, dePrivata, deUtilizzazione, dePosizioneEdificio, deInfStradalePonte,
deInfStradaleStrada, deInfStradaleAltro, deInfIdraulicaLong, deInfIdraulicaTrasv,
deInfIdraulicaAltro, deInfOperaAccStradale, deInfOperaAccIdraulica, deInfOperaAccAltro,
- deInfAltraInfrastruttura, deInfAltro, deInfAltroDesc, dccFondazioni,
- dccStruttureEleMuraturePietrame, dccStruttureEleMuratureLaterizio, dccStruttureEleMuratureMisto,
- dccStruttureEleMuratureStoriche, dccStruttureEleAcciaio, dccStruttureEleCA, dccStruttureEleLegno,
+ deInfAltraInfrastruttura, deInfAltro, deInfAltroDesc, dccStruttureEleMuraturePietrame,
+ dccStruttureEleMuratureLaterizio, dccStruttureEleMuratureMisto, dccStruttureEleMuratureStoriche,
dccStruttureEleMistoCA, dccStruttureEleMistoAcciaio, dccStruttureEleMistoMuratura,
dccStruttureEleMistoLegno, dccStruttureElePrefabbricato, dccStruttureEleAltro,
dccStruttureEleAltroDescrizione, dccOrizzontamentiCAAcciaio, dccOrizzontamentiLegno,
dccOrizzontamentiLegnoCA, dccOrizzontamentiLamieraGrecata, dccOrizzontamentiVolte,
- dccOrizzontamentiAltro, dccOrizzontamentiAltroDescrizione, dccCopertura, dccCoperturaCAAcciaio,
+ dccOrizzontamentiAltro, dccOrizzontamentiAltroDescrizione, dccCoperturaCAAcciaio,
dccCoperturaLegno, dccCoperturaLegnoCA, dccCoperturaLamieraGrecata, dccCoperturaPannelli,
dccCoperturaPVCTelonati, dccCoperturaLeggere, dccCoperturaAltro, dccCoperturaAltroDesrizione,
dccElemNonStrutLaterizio, dccElemNonStrutCartongesso, dccElemNonStrutCalcestruzzo,
@@ -1185,14 +1177,14 @@ public class FascicoloFePortlet extends MVCPortlet {
tcPrefabbricato, tcInAcciaio, tcMista, tcInMuratura, tcInMuraturaOrdinaria, tcInMuraturaArmata,
tcInMuraturaMista, tcInLegno, tcAltro, tcAltroDescrizione, tcConDispositivi, normLavoriInProprio,
normEsenteBollo, normEsenteSpese, normDpr01Dep, normDpr02Dep, normDpr01Aut, normDpr02Aut,
- normDm2018, normAnr, normArt3com3, normArt3com4, suap, normSismaBonus, clRischioPreInt,
- clRischioPostInt, intervFinPub, intervFinPubDesc, intervInAreaDiInteresse, intervNonModificante,
- intervNonAssoggettabile, serviceContext, bozza, disabledSubmit, geoDisabledSubmit, paesaggioLocale,
- livelloDiTutela, vincoli, destinazioneAltroIntervento, tcCostruzioniEsistenti, tcManutOrdStraord,
- tcAltriInterventi, tcAltriInterventiDesc, noCollaudo, tcNuovaCostruzionePertinenza,
- tcInterventoOpereEscavazione, tcViarch, tcOperaA25, sanatoriaEdilizia47, sanatoriaEdilizia724,
- sanatoriaEdilizia326, normLavoriNoDirettore, pagSoggettiAdAutorizzazione, interventoVoceP7,
- nominaImpresa, nominaDirettoreLavori, nominaCollaudatore, tcNoOpereEscavazione);
+ normDm2018, normAnr, normArt3com3, normArt3com4, suap, normSismaBonus, intervFinPub,
+ intervFinPubDesc, intervInAreaDiInteresse, intervNonModificante, intervNonAssoggettabile,
+ serviceContext, bozza, disabledSubmit, geoDisabledSubmit, paesaggioLocale, livelloDiTutela,
+ vincoli, destinazioneAltroIntervento, tcCostruzioniEsistenti, tcManutOrdStraord, tcAltriInterventi,
+ tcAltriInterventiDesc, noCollaudo, tcNuovaCostruzionePertinenza, tcInterventoOpereEscavazione,
+ tcViarch, tcOperaA25, sanatoriaEdilizia47, sanatoriaEdilizia724, sanatoriaEdilizia326,
+ normLavoriNoDirettore, pagSoggettiAdAutorizzazione, interventoVoceP7, nominaImpresa,
+ nominaDirettoreLavori, nominaCollaudatore, tcNoOpereEscavazione);
String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) {
@@ -1374,7 +1366,6 @@ public class FascicoloFePortlet extends MVCPortlet {
boolean deInfAltraInfrastruttura = ParamUtil.getBoolean(actionRequest, "deInfAltraInfrastruttura");
boolean deInfAltro = ParamUtil.getBoolean(actionRequest, "deInfAltro");
String deInfAltroDesc = ParamUtil.getString(actionRequest, "deInfAltroDesc");
- String dccFondazioni = ParamUtil.getString(actionRequest, "dccFondazioni");
boolean dccStruttureEleMuraturePietrame = ParamUtil
.getBoolean(actionRequest, "dccStruttureEleMuraturePietrame");
boolean dccStruttureEleMuratureLaterizio = ParamUtil.getBoolean(actionRequest,
@@ -1382,9 +1373,6 @@ public class FascicoloFePortlet extends MVCPortlet {
boolean dccStruttureEleMuratureMisto = ParamUtil.getBoolean(actionRequest, "dccStruttureEleMuratureMisto");
boolean dccStruttureEleMuratureStoriche = ParamUtil
.getBoolean(actionRequest, "dccStruttureEleMuratureStoriche");
- String dccStruttureEleAcciaio = ParamUtil.getString(actionRequest, "dccStruttureEleAcciaio");
- String dccStruttureEleCA = ParamUtil.getString(actionRequest, "dccStruttureEleCA");
- String dccStruttureEleLegno = ParamUtil.getString(actionRequest, "dccStruttureEleLegno");
boolean dccStruttureEleMistoCA = ParamUtil.getBoolean(actionRequest, "dccStruttureEleMistoCA");
boolean dccStruttureEleMistoAcciaio = ParamUtil.getBoolean(actionRequest, "dccStruttureEleMistoAcciaio");
boolean dccStruttureEleMistoMuratura = ParamUtil.getBoolean(actionRequest, "dccStruttureEleMistoMuratura");
@@ -1401,7 +1389,6 @@ public class FascicoloFePortlet extends MVCPortlet {
boolean dccOrizzontamentiAltro = ParamUtil.getBoolean(actionRequest, "dccOrizzontamentiAltro");
String dccOrizzontamentiAltroDescrizione = ParamUtil.getString(actionRequest,
"dccOrizzontamentiAltroDescrizione");
- String dccCopertura = ParamUtil.getString(actionRequest, "dccCopertura");
boolean dccCoperturaCAAcciaio = ParamUtil.getBoolean(actionRequest, "dccCoperturaCAAcciaio");
boolean dccCoperturaLegno = ParamUtil.getBoolean(actionRequest, "dccCoperturaLegno");
boolean dccCoperturaLegnoCA = ParamUtil.getBoolean(actionRequest, "dccCoperturaLegnoCA");
@@ -1489,8 +1476,6 @@ public class FascicoloFePortlet extends MVCPortlet {
boolean normArt3com4 = ParamUtil.getBoolean(actionRequest, "normArt3com4");
boolean suap = ParamUtil.getBoolean(actionRequest, "suap");
boolean normSismaBonus = ParamUtil.getBoolean(actionRequest, "normSismaBonus");
- String clRischioPreInt = ParamUtil.getString(actionRequest, "clRischioPreInt");
- String clRischioPostInt = ParamUtil.getString(actionRequest, "clRischioPostInt");
boolean intervFinPub = ParamUtil.getBoolean(actionRequest, "intervFinPub");
String intervFinPubDesc = intervFinPub ? ParamUtil.getString(actionRequest, "intervFinPubDesc")
: StringPool.BLANK;
@@ -1533,14 +1518,13 @@ public class FascicoloFePortlet extends MVCPortlet {
dePubblica, dePrivata, deUtilizzazione, dePosizioneEdificio, deInfStradalePonte,
deInfStradaleStrada, deInfStradaleAltro, deInfIdraulicaLong, deInfIdraulicaTrasv,
deInfIdraulicaAltro, deInfOperaAccStradale, deInfOperaAccIdraulica, deInfOperaAccAltro,
- deInfAltraInfrastruttura, deInfAltro, deInfAltroDesc, dccFondazioni,
- dccStruttureEleMuraturePietrame, dccStruttureEleMuratureLaterizio, dccStruttureEleMuratureMisto,
- dccStruttureEleMuratureStoriche, dccStruttureEleAcciaio, dccStruttureEleCA, dccStruttureEleLegno,
+ deInfAltraInfrastruttura, deInfAltro, deInfAltroDesc, dccStruttureEleMuraturePietrame,
+ dccStruttureEleMuratureLaterizio, dccStruttureEleMuratureMisto, dccStruttureEleMuratureStoriche,
dccStruttureEleMistoCA, dccStruttureEleMistoAcciaio, dccStruttureEleMistoMuratura,
dccStruttureEleMistoLegno, dccStruttureElePrefabbricato, dccStruttureEleAltro,
dccStruttureEleAltroDescrizione, dccOrizzontamentiCAAcciaio, dccOrizzontamentiLegno,
dccOrizzontamentiLegnoCA, dccOrizzontamentiLamieraGrecata, dccOrizzontamentiVolte,
- dccOrizzontamentiAltro, dccOrizzontamentiAltroDescrizione, dccCopertura, dccCoperturaCAAcciaio,
+ dccOrizzontamentiAltro, dccOrizzontamentiAltroDescrizione, dccCoperturaCAAcciaio,
dccCoperturaLegno, dccCoperturaLegnoCA, dccCoperturaLamieraGrecata, dccCoperturaPannelli,
dccCoperturaPVCTelonati, dccCoperturaLeggere, dccCoperturaAltro, dccCoperturaAltroDesrizione,
dccElemNonStrutLaterizio, dccElemNonStrutCartongesso, dccElemNonStrutCalcestruzzo,
@@ -1563,15 +1547,14 @@ public class FascicoloFePortlet extends MVCPortlet {
tcInCA, tcInOpera, tcPrefabbricato, tcInAcciaio, tcMista, tcInMuratura, tcInMuraturaOrdinaria,
tcInMuraturaArmata, tcInMuraturaMista, tcInLegno, tcAltro, tcAltroDescrizione, tcConDispositivi,
normLavoriInProprio, normEsenteBollo, normEsenteSpese, normDpr01Dep, normDpr02Dep, normDpr01Aut,
- normDpr02Aut, normDm2018, normAnr, normArt3com3, normArt3com4, suap, normSismaBonus,
- clRischioPreInt, clRischioPostInt, intervFinPub, intervFinPubDesc, intervInAreaDiInteresse,
- intervNonModificante, intervNonAssoggettabile, serviceContext, bozza, disabledSubmit,
- geoDisabledSubmit, paesaggioLocale, livelloDiTutela, vincoli, destinazioneAltroIntervento,
- tcCostruzioniEsistenti, tcManutOrdStraord, tcAltriInterventi, tcAltriInterventiDesc, noCollaudo,
- tcNuovaCostruzionePertinenza, tcInterventoOpereEscavazione, tcViarch, tcOperaA25,
- sanatoriaEdilizia47, sanatoriaEdilizia724, sanatoriaEdilizia326, normLavoriNoDirettore,
- pagSoggettiAdAutorizzazione, interventoVoceP7, nominaImpresa, nominaDirettoreLavori,
- nominaCollaudatore, tcNoOpereEscavazione);
+ normDpr02Aut, normDm2018, normAnr, normArt3com3, normArt3com4, suap, normSismaBonus, intervFinPub,
+ intervFinPubDesc, intervInAreaDiInteresse, intervNonModificante, intervNonAssoggettabile,
+ serviceContext, bozza, disabledSubmit, geoDisabledSubmit, paesaggioLocale, livelloDiTutela,
+ vincoli, destinazioneAltroIntervento, tcCostruzioniEsistenti, tcManutOrdStraord, tcAltriInterventi,
+ tcAltriInterventiDesc, noCollaudo, tcNuovaCostruzionePertinenza, tcInterventoOpereEscavazione,
+ tcViarch, tcOperaA25, sanatoriaEdilizia47, sanatoriaEdilizia724, sanatoriaEdilizia326,
+ normLavoriNoDirettore, pagSoggettiAdAutorizzazione, interventoVoceP7, nominaImpresa,
+ nominaDirettoreLavori, nominaCollaudatore, tcNoOpereEscavazione);
String redirect = ParamUtil.getString(actionRequest, "redirect");
if (Validator.isNull(redirect)) {
diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/view_fascicolo_dettagli.jsp b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/view_fascicolo_dettagli.jsp
index b817c053..aa7b00d6 100644
--- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/view_fascicolo_dettagli.jsp
+++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/view_fascicolo_dettagli.jsp
@@ -637,26 +637,6 @@
- <%
- String fondazioni = BeanPropertiesUtil.getString(dettPratica, "dccFondazioni");
- String fondazioni_label = StringUtil.extractFirst(fondazioni, "-");
- %>
-
-
-
-
- <%=LanguageUtil.get(pageContext, "dcc-fondazioni-"+fondazioni_label)%>:
-
-
- <%=LanguageUtil.get(pageContext,
- "dcc-fondazioni-"+fondazioni)%>
-
-
-
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/.settings/org.eclipse.wst.common.component b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/.settings/org.eclipse.wst.common.component
index d234eb69..26ffb99f 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/.settings/org.eclipse.wst.common.component
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/.settings/org.eclipse.wst.common.component
@@ -6,9 +6,6 @@
uses
-
- uses
-
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/lib/itextpdf.jar b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/lib/itextpdf.jar
new file mode 100644
index 00000000..e622bdf9
Binary files /dev/null and b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/lib/itextpdf.jar differ
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Parameters.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Parameters.java
index fae28579..77781ca6 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Parameters.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Parameters.java
@@ -6,15 +6,18 @@ public class Parameters {
public static final String APPLICATION = "application";
public static final String APPLICATION_ID = "applicationId";
public static final String APPLICATIONS = "applications";
+ public static final String ATTACHMENTS = "attachments";
+ public static final String ATTACHMENT_ID = "attachmentId";
public static final String CODE = "code";
+ public static final String CONTENT_BASE64 = "contentBase64";
public static final String DESCRIPTION = "description";
- public static final String DOCUMENTS = "documents";
public static final String FIELDS = "fields";
public static final String FIRST_NAME = "firstName";
public static final String LAST_NAME = "lastName";
public static final String NAME = "name";
public static final String NULLABLE = "nullable";
public static final String PASSWORD = "password";
+ public static final String SHA256 = "sha256";
public static final String STATUS_CODE = "statusCode";
public static final String STATUS_MESSAGE = "statusMessage";
public static final String SUE_ID = "sueId";
@@ -22,8 +25,8 @@ public class Parameters {
public static final String TYPE = "type";
public static final String USERNAME = "username";
public static final String USES = "uses";
- public static final String VALUE = "value";
public static final String VALUES = "values";
- public static final String VAT_ID = "vatId";
+ public static final String VALUE = "value";
+ public static final String VATIN = "vatin";
public static final String X_AUTH_TOKEN = "X-Auth-Token";
}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Response.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Response.java
index 58595a6f..e46aeed6 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Response.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/Response.java
@@ -13,6 +13,7 @@ import org.apache.commons.lang.StringUtils;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONSerializer;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
+import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.StringPool;
public class Response {
@@ -31,6 +32,8 @@ public class Response {
if ((null != additionalInfo) && !additionalInfo.isEmpty()) {
map.put(Parameters.ADDITIONAL_INFO, StringUtils.join(additionalInfo, StringPool.NEW_LINE));
}
+ response.setContentType(ContentTypes.APPLICATION_JSON);
+ response.setCharacterEncoding(StringPool.UTF8);
ServletResponseUtil.write(response, serializer.serializeDeep(map));
}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Application.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Application.java
index 8a6b3af8..832498f6 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Application.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Application.java
@@ -7,13 +7,13 @@ public class Application implements Serializable {
private final long applicationId;
private final String code;
- private final String vatId;
+ private final String vatin;
- public Application(long applicationId, String code, String vatId) {
+ public Application(long applicationId, String code, String vatin) {
this.applicationId = applicationId;
this.code = code;
- this.vatId = vatId;
+ this.vatin = vatin;
}
public long getApplicationId() {
@@ -24,7 +24,7 @@ public class Application implements Serializable {
return code;
}
- public String getVatId() {
- return vatId;
+ public String getVatin() {
+ return vatin;
}
}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Attachment.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Attachment.java
new file mode 100644
index 00000000..9bed66a0
--- /dev/null
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/bean/Attachment.java
@@ -0,0 +1,33 @@
+package it.mwg.sicilia.sue.api.v1.bean;
+
+public class Attachment {
+
+ private final long attachmentId;
+ private final String code;
+ private final String name;
+ private final String sha256;
+
+ public Attachment(long attachmentId, String code, String name, String sha256) {
+
+ this.attachmentId = attachmentId;
+ this.code = code;
+ this.name = name;
+ this.sha256 = sha256;
+ }
+
+ public long getAttachmentId() {
+ return attachmentId;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getSha256() {
+ return sha256;
+ }
+}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/Command.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/Command.java
index a9c2d461..59ea660a 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/Command.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/Command.java
@@ -9,6 +9,10 @@ import it.mwg.sicilia.sue.api.v1.Status;
import it.mwg.sicilia.sue.api.v1.parameter.Parameter;
import it.mwg.sicilia.sue.model.Sportello;
import it.mwg.sicilia.sue.service.SportelloLocalServiceUtil;
+import it.tref.liferay.portos.bo.model.IntPratica;
+import it.tref.liferay.portos.bo.model.Territorio;
+import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
+import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -30,7 +34,7 @@ import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.servlet.HttpMethods;
import com.liferay.portal.kernel.util.ContentTypes;
-import com.liferay.portal.kernel.util.StringPool;
+import com.liferay.portal.kernel.util.MapUtil;
import com.liferay.portal.kernel.util.Validator;
public abstract class Command {
@@ -40,7 +44,7 @@ public abstract class Command {
@SuppressWarnings("serial")
protected static final List
BASE_OUTPUT_PARAMETERS = new ArrayList() {
{
- add(new Parameter(Parameters.STATUS_CODE, Parameter.TYPES.INTEGER, "Codice di stato"));
+ add(new Parameter(Parameters.STATUS_CODE, Parameter.TYPES.INT, "Codice di stato"));
add(new Parameter(Parameters.STATUS_MESSAGE, Parameter.TYPES.STRING, "Breve descrizione dello stato"));
}
};
@@ -59,7 +63,7 @@ public abstract class Command {
public Command(String description, String... methods) {
- this.verb = getCommandName();
+ this.verb = getCommandVerb();
this.methods = Arrays.asList(methods.length > 0 ? methods : defaultMethods);
this.description = description;
}
@@ -102,24 +106,18 @@ public abstract class Command {
return parameters;
}
- protected String getCommandName() {
- return getCommandName(getClass().getSimpleName());
+ protected String getCommandVerb() {
+ return getCommandVerb(getClass().getSimpleName());
}
- protected static String getCommandName(Class> clazz) {
- return getCommandName(clazz.getSimpleName());
+ protected static String getCommandVerb(Class> clazz) {
+ return getCommandVerb(clazz.getSimpleName());
}
- protected static String getCommandName(String simpleName) {
+ protected static String getCommandVerb(String simpleName) {
return simpleName.replaceAll("([A-Z])", "_$1").substring(1).toLowerCase();
}
- protected void setJson(HttpServletResponse response) {
-
- response.setContentType(ContentTypes.APPLICATION_JSON);
- response.setCharacterEncoding(StringPool.UTF8);
- }
-
protected void setTextPlain(HttpServletResponse response) {
response.setContentType(ContentTypes.TEXT_PLAIN_UTF8);
}
@@ -130,7 +128,6 @@ public abstract class Command {
protected boolean verifyAccessToken(HttpServletRequest request, HttpServletResponse response) throws IOException {
- setJson(response);
readParameters(request);
String token = (String) parameters.get(Parameters.TOKEN);
if (Validator.isNull(token)) {
@@ -166,4 +163,43 @@ public abstract class Command {
}
return sportello;
}
+
+ protected IntPratica getSecureIntPratica(HttpServletResponse response) throws IOException {
+
+ List additionalInfo = new ArrayList<>();
+ if (!parameters.containsKey(Parameters.APPLICATION_ID)) {
+ additionalInfo.add("Parametro " + Parameters.APPLICATION_ID + " mancante");
+ Response.write(response, Status.MALFORMED_REQUEST, additionalInfo);
+ return null;
+ }
+ long id = MapUtil.getLong(parameters, Parameters.APPLICATION_ID);
+ return getSecureIntPratica(response, id);
+ }
+
+ protected IntPratica getSecureIntPratica(HttpServletResponse response, long id) throws IOException {
+
+ List additionalInfo = new ArrayList<>();
+ IntPratica intPratica = null;
+ try {
+ intPratica = IntPraticaLocalServiceUtil.getIntPratica(id);
+ } catch (PortalException | SystemException e) {
+ additionalInfo.add("Istanza " + id + " non trovata");
+ Response.write(response, Status.INVALID_INPUT, additionalInfo);
+ return null;
+ }
+ try {
+ Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
+ if (territorio.getComuneId() != sportello.getComuneId() || !intPratica.isInLavorazioneSue()) {
+ additionalInfo.add("Permessi non sufficienti per l'istanza " + id);
+ Response.write(response, Status.INVALID_INPUT, additionalInfo);
+ return null;
+ }
+ } catch (PortalException | SystemException e) {
+ additionalInfo.add("Errore del server durante il caricamento dell'istanza");
+ Response.write(response, Status.INVALID_INPUT, additionalInfo);
+ return null;
+ }
+ return intPratica;
+ }
+
}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/CommandList.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/CommandList.java
index 9a3d3b30..6fab80d5 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/CommandList.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/CommandList.java
@@ -2,9 +2,12 @@ package it.mwg.sicilia.sue.api.v1.command;
import it.mwg.sicilia.sue.api.v1.command.impl.AddApplication;
import it.mwg.sicilia.sue.api.v1.command.impl.DeleteApplication;
+import it.mwg.sicilia.sue.api.v1.command.impl.DeleteAttachment;
import it.mwg.sicilia.sue.api.v1.command.impl.GetApplications;
+import it.mwg.sicilia.sue.api.v1.command.impl.GetAttachments;
+import it.mwg.sicilia.sue.api.v1.command.impl.GetSourceCode;
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.ListAttachments;
import it.mwg.sicilia.sue.api.v1.command.impl.ListFields;
import it.mwg.sicilia.sue.api.v1.command.impl.ListValues;
import it.mwg.sicilia.sue.api.v1.command.impl.Login;
@@ -12,16 +15,22 @@ 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.Nop;
import it.mwg.sicilia.sue.api.v1.command.impl.SetFields;
+import it.mwg.sicilia.sue.api.v1.command.impl.UploadAttachment;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
import com.liferay.portal.kernel.servlet.HttpMethods;
+import com.liferay.portal.kernel.util.StringPool;
public class CommandList {
+ private static final String NOP = "nop";
private static final Map commands = new LinkedHashMap<>();
+ private static final Set verbs = new TreeSet<>();
static {
// Manuali
addCommand(new Manual("Restituisce la documentazione dell'API generata automaticamente", HttpMethods.GET,
@@ -33,31 +42,45 @@ public class CommandList {
// Elenchi
addCommand(new ListApplications("Elenco delle istanze presentabili sul portale", HttpMethods.GET,
HttpMethods.POST));
- addCommand(new ListDocuments("Elenco dei documenti riconosciuti dal portale", HttpMethods.GET, HttpMethods.POST));
+ addCommand(new ListAttachments("Elenco dei documenti riconosciuti dal portale", HttpMethods.GET,
+ HttpMethods.POST));
addCommand(new ListFields("Elenco dei dati dell'istanza accettati dal portale", HttpMethods.GET,
HttpMethods.POST));
addCommand(new ListValues("Elenca i valori ammissibili per un campo a selezione obbligata"));
// Istanze
addCommand(new AddApplication(
"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 dei campi valorizzabili è fornito dal comando /"
- + Command.getCommandName(ListFields.class)));
addCommand(new GetApplications("Elenca le istanze in lavorazione da questo SUE", HttpMethods.GET,
HttpMethods.POST));
addCommand(new DeleteApplication("Elimina un'istanza"));
+ addCommand(new SetFields(
+ "Imposta i valori dei dati dell'istanza, l'elenco dei campi valorizzabili è fornito dal comando "
+ + Command.getCommandVerb(ListFields.class)));
+ // Allegati
+ addCommand(new UploadAttachment("Allega un documento all'istanza"));
+ addCommand(new GetAttachments("Elenca gli allegati dell'istanza"));
+ addCommand(new DeleteAttachment("Elimina un allegato"));
// Altro
addCommand(new Nop("NOP verifica la connettività senza eseguire operazioni", HttpMethods.GET, HttpMethods.POST));
+ addCommand(new GetSourceCode("Scarica il codice sorgente generato per il client", HttpMethods.GET,
+ HttpMethods.POST));
}
private static void addCommand(Command command) {
+
commands.put(command.getVerb(), command);
+ verbs.add(command.getVerb().isEmpty() ? NOP : command.getVerb());
}
public static Command get(String verb) {
- return commands.get(verb);
+ return commands.get(NOP.equals(verb) ? StringPool.BLANK : verb);
}
public static Collection getList() {
return commands.values();
}
+
+ public static Set getVerbs() {
+ return verbs;
+ }
}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/AddApplication.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/AddApplication.java
index f1142565..b79e3fdb 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/AddApplication.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/AddApplication.java
@@ -40,11 +40,11 @@ public class AddApplication extends Command {
@SuppressWarnings("serial")
private static final List INPUT_PARAMETERS = new ArrayList() {
{
- add(new Parameter(Parameters.VAT_ID, TYPES.STRING, "Codice fiscale del titolare digitale"));
+ add(new Parameter(Parameters.VATIN, TYPES.STRING, "Codice fiscale del titolare digitale"));
add(new Parameter(Parameters.FIRST_NAME, TYPES.STRING, "Nome del titolare digitale", false));
add(new Parameter(Parameters.LAST_NAME, TYPES.STRING, "Cognome del titolare digitale", false));
- add(new Parameter(Parameters.CODE, TYPES.STRING, "Codice del tipo di istanza, come restituito da /"
- + getCommandName(ListApplications.class)));
+ add(new Parameter(Parameters.CODE, TYPES.STRING, "Codice del tipo di istanza, come restituito dal comando "
+ + getCommandVerb(ListApplications.class)));
add(new Parameter(Parameters.SUE_ID, TYPES.STRING, "Estremi pratica SUE/SUAP", false));
}
};
@@ -53,7 +53,7 @@ public class AddApplication extends Command {
private static final List OUTPUT_PARAMETERS = new ArrayList() {
{
addAll(BASE_OUTPUT_PARAMETERS);
- add(new Parameter(Parameters.APPLICATION_ID, TYPES.INTEGER,
+ add(new Parameter(Parameters.APPLICATION_ID, TYPES.INT,
"Identificatore del procedimento creato, da utilizzare nelle successive operazioni"));
add(new Parameter(Parameters.ADDITIONAL_INFO, TYPES.STRING,
"Eventuali informazioni aggiuntive sull'operazione o sugli errori incontrati", false));
@@ -69,9 +69,9 @@ public class AddApplication extends Command {
if (verifyAccessToken(request, response)) {
List additionalInfo = new ArrayList<>();
- String screenName = MapUtil.getString(parameters, Parameters.VAT_ID);
+ String screenName = MapUtil.getString(parameters, Parameters.VATIN);
if (Validator.isNull(screenName)) {
- additionalInfo.add("Parametro " + Parameters.VAT_ID + " mancante");
+ additionalInfo.add("Parametro " + Parameters.VATIN + " mancante");
Response.write(response, Status.MALFORMED_REQUEST, additionalInfo);
return;
}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/DeleteApplication.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/DeleteApplication.java
index 6fc0fd33..149c56bd 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/DeleteApplication.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/DeleteApplication.java
@@ -7,9 +7,7 @@ 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.IntPratica;
-import it.tref.liferay.portos.bo.model.Territorio;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
-import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil;
import java.util.ArrayList;
import java.util.List;
@@ -17,16 +15,14 @@ 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.util.MapUtil;
+import com.liferay.portal.kernel.util.Validator;
public class DeleteApplication extends Command {
@SuppressWarnings("serial")
private static final List INPUT_PARAMETERS = new ArrayList() {
{
- add(new Parameter(Parameters.APPLICATION_ID, TYPES.INTEGER, "Id dell'istanza"));
+ add(new Parameter(Parameters.APPLICATION_ID, TYPES.INT, "Id dell'istanza"));
}
};
@@ -47,35 +43,11 @@ public class DeleteApplication extends Command {
public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
if (verifyAccessToken(request, response)) {
- List additionalInfo = new ArrayList();
- if (!parameters.containsKey(Parameters.APPLICATION_ID)) {
- additionalInfo.add("Parametro " + Parameters.APPLICATION_ID + " mancante");
- Response.write(response, Status.MALFORMED_REQUEST, additionalInfo);
- return;
+ IntPratica intPratica = getSecureIntPratica(response);
+ if (Validator.isNotNull(intPratica)) {
+ IntPraticaLocalServiceUtil.deleteIntPratica(intPratica, true);
+ Response.write(response, Status.OK);
}
- long applicationId = MapUtil.getLong(parameters, Parameters.APPLICATION_ID);
- IntPratica intPratica = null;
- try {
- intPratica = IntPraticaLocalServiceUtil.getIntPratica(applicationId);
- } catch (PortalException | SystemException e) {
- additionalInfo.add("Istanza " + applicationId + " non trovata");
- Response.write(response, Status.INVALID_INPUT, additionalInfo);
- return;
- }
- try {
- Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
- if (territorio.getComuneId() != sportello.getComuneId() || !intPratica.isInLavorazioneSue()) {
- additionalInfo.add("Istanza " + applicationId + " non modificabile");
- Response.write(response, Status.INVALID_INPUT, additionalInfo);
- return;
- }
- } catch (PortalException | SystemException e) {
- additionalInfo.add("Errore del server durante il caricamento dell'istanza");
- Response.write(response, Status.INVALID_INPUT, additionalInfo);
- return;
- }
- IntPraticaLocalServiceUtil.deleteIntPratica(intPratica, true);
- Response.write(response, Status.OK);
}
}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/DeleteAttachment.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/DeleteAttachment.java
new file mode 100644
index 00000000..2b714ca1
--- /dev/null
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/DeleteAttachment.java
@@ -0,0 +1,86 @@
+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.DocPratica;
+import it.tref.liferay.portos.bo.model.IntPratica;
+import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.liferay.portal.kernel.util.MapUtil;
+import com.liferay.portal.kernel.util.Validator;
+
+public class DeleteAttachment extends Command {
+
+ @SuppressWarnings("serial")
+ private static final List INPUT_PARAMETERS = new ArrayList() {
+ {
+ add(new Parameter(Parameters.APPLICATION_ID, TYPES.INT, "Id dell'istanza"));
+ add(new Parameter(Parameters.ATTACHMENT_ID, TYPES.INT, "Id dell'allegato"));
+ }
+ };
+
+ @SuppressWarnings("serial")
+ private static final List OUTPUT_PARAMETERS = new ArrayList() {
+ {
+ addAll(BASE_OUTPUT_PARAMETERS);
+ add(new Parameter(Parameters.ADDITIONAL_INFO, TYPES.STRING,
+ "Eventuali informazioni aggiuntive sull'operazione o sugli errori incontrati", false));
+ }
+ };
+
+ public DeleteAttachment(String description, String... methods) {
+ super(description, methods);
+ }
+
+ @Override
+ public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ if (verifyAccessToken(request, response)) {
+ List additionalInfo = new ArrayList<>();
+ try {
+ if (!parameters.containsKey(Parameters.ATTACHMENT_ID)) {
+ additionalInfo.add("Parametro " + Parameters.ATTACHMENT_ID + " mancante");
+ Response.write(response, Status.MALFORMED_REQUEST, additionalInfo);
+ return;
+ }
+ IntPratica intPratica = getSecureIntPratica(response);
+ if (Validator.isNotNull(intPratica)) {
+ long attachmentId = MapUtil.getLong(parameters, Parameters.ATTACHMENT_ID);
+ DocPratica docPratica = DocPraticaLocalServiceUtil.getDocPratica(attachmentId);
+ if (intPratica.getIntPraticaId() != docPratica.getIntPraticaId()) {
+ additionalInfo.add("L'allegato " + attachmentId + " non appartiene all'istanza "
+ + intPratica.getIntPraticaId());
+ Response.write(response, Status.INVALID_INPUT, additionalInfo);
+ return;
+ }
+ DocPraticaLocalServiceUtil.deleteDocPratica(docPratica);
+ Response.write(response, Status.OK, additionalInfo);
+ }
+ } catch (Exception e) {
+ additionalInfo.add("Errore durante l'esecuzione: " + e.getMessage());
+ Response.write(response, Status.SERVER_ERROR, additionalInfo);
+ }
+ }
+ }
+
+ @Override
+ public List getInputParameters() {
+ return INPUT_PARAMETERS;
+ }
+
+ @Override
+ public List getOutputParameters() {
+ return OUTPUT_PARAMETERS;
+ }
+
+}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetApplications.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetApplications.java
index 5e75c037..b74ab5bb 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetApplications.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetApplications.java
@@ -29,9 +29,9 @@ public class GetApplications extends Command {
static {
OUTPUT_PARAMETERS.addAll(BASE_OUTPUT_PARAMETERS);
Parameter p = new Parameter(Parameters.APPLICATIONS, TYPES.ARRAY, "Elenco di istanze presentate");
- p.addSubParameter(new Parameter(Parameters.APPLICATION_ID, TYPES.INTEGER, "Identificatore dell'istanza"));
- p.addSubParameter(new Parameter(Parameters.CODE, TYPES.STRING, "Tipo dell'istanza"));
- p.addSubParameter(new Parameter(Parameters.VAT_ID, TYPES.STRING, "Codice fiscale del titolare digitale"));
+ p.addSubParameter(new Parameter(Parameters.APPLICATION_ID, TYPES.INT, "Identificatore dell'istanza"));
+ p.addSubParameter(new Parameter(Parameters.CODE, TYPES.STRING, "Codice dell'istanza"));
+ p.addSubParameter(new Parameter(Parameters.VATIN, TYPES.STRING, "Codice fiscale del titolare digitale"));
OUTPUT_PARAMETERS.add(p);
};
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetAttachments.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetAttachments.java
new file mode 100644
index 00000000..8653c2e7
--- /dev/null
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetAttachments.java
@@ -0,0 +1,83 @@
+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.bean.Attachment;
+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.DocPratica;
+import it.tref.liferay.portos.bo.model.IntPratica;
+import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.liferay.portal.kernel.util.Validator;
+
+public class GetAttachments extends Command {
+
+ @SuppressWarnings("serial")
+ private static final List INPUT_PARAMETERS = new ArrayList() {
+ {
+ add(new Parameter(Parameters.APPLICATION_ID, TYPES.INT, "Id dell'istanza"));
+ }
+ };
+
+ private static final List OUTPUT_PARAMETERS = new ArrayList();
+ static {
+ OUTPUT_PARAMETERS.addAll(BASE_OUTPUT_PARAMETERS);
+ Parameter p = new Parameter(Parameters.ATTACHMENTS, TYPES.ARRAY, "Elenco di allegati dell'istanza");
+ p.addSubParameter(new Parameter(Parameters.APPLICATION_ID, TYPES.INT, "Identificatore dell'allegato"));
+ p.addSubParameter(new Parameter(Parameters.CODE, TYPES.STRING, "Codice dell'allegato"));
+ p.addSubParameter(new Parameter(Parameters.SHA256, TYPES.STRING, "Hash SHA256 dell'allegato"));
+ OUTPUT_PARAMETERS.add(p);
+ };
+
+ public GetAttachments(String description, String... methods) {
+ super(description, methods);
+ }
+
+ @Override
+ public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ if (verifyAccessToken(request, response)) {
+ IntPratica intPratica = getSecureIntPratica(response);
+ if (Validator.isNotNull(intPratica)) {
+ try {
+ List attachments = new ArrayList<>();
+ for (DocPratica docPratica : DocPraticaLocalServiceUtil.getValidByIntPratica(intPratica
+ .getIntPraticaId())) {
+ attachments.add(new Attachment(docPratica.getDocPraticaId(), docPratica.getTipologia(),
+ docPratica.getDescLong(), docPratica.getSha256()));
+ }
+ Map result = new HashMap<>();
+ result.put(Parameters.ATTACHMENTS, (Serializable) attachments);
+ Response.write(response, Status.OK, result);
+ } catch (Exception e) {
+ List additionalInfo = new ArrayList<>();
+ additionalInfo.add("Errore durante l'esecuzione: " + e.getMessage());
+ Response.write(response, Status.SERVER_ERROR, additionalInfo);
+ return;
+ }
+ }
+ }
+ }
+
+ @Override
+ public List getInputParameters() {
+ return INPUT_PARAMETERS;
+ }
+
+ @Override
+ public List getOutputParameters() {
+ return OUTPUT_PARAMETERS;
+ }
+}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetSourceCode.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetSourceCode.java
new file mode 100644
index 00000000..9fb588fd
--- /dev/null
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/GetSourceCode.java
@@ -0,0 +1,409 @@
+package it.mwg.sicilia.sue.api.v1.command.impl;
+
+import it.mwg.sicilia.sue.api.v1.Parameters;
+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.CommandList;
+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.util.ApiUtil;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.net.URI;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.FileUtils;
+
+import com.liferay.portal.kernel.servlet.HttpHeaders;
+import com.liferay.portal.kernel.servlet.ServletResponseUtil;
+import com.liferay.portal.kernel.util.ContentTypes;
+import com.liferay.portal.kernel.util.StringPool;
+import com.liferay.portal.kernel.zip.ZipWriter;
+import com.liferay.portal.kernel.zip.ZipWriterFactoryUtil;
+
+public class GetSourceCode extends Command {
+
+ private static final String INDENT = StringPool.FOUR_SPACES;
+
+ @SuppressWarnings("serial")
+ private static final List OUTPUT_PARAMETERS = new ArrayList() {
+ {
+ add(new Parameter(StringPool.BLANK, TYPES.APPLICATION_ZIP, "Il codice sorgente PHP generato per il client"));
+ }
+ };
+
+ private static Map PARAMETER_NAMES = new HashMap();
+ static {
+ for (Field field : Arrays.asList(Parameters.class.getDeclaredFields())) {
+ int mod = field.getModifiers();
+ if (Modifier.isPublic(mod) && Modifier.isStatic(mod) && Modifier.isFinal(mod)) {
+ try {
+ PARAMETER_NAMES.put((String) field.get(Parameters.class), field.getName());
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ }
+ }
+ }
+ }
+
+ public GetSourceCode(String description, String... methods) {
+ super(description, methods);
+ }
+
+ @Override
+ public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ ServletContext servletContext = request.getServletContext();
+ String regex = "(\\s*)\\/\\/\\{\\{([^}]*)\\}\\}\\/\\/(.*)";
+ Pattern pattern = Pattern.compile(regex);
+ File sourcePath = new File(servletContext.getRealPath("/WEB-INF/src/resource/client/php"));
+ URI sourceUri = sourcePath.toURI();
+ ZipWriter zipWriter = ZipWriterFactoryUtil.getZipWriter();
+ for (File inputFile : FileUtils.listFiles(sourcePath, null, true)) {
+ BufferedReader reader = new BufferedReader(new FileReader(inputFile));
+ StringBuilder output = new StringBuilder();
+ for (String line = reader.readLine(); null != line; line = reader.readLine()) {
+ Matcher matcher = pattern.matcher(line);
+ if (matcher.matches()) {
+ switch (matcher.group(2)) {
+ case "CLIENT_FUNCTIONS":
+ line = line.replaceAll(regex, getClientFunctions(matcher.group(1)) + "$3");
+ break;
+ case "COMMANDS":
+ line = line.replaceAll(regex, getCommands(matcher.group(1)) + "$3");
+ break;
+ case "HELP_ARRAY":
+ line = line.replaceAll(regex, getHelpArray(matcher.group(1)) + "$3");
+ break;
+ case "METHODS":
+ line = line.replaceAll(regex, getMethods(matcher.group(1)) + "$3");
+ break;
+ case "PARAMETERS":
+ line = line.replaceAll(regex, getParameters(matcher.group(1)) + "$3");
+ break;
+ case "STATUSES":
+ line = line.replaceAll(regex, getStatuses(matcher.group(1)) + "$3");
+ break;
+ default:
+ System.out.println("################# Unknown match //{{" + matcher.group(2) + "}}//");
+ }
+ }
+ output.append(line).append(StringPool.NEW_LINE);
+ }
+ reader.close();
+ String fileName = sourceUri.relativize(inputFile.toURI()).getPath();
+ zipWriter.addEntry(fileName, output);
+ }
+ byte[] bytes = Files.readAllBytes(zipWriter.getFile().toPath());
+ response.setContentType(ContentTypes.APPLICATION_ZIP);
+ response.addHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"sourceCode.zip\"");
+ response.setContentLength(bytes.length);
+ ServletResponseUtil.write(response, bytes);
+ }
+
+ private static String getClientFunctions(String prefix) {
+
+ StringBuilder sb = new StringBuilder();
+ for (String verb : CommandList.getVerbs()) {
+ if (!verb.equals("login")) {
+ Command command = CommandList.get(verb);
+ sb.append(prefix).append("case '").append(verb).append("':\n");
+ List parameters = command.getInputParameters();
+ int nRequired = 0;
+ for (Parameter parameter : parameters) {
+ if (parameter.isRequired()) {
+ nRequired++;
+ }
+ }
+ if (nRequired > 0) {
+ sb.append(prefix).append(INDENT).append("if (\\$argc < ").append(nRequired + 2).append(") {\n");
+ sb.append(prefix).append(INDENT).append(INDENT)
+ .append("echo(\"Numero di argomenti insufficiente.\\\\n\\\\n\");\n");
+ sb.append(prefix).append(INDENT).append(INDENT).append("die(\\$api->getHelp(\\$argv[1]));\n");
+ sb.append(prefix).append(INDENT).append("}\n");
+ }
+ if (command.isSecure()) {
+ sb.append(prefix).append(INDENT).append("\\$api->login();\n");
+ }
+ sb.append(prefix).append(INDENT).append("\\$val = \\$api->")
+ .append(ApiUtil.underscoreToCamelCase(verb)).append(StringPool.OPEN_PARENTHESIS);
+ if (parameters.size() > 0) {
+ for (int i = 0; i < nRequired; i++) {
+ sb.append("\\$argv[").append(i + 2).append("], ");
+ }
+ for (int i = nRequired; i < parameters.size(); i++) {
+ sb.append("\\$argv[").append(i + 2).append("] ?? null, ");
+ }
+ sb.setLength(sb.length() - 2);
+ }
+ sb.append(");\n");
+ sb.append(prefix).append(INDENT);
+ Parameter parameter = command.getOutputParameters().get(0);
+ switch (parameter.getType()) {
+ case TEXT_HTML:
+ case TEXT_PLAIN:
+ sb.append("echo \\$val;\n");
+ break;
+ case APPLICATION_ZIP:
+ sb.append("\\$n = 1;\n");
+ sb.append(prefix).append(INDENT).append("while (file_exists(\\$file = \"data\\$n.zip\")) {\n");
+ sb.append(prefix).append(INDENT).append(INDENT).append("\\$n++;\n");
+ sb.append(prefix).append(INDENT).append("}\n");
+ sb.append(prefix).append(INDENT).append("file_put_contents(\\$file, \\$val);\n");
+ sb.append(prefix).append(INDENT).append("echo \"Salvato file \\$file\\\\n\";\n");
+ break;
+ default:
+ sb.append("print_r(\\$val);\n");
+ }
+ sb.append(prefix).append(INDENT).append("break;\n");
+ }
+ }
+ sb.setLength(sb.length() - 1);
+ return sb.toString();
+ }
+
+ private static String getHelpArray(String prefix) {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append(prefix).append("'' => [\n");
+ for (Command command : CommandList.getList()) {
+ if (!command.getVerb().equals("login")) {
+ sb.append(prefix).append(INDENT).append(StringPool.APOSTROPHE);
+ if (command.isSecure()) {
+ sb.append(StringPool.STAR);
+ }
+ sb.append(command.getVerb().isEmpty() ? "nop" : command.getVerb()).append(": ")
+ .append(command.getDescription().replace(StringPool.APOSTROPHE, "\\\\'")).append("',\n");
+ }
+ }
+ sb.append(prefix).append(INDENT).append("'',\n");
+ sb.append(prefix).append(INDENT).append("'* = richiede nome utente e password',\n");
+ sb.append(prefix).append("],\n");
+ for (String verb : CommandList.getVerbs()) {
+ if (!verb.equals("login")) {
+ Command command = CommandList.get(verb);
+ sb.append(prefix).append(StringPool.APOSTROPHE).append(verb).append("' => [\n");
+ sb.append(prefix).append(INDENT).append("\"Uso: php {\\$argv[0]} ").append(verb);
+ for (Parameter parameter : command.getInputParameters()) {
+ if (parameter.isRequired()) {
+ sb.append(" <").append(parameter.getName()).append(StringPool.GREATER_THAN);
+ }
+ }
+ for (Parameter parameter : command.getInputParameters()) {
+ if (!parameter.isRequired()) {
+ sb.append(" [").append(parameter.getName()).append(StringPool.CLOSE_BRACKET);
+ }
+ }
+ sb.append("\",\n");
+ sb.append(prefix).append(INDENT).append(StringPool.APOSTROPHE)
+ .append(command.getDescription().replace(StringPool.APOSTROPHE, "\\\\'")).append("',\n");
+ if (command.getInputParameters().size() > 0) {
+ sb.append(prefix).append(INDENT).append("'',\n");
+ boolean hasRequired = false;
+ for (Parameter parameter : command.getInputParameters()) {
+ if (parameter.isRequired()) {
+ sb.append(prefix).append(INDENT).append("'**").append(parameter.getName())
+ .append(": ")
+ .append(parameter.getDescription().replace(StringPool.APOSTROPHE, "\\\\'"))
+ .append("',\n");
+ hasRequired = true;
+ }
+ }
+ for (Parameter parameter : command.getInputParameters()) {
+ if (!parameter.isRequired()) {
+ sb.append(prefix).append(INDENT).append(StringPool.APOSTROPHE).append(parameter.getName())
+ .append(": ")
+ .append(parameter.getDescription().replace(StringPool.APOSTROPHE, "\\\\'"))
+ .append("',\n");
+ }
+ }
+ if (hasRequired) {
+ sb.append(prefix).append(INDENT).append("'',\n");
+ sb.append(prefix).append(INDENT).append("'** = parametro obbligatorio',\n");
+ }
+ }
+ sb.append(prefix).append("],\n");
+ }
+ }
+ sb.setLength(sb.length() - 1);
+ return sb.toString();
+ }
+
+ private static String getCommands(String prefix) {
+
+ StringBuilder sb = new StringBuilder();
+ for (String verb : CommandList.getVerbs()) {
+ if (sb.length() > 0) {
+ sb.append(StringPool.NEW_LINE);
+ }
+ Command command = CommandList.get(verb);
+ sb.append(prefix).append("public const ").append(verb.toUpperCase()).append(" = '")
+ .append(command.getVerb()).append("';");
+ }
+ return sb.toString();
+ }
+
+ private static String getMethods(String prefix) {
+
+ StringBuilder sb = new StringBuilder();
+ for (String verb : CommandList.getVerbs()) {
+ if (!verb.equals("login")) {
+ sb.append(getMethod(verb, prefix)).append(StringPool.NEW_LINE);
+ }
+ }
+ sb.setLength(sb.length() - 1);
+ return sb.toString();
+ }
+
+ private static String getMethod(String verb, String prefix) {
+
+ StringBuilder sb = new StringBuilder();
+ String name = ApiUtil.underscoreToCamelCase(verb);
+ Command command = CommandList.get(verb);
+ sb.append(prefix).append("/*\n").append(prefix).append(" * ").append(command.getDescription())
+ .append(StringPool.NEW_LINE).append(prefix).append(" */\n");
+ List parameters = command.getInputParameters();
+ sb.append(prefix).append("public function ").append(name).append(StringPool.OPEN_PARENTHESIS)
+ .append(functionParameters(parameters)).append(")\n");
+ sb.append(prefix).append("{\n");
+ if (parameters.size() > 0) {
+ boolean allRequired = true;
+ for (Parameter parameter : parameters) {
+ if (!parameter.isRequired()) {
+ allRequired = false;
+ break;
+ }
+ }
+ if (allRequired) {
+ sb.append(prefix).append(INDENT).append("return \\$this->exec(Commands::").append(verb.toUpperCase())
+ .append(", [\n");
+ for (Parameter parameter : parameters) {
+ sb.append(prefix).append(INDENT).append(INDENT).append("Parameters::")
+ .append(PARAMETER_NAMES.get(parameter.getName())).append(" => \\$")
+ .append(parameter.getName()).append(",\n");
+ }
+ sb.append(prefix).append(INDENT).append(StringPool.CLOSE_BRACKET);
+ if (!command.isSecure()) {
+ sb.append(", false");
+ }
+ sb.append(");\n");
+ } else {
+ sb.append(prefix).append(INDENT).append("\\$data = [\n");
+ for (Parameter parameter : parameters) {
+ if (parameter.isRequired()) {
+ sb.append(prefix).append(INDENT).append(INDENT).append("Parameters::")
+ .append(PARAMETER_NAMES.get(parameter.getName())).append(" => \\$")
+ .append(parameter.getName()).append(",\n");
+ }
+ }
+ sb.append(prefix).append(INDENT).append("];\n");
+ for (Parameter parameter : parameters) {
+ if (!parameter.isRequired()) {
+ sb.append(prefix).append(INDENT).append("if (null !== \\$").append(parameter.getName())
+ .append(") {\n");
+ sb.append(prefix).append(INDENT).append(INDENT).append("\\$data[Parameters::")
+ .append(PARAMETER_NAMES.get(parameter.getName())).append("] = \\$")
+ .append(parameter.getName()).append(";\n");
+ sb.append(prefix).append(INDENT).append("}\n");
+ }
+ }
+ sb.append(prefix).append(INDENT).append("return \\$this->exec(Commands::").append(verb.toUpperCase())
+ .append(", \\$data");
+ if (!command.isSecure()) {
+ sb.append(", false");
+ }
+ sb.append(");\n");
+ }
+ } else {
+ sb.append(prefix).append(INDENT).append("return \\$this->exec(Commands::").append(verb.toUpperCase());
+ if (!command.isSecure()) {
+ sb.append(", null, false");
+ }
+ sb.append(");\n");
+ }
+ sb.append(prefix).append("}\n");
+ return sb.toString();
+ }
+
+ private static String functionParameters(List parameters) {
+
+ StringBuilder sb = new StringBuilder();
+ if (parameters.size() > 0) {
+ for (Parameter parameter : parameters) {
+ if (parameter.isRequired()) {
+ sb.append(parameter.getType().toString().toLowerCase()).append(" \\$").append(parameter.getName())
+ .append(StringPool.COMMA_AND_SPACE);
+ }
+ }
+ for (Parameter parameter : parameters) {
+ if (!parameter.isRequired()) {
+ sb.append(StringPool.QUESTION).append(parameter.getType().toString().toLowerCase()).append(" \\$")
+ .append(parameter.getName()).append(" = null, ");
+ }
+ }
+ sb.setLength(sb.length() - 2);
+ }
+ return sb.toString();
+ }
+
+ private static String getParameters(String prefix) throws IllegalArgumentException, IllegalAccessException {
+ return dumpConstants(Parameters.class, prefix);
+ }
+
+ private static String getStatuses(String prefix) throws IllegalArgumentException, IllegalAccessException {
+ return dumpConstants(Status.class, prefix);
+ }
+
+ private static String dumpConstants(Class> clazz, String prefix) throws IllegalArgumentException,
+ IllegalAccessException {
+
+ StringBuilder sb = new StringBuilder();
+ for (Field field : Arrays.asList(clazz.getDeclaredFields())) {
+ int mod = field.getModifiers();
+ if (Modifier.isPublic(mod) && Modifier.isStatic(mod) && Modifier.isFinal(mod)) {
+ if (sb.length() > 0) {
+ sb.append(StringPool.NEW_LINE);
+ }
+ sb.append(prefix).append("public const ").append(field.getName()).append(" = ");
+ if (String.class.equals(field.getType())) {
+ sb.append(StringPool.APOSTROPHE)
+ .append(((String) field.get(clazz)).replace(StringPool.APOSTROPHE, "\\\\'"))
+ .append(StringPool.APOSTROPHE);
+ } else {
+ sb.append(field.get(clazz));
+ }
+ sb.append(StringPool.SEMICOLON);
+ }
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public List getInputParameters() {
+ return EMPTY_PARAMETERS;
+ }
+
+ @Override
+ public List getOutputParameters() {
+ return OUTPUT_PARAMETERS;
+ }
+
+ @Override
+ public boolean isSecure() {
+ return false;
+ }
+}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListApplications.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListApplications.java
index 01a2bf1e..e8fd652c 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListApplications.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListApplications.java
@@ -24,7 +24,7 @@ public class ListApplications extends Command {
private static final List OUTPUT_PARAMETERS = new ArrayList<>();
static {
OUTPUT_PARAMETERS.addAll(BASE_OUTPUT_PARAMETERS);
- Parameter p = new Parameter(Parameters.DOCUMENTS, TYPES.ARRAY, "Elenco di istanze presentabili");
+ Parameter p = new Parameter(Parameters.APPLICATIONS, TYPES.ARRAY, "Elenco di istanze presentabili");
p.addSubParameter(new Parameter(Parameters.CODE, TYPES.STRING, "Codice del tipo di istanza"));
p.addSubParameter(new Parameter(Parameters.DESCRIPTION, TYPES.STRING, "Descrizione dell'istanza"));
OUTPUT_PARAMETERS.add(p);
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListDocuments.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListAttachments.java
similarity index 87%
rename from liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListDocuments.java
rename to liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListAttachments.java
index be46c732..8ca83c40 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListDocuments.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListAttachments.java
@@ -19,18 +19,18 @@ import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-public class ListDocuments extends Command {
+public class ListAttachments extends Command {
private static final List OUTPUT_PARAMETERS = new ArrayList<>();
static {
OUTPUT_PARAMETERS.addAll(BASE_OUTPUT_PARAMETERS);
- Parameter p = new Parameter(Parameters.DOCUMENTS, TYPES.ARRAY, "Elenco di documenti");
+ Parameter p = new Parameter(Parameters.ATTACHMENTS, TYPES.ARRAY, "Elenco di documenti");
p.addSubParameter(new Parameter(Parameters.CODE, TYPES.STRING, "Codice del documento"));
p.addSubParameter(new Parameter(Parameters.DESCRIPTION, TYPES.STRING, "Descrizione del documento"));
OUTPUT_PARAMETERS.add(p);
};
- public ListDocuments(String description, String... methods) {
+ public ListAttachments(String description, String... methods) {
super(description, methods);
}
@@ -43,7 +43,7 @@ public class ListDocuments extends Command {
list.add(new ListItem(entry.getKey(), entry.getValue()));
}
Map result = new HashMap<>();
- result.put(Parameters.DOCUMENTS, (Serializable) list);
+ result.put(Parameters.ATTACHMENTS, (Serializable) list);
Response.write(response, Status.OK, result);
}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListFields.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListFields.java
index 624666ac..25123341 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListFields.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListFields.java
@@ -35,7 +35,7 @@ public class ListFields extends Command {
p.addSubParameter(new Parameter(Parameters.NAME, TYPES.STRING, "Nome 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 + ", "
- + TYPES.INTEGER + ", ecc.)"));
+ + TYPES.INT + ", ecc.)"));
p.addSubParameter(new Parameter(Parameters.NULLABLE, TYPES.BOOLEAN,
"Se true il campo può essere impostato al valore NULL"));
OUTPUT_PARAMETERS.add(p);
@@ -76,7 +76,7 @@ public class ListFields extends Command {
break;
case "destinazione":
description = "Codice della destinazione d'uso, l'elenco è fornito dal comando /"
- + getCommandName(ListUses.class);
+ + getCommandVerb(ListValues.class);
break;
case "destinazioneAltroIntervento":
description += " diventa obbligatorio quando destinazione = 3";
@@ -100,7 +100,7 @@ public class ListFields extends Command {
case Types.BIGINT:
case Types.INTEGER:
case Types.TIMESTAMP:
- type = TYPES.INTEGER;
+ type = TYPES.INT;
break;
case Types.BOOLEAN:
type = TYPES.BOOLEAN;
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListUses.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListUses.java
deleted file mode 100644
index 12fc5594..00000000
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ListUses.java
+++ /dev/null
@@ -1,57 +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.mwg.sicilia.sue.api.v1.util.DettPraticaUtil;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class ListUses extends Command {
-
- private static final List OUTPUT_PARAMETERS = new ArrayList<>();
- static {
- OUTPUT_PARAMETERS.addAll(BASE_OUTPUT_PARAMETERS);
- Parameter p = new Parameter(Parameters.USES, TYPES.ARRAY, "Elenco di destinazioni d'uso");
- p.addSubParameter(new Parameter(Parameters.CODE, TYPES.STRING, "Codice della destinazione d'uso"));
- p.addSubParameter(new Parameter(Parameters.DESCRIPTION, TYPES.STRING, "Descrizione della destinazione d'uso"));
- OUTPUT_PARAMETERS.add(p);
- };
-
- public ListUses(String description, String... methods) {
- super(description, methods);
- }
-
- @Override
- public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
-
- Map result = new HashMap<>();
- result.put(Parameters.USES, (Serializable) DettPraticaUtil.getUses());
- Response.write(response, Status.OK, result);
- }
-
- @Override
- public List getInputParameters() {
- return EMPTY_PARAMETERS;
- }
-
- @Override
- public List getOutputParameters() {
- return OUTPUT_PARAMETERS;
- }
-
- @Override
- public boolean isSecure() {
- return false;
- }
-}
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Login.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Login.java
index 1047410c..a9d50456 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Login.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Login.java
@@ -47,11 +47,10 @@ public class Login extends Command {
@Override
public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
- setJson(response);
readParameters(request);
String userName = (String) parameters.get(Parameters.USERNAME);
String password = (String) parameters.get(Parameters.PASSWORD);
- if (Validator.isNull(userName) || Validator.isNull(password)) {
+ if ((null == userName) || (null == password)) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
} else {
Sportello sportello = null;
diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Manual.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Manual.java
index 936e2a43..0fd271b5 100644
--- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Manual.java
+++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/Manual.java
@@ -22,6 +22,7 @@ import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONSerializer;
import com.liferay.portal.kernel.servlet.HttpMethods;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
+import com.liferay.portal.kernel.util.Base64;
import com.liferay.portal.kernel.util.Http;
import com.liferay.portal.kernel.util.StringPool;
@@ -120,35 +121,18 @@ public class Manual extends Command {
sb.append("--request POST \\\n").append(prefix).append(StringPool.TAB);
Map data = new LinkedHashMap<>();
for (Parameter parameter : command.getInputParameters()) {
- if (parameter.getType().equals(TYPES.STRING)) {
- String value = parameter.getName().substring(0, 1).toUpperCase() + parameter.getName().substring(1);
- value = value.replaceAll("([A-Z])", " $1").substring(1);
- data.put(parameter.getName(), value);
- } else if (parameter.getType().equals(TYPES.INTEGER)) {
- data.put(parameter.getName(), 123456);
- } else if (parameter.getType().equals(TYPES.BOOLEAN)) {
- data.put(parameter.getName(), true);
- } else if (parameter.getType().equals(TYPES.ARRAY)) {
+ if (parameter.getType().equals(TYPES.ARRAY)) {
List