From ee50a66b8b1ce1be689bade03c5a7bd2e88abd8c Mon Sep 17 00:00:00 2001 From: Salvatore La Manna Date: Thu, 24 Jun 2021 16:27:25 +0200 Subject: [PATCH] Set fields --- .../bo/service/DettPraticaLocalService.java | 14 +- .../service/DettPraticaLocalServiceClp.java | 150 +++++++++--------- .../service/DettPraticaLocalServiceUtil.java | 20 +-- .../DettPraticaLocalServiceWrapper.java | 24 +-- .../it/mwg/sismica/bo/util/DomandaUtil.java | 2 +- .../DettPraticaLocalServiceClpInvoker.java | 80 +++++----- .../impl/DettPraticaLocalServiceImpl.java | 14 +- .../docroot/WEB-INF/src/service.properties | 4 +- .../it/mwg/sicilia/sue/api/v1/Parameters.java | 1 + .../sue/api/v1/command/CommandList.java | 8 +- .../v1/command/impl/DeleteApplication.java | 2 +- .../api/v1/command/impl/GetApplications.java | 2 +- .../api/v1/command/impl/ListApplications.java | 2 +- .../api/v1/command/impl/ListDocuments.java | 2 +- .../sue/api/v1/command/impl/ListFields.java | 32 ++-- .../sue/api/v1/command/impl/ListUses.java | 4 +- .../sue/api/v1/command/impl/SetFields.java | 123 ++++++++++++++ .../sue/api/v1/command/impl/SetUse.java | 59 ++++++- .../sue/api/v1/parameter/Parameter.java | 2 +- 19 files changed, 365 insertions(+), 180 deletions(-) create mode 100644 liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/SetFields.java diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalService.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalService.java index c20af65b..6540879c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalService.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalService.java @@ -931,12 +931,6 @@ public interface DettPraticaLocalService extends BaseLocalService, throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException; - @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) - public java.util.List getDettPraticaFields(); - - @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) - public java.util.Map getDettPraticaFieldsTypes(); - @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public java.util.List getVersioni( long intPraticaId) @@ -961,5 +955,11 @@ public interface DettPraticaLocalService extends BaseLocalService, throws com.liferay.portal.kernel.exception.SystemException; @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) - public java.util.Map getDestinazioniuso(); + public java.util.Map getDestinazioniUso(); + + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public java.util.List getDettPraticaFields(); + + @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + public java.util.Map getDettPraticaFieldsTypes(); } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceClp.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceClp.java index c05c3d84..f47084a3 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceClp.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceClp.java @@ -511,41 +511,41 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { "long", "java.lang.String", "java.lang.String" }; - _methodName74 = "getDettPraticaFields"; + _methodName74 = "getVersioni"; - _methodParameterTypes74 = new String[] { }; + _methodParameterTypes74 = new String[] { "long" }; - _methodName75 = "getDettPraticaFieldsTypes"; + _methodName75 = "callForChanges"; - _methodParameterTypes75 = new String[] { }; + _methodParameterTypes75 = new String[] { "long" }; - _methodName76 = "getVersioni"; + _methodName76 = "isNumber"; - _methodParameterTypes76 = new String[] { "long" }; + _methodParameterTypes76 = new String[] { "java.lang.String" }; - _methodName77 = "callForChanges"; + _methodName77 = "format"; - _methodParameterTypes77 = new String[] { "long" }; + _methodParameterTypes77 = new String[] { + "java.lang.String", "java.io.Serializable" + }; - _methodName78 = "isNumber"; + _methodName78 = "countVariateByIntPratica"; - _methodParameterTypes78 = new String[] { "java.lang.String" }; + _methodParameterTypes78 = new String[] { "long" }; - _methodName79 = "format"; + _methodName79 = "getFirstCompletedByIntPratica"; - _methodParameterTypes79 = new String[] { - "java.lang.String", "java.io.Serializable" - }; + _methodParameterTypes79 = new String[] { "long" }; - _methodName80 = "countVariateByIntPratica"; + _methodName80 = "getDestinazioniUso"; - _methodParameterTypes80 = new String[] { "long" }; + _methodParameterTypes80 = new String[] { }; - _methodName81 = "getFirstCompletedByIntPratica"; + _methodName81 = "getDettPraticaFields"; - _methodParameterTypes81 = new String[] { "long" }; + _methodParameterTypes81 = new String[] { }; - _methodName82 = "getDestinazioniuso"; + _methodName82 = "getDettPraticaFieldsTypes"; _methodParameterTypes82 = new String[] { }; } @@ -4438,16 +4438,22 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { } @Override - public java.util.List getDettPraticaFields() { + public java.util.List getVersioni( + long intPraticaId) + throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName74, - _methodParameterTypes74, new Object[] { }); + _methodParameterTypes74, new Object[] { intPraticaId }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + if (t instanceof RuntimeException) { throw (RuntimeException)t; } @@ -4457,20 +4463,26 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { } } - return (java.util.List)ClpSerializer.translateOutput(returnObj); + return (java.util.List)ClpSerializer.translateOutput(returnObj); } @Override - public java.util.Map getDettPraticaFieldsTypes() { + public java.util.List> callForChanges( + long intPraticaId) + throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName75, - _methodParameterTypes75, new Object[] { }); + _methodParameterTypes75, new Object[] { intPraticaId }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + if (t instanceof RuntimeException) { throw (RuntimeException)t; } @@ -4480,26 +4492,21 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { } } - return (java.util.Map)ClpSerializer.translateOutput(returnObj); + return (java.util.List>)ClpSerializer.translateOutput(returnObj); } @Override - public java.util.List getVersioni( - long intPraticaId) - throws com.liferay.portal.kernel.exception.SystemException { + public boolean isNumber(java.lang.String field) { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName76, - _methodParameterTypes76, new Object[] { intPraticaId }); + _methodParameterTypes76, + new Object[] { ClpSerializer.translateInput(field) }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - if (t instanceof RuntimeException) { throw (RuntimeException)t; } @@ -4509,26 +4516,26 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { } } - return (java.util.List)ClpSerializer.translateOutput(returnObj); + return ((Boolean)returnObj).booleanValue(); } @Override - public java.util.List> callForChanges( - long intPraticaId) - throws com.liferay.portal.kernel.exception.SystemException { + public java.lang.String format(java.lang.String field, + java.io.Serializable value) { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName77, - _methodParameterTypes77, new Object[] { intPraticaId }); + _methodParameterTypes77, + new Object[] { + ClpSerializer.translateInput(field), + + ClpSerializer.translateInput(value) + }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - if (t instanceof RuntimeException) { throw (RuntimeException)t; } @@ -4538,21 +4545,25 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { } } - return (java.util.List>)ClpSerializer.translateOutput(returnObj); + return (java.lang.String)ClpSerializer.translateOutput(returnObj); } @Override - public boolean isNumber(java.lang.String field) { + public int countVariateByIntPratica(long intPraticaId) + throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName78, - _methodParameterTypes78, - new Object[] { ClpSerializer.translateInput(field) }); + _methodParameterTypes78, new Object[] { intPraticaId }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + if (t instanceof RuntimeException) { throw (RuntimeException)t; } @@ -4562,26 +4573,26 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { } } - return ((Boolean)returnObj).booleanValue(); + return ((Integer)returnObj).intValue(); } @Override - public java.lang.String format(java.lang.String field, - java.io.Serializable value) { + public it.tref.liferay.portos.bo.model.DettPratica getFirstCompletedByIntPratica( + long intPraticaId) + throws com.liferay.portal.kernel.exception.SystemException { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName79, - _methodParameterTypes79, - new Object[] { - ClpSerializer.translateInput(field), - - ClpSerializer.translateInput(value) - }); + _methodParameterTypes79, new Object[] { intPraticaId }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + if (t instanceof RuntimeException) { throw (RuntimeException)t; } @@ -4591,25 +4602,20 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { } } - return (java.lang.String)ClpSerializer.translateOutput(returnObj); + return (it.tref.liferay.portos.bo.model.DettPratica)ClpSerializer.translateOutput(returnObj); } @Override - public int countVariateByIntPratica(long intPraticaId) - throws com.liferay.portal.kernel.exception.SystemException { + public java.util.Map getDestinazioniUso() { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName80, - _methodParameterTypes80, new Object[] { intPraticaId }); + _methodParameterTypes80, new Object[] { }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - if (t instanceof RuntimeException) { throw (RuntimeException)t; } @@ -4619,26 +4625,20 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { } } - return ((Integer)returnObj).intValue(); + return (java.util.Map)ClpSerializer.translateOutput(returnObj); } @Override - public it.tref.liferay.portos.bo.model.DettPratica getFirstCompletedByIntPratica( - long intPraticaId) - throws com.liferay.portal.kernel.exception.SystemException { + public java.util.List getDettPraticaFields() { Object returnObj = null; try { returnObj = _invokableLocalService.invokeMethod(_methodName81, - _methodParameterTypes81, new Object[] { intPraticaId }); + _methodParameterTypes81, new Object[] { }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - if (t instanceof RuntimeException) { throw (RuntimeException)t; } @@ -4648,11 +4648,11 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { } } - return (it.tref.liferay.portos.bo.model.DettPratica)ClpSerializer.translateOutput(returnObj); + return (java.util.List)ClpSerializer.translateOutput(returnObj); } @Override - public java.util.Map getDestinazioniuso() { + public java.util.Map getDettPraticaFieldsTypes() { Object returnObj = null; try { @@ -4671,7 +4671,7 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { } } - return (java.util.Map)ClpSerializer.translateOutput(returnObj); + return (java.util.Map)ClpSerializer.translateOutput(returnObj); } private InvokableLocalService _invokableLocalService; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceUtil.java index a8172cf7..d1697b7e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceUtil.java @@ -1255,14 +1255,6 @@ public class DettPraticaLocalServiceUtil { tipologiaSoggetto); } - public static java.util.List getDettPraticaFields() { - return getService().getDettPraticaFields(); - } - - public static java.util.Map getDettPraticaFieldsTypes() { - return getService().getDettPraticaFieldsTypes(); - } - public static java.util.List getVersioni( long intPraticaId) throws com.liferay.portal.kernel.exception.SystemException { @@ -1295,8 +1287,16 @@ public class DettPraticaLocalServiceUtil { return getService().getFirstCompletedByIntPratica(intPraticaId); } - public static java.util.Map getDestinazioniuso() { - return getService().getDestinazioniuso(); + public static java.util.Map getDestinazioniUso() { + return getService().getDestinazioniUso(); + } + + public static java.util.List getDettPraticaFields() { + return getService().getDettPraticaFields(); + } + + public static java.util.Map getDettPraticaFieldsTypes() { + return getService().getDettPraticaFieldsTypes(); } public static void clearService() { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceWrapper.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceWrapper.java index 64c88d4a..7e94dceb 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceWrapper.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaLocalServiceWrapper.java @@ -1318,16 +1318,6 @@ public class DettPraticaLocalServiceWrapper implements DettPraticaLocalService, codiceFiscale, tipologiaSoggetto); } - @Override - public java.util.List getDettPraticaFields() { - return _dettPraticaLocalService.getDettPraticaFields(); - } - - @Override - public java.util.Map getDettPraticaFieldsTypes() { - return _dettPraticaLocalService.getDettPraticaFieldsTypes(); - } - @Override public java.util.List getVersioni( long intPraticaId) @@ -1367,8 +1357,18 @@ public class DettPraticaLocalServiceWrapper implements DettPraticaLocalService, } @Override - public java.util.Map getDestinazioniuso() { - return _dettPraticaLocalService.getDestinazioniuso(); + public java.util.Map getDestinazioniUso() { + return _dettPraticaLocalService.getDestinazioniUso(); + } + + @Override + public java.util.List getDettPraticaFields() { + return _dettPraticaLocalService.getDettPraticaFields(); + } + + @Override + public java.util.Map getDettPraticaFieldsTypes() { + return _dettPraticaLocalService.getDettPraticaFieldsTypes(); } /** diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/DomandaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/DomandaUtil.java index 7a8c379d..5e3aaae6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/DomandaUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/DomandaUtil.java @@ -18,7 +18,7 @@ public class DomandaUtil { private static final List DETT_PRATICA_FIELDS; private static final Map DETT_PRATICA_FIELDS_TYPES; - public static Map getDestinazioniuso() { + public static Map getDestinazioniUso() { return DESTINAZIONI_USO; } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/DettPraticaLocalServiceClpInvoker.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/DettPraticaLocalServiceClpInvoker.java index efb98e98..017915f3 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/DettPraticaLocalServiceClpInvoker.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/DettPraticaLocalServiceClpInvoker.java @@ -520,43 +520,43 @@ public class DettPraticaLocalServiceClpInvoker { "long", "java.lang.String", "java.lang.String" }; - _methodName266 = "getDettPraticaFields"; + _methodName266 = "getVersioni"; - _methodParameterTypes266 = new String[] { }; + _methodParameterTypes266 = new String[] { "long" }; - _methodName267 = "getDettPraticaFieldsTypes"; + _methodName267 = "callForChanges"; - _methodParameterTypes267 = new String[] { }; + _methodParameterTypes267 = new String[] { "long" }; - _methodName268 = "getVersioni"; + _methodName268 = "isNumber"; - _methodParameterTypes268 = new String[] { "long" }; + _methodParameterTypes268 = new String[] { "java.lang.String" }; - _methodName269 = "callForChanges"; + _methodName269 = "format"; - _methodParameterTypes269 = new String[] { "long" }; + _methodParameterTypes269 = new String[] { + "java.lang.String", "java.io.Serializable" + }; - _methodName270 = "isNumber"; + _methodName270 = "countVariateByIntPratica"; - _methodParameterTypes270 = new String[] { "java.lang.String" }; + _methodParameterTypes270 = new String[] { "long" }; - _methodName271 = "format"; + _methodName272 = "getFirstCompletedByIntPratica"; - _methodParameterTypes271 = new String[] { - "java.lang.String", "java.io.Serializable" - }; + _methodParameterTypes272 = new String[] { "long" }; - _methodName272 = "countVariateByIntPratica"; + _methodName273 = "getDestinazioniUso"; - _methodParameterTypes272 = new String[] { "long" }; + _methodParameterTypes273 = new String[] { }; - _methodName274 = "getFirstCompletedByIntPratica"; + _methodName274 = "getDettPraticaFields"; - _methodParameterTypes274 = new String[] { "long" }; + _methodParameterTypes274 = new String[] { }; - _methodName276 = "getDestinazioniuso"; + _methodName275 = "getDettPraticaFieldsTypes"; - _methodParameterTypes276 = new String[] { }; + _methodParameterTypes275 = new String[] { }; } public Object invokeMethod(String name, String[] parameterTypes, @@ -1501,48 +1501,48 @@ public class DettPraticaLocalServiceClpInvoker { if (_methodName266.equals(name) && Arrays.deepEquals(_methodParameterTypes266, parameterTypes)) { - return DettPraticaLocalServiceUtil.getDettPraticaFields(); + return DettPraticaLocalServiceUtil.getVersioni(((Long)arguments[0]).longValue()); } if (_methodName267.equals(name) && Arrays.deepEquals(_methodParameterTypes267, parameterTypes)) { - return DettPraticaLocalServiceUtil.getDettPraticaFieldsTypes(); + return DettPraticaLocalServiceUtil.callForChanges(((Long)arguments[0]).longValue()); } if (_methodName268.equals(name) && Arrays.deepEquals(_methodParameterTypes268, parameterTypes)) { - return DettPraticaLocalServiceUtil.getVersioni(((Long)arguments[0]).longValue()); + return DettPraticaLocalServiceUtil.isNumber((java.lang.String)arguments[0]); } if (_methodName269.equals(name) && Arrays.deepEquals(_methodParameterTypes269, parameterTypes)) { - return DettPraticaLocalServiceUtil.callForChanges(((Long)arguments[0]).longValue()); + return DettPraticaLocalServiceUtil.format((java.lang.String)arguments[0], + (java.io.Serializable)arguments[1]); } if (_methodName270.equals(name) && Arrays.deepEquals(_methodParameterTypes270, parameterTypes)) { - return DettPraticaLocalServiceUtil.isNumber((java.lang.String)arguments[0]); - } - - if (_methodName271.equals(name) && - Arrays.deepEquals(_methodParameterTypes271, parameterTypes)) { - return DettPraticaLocalServiceUtil.format((java.lang.String)arguments[0], - (java.io.Serializable)arguments[1]); + return DettPraticaLocalServiceUtil.countVariateByIntPratica(((Long)arguments[0]).longValue()); } if (_methodName272.equals(name) && Arrays.deepEquals(_methodParameterTypes272, parameterTypes)) { - return DettPraticaLocalServiceUtil.countVariateByIntPratica(((Long)arguments[0]).longValue()); + return DettPraticaLocalServiceUtil.getFirstCompletedByIntPratica(((Long)arguments[0]).longValue()); + } + + if (_methodName273.equals(name) && + Arrays.deepEquals(_methodParameterTypes273, parameterTypes)) { + return DettPraticaLocalServiceUtil.getDestinazioniUso(); } if (_methodName274.equals(name) && Arrays.deepEquals(_methodParameterTypes274, parameterTypes)) { - return DettPraticaLocalServiceUtil.getFirstCompletedByIntPratica(((Long)arguments[0]).longValue()); + return DettPraticaLocalServiceUtil.getDettPraticaFields(); } - if (_methodName276.equals(name) && - Arrays.deepEquals(_methodParameterTypes276, parameterTypes)) { - return DettPraticaLocalServiceUtil.getDestinazioniuso(); + if (_methodName275.equals(name) && + Arrays.deepEquals(_methodParameterTypes275, parameterTypes)) { + return DettPraticaLocalServiceUtil.getDettPraticaFieldsTypes(); } throw new UnsupportedOperationException(); @@ -1708,12 +1708,12 @@ public class DettPraticaLocalServiceClpInvoker { private String[] _methodParameterTypes269; private String _methodName270; private String[] _methodParameterTypes270; - private String _methodName271; - private String[] _methodParameterTypes271; private String _methodName272; private String[] _methodParameterTypes272; + private String _methodName273; + private String[] _methodParameterTypes273; private String _methodName274; private String[] _methodParameterTypes274; - private String _methodName276; - private String[] _methodParameterTypes276; + private String _methodName275; + private String[] _methodParameterTypes275; } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DettPraticaLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DettPraticaLocalServiceImpl.java index 163e78c5..745e07f2 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DettPraticaLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DettPraticaLocalServiceImpl.java @@ -1761,7 +1761,7 @@ public class DettPraticaLocalServiceImpl extends DettPraticaLocalServiceBaseImpl versions.add(deserializer.deserialize(serializer.serialize(lista.get(i)))); changes.add(new HashMap()); } - for (String field : dettPraticaFields) { + for (String field : DomandaUtil.getDettPraticaFields()) { Serializable v0 = null == versions.get(0).get(field) ? StringPool.BLANK : versions.get(0).get(field); boolean changed = false; for (int i = 1; i < size; i++) { @@ -1784,7 +1784,7 @@ public class DettPraticaLocalServiceImpl extends DettPraticaLocalServiceBaseImpl @Override public boolean isNumber(String field) { - switch (dettPraticaFieldsTypes.get(field)) { + switch (DomandaUtil.getDettPraticaFieldsTypes().get(field)) { case Types.BOOLEAN: case Types.TIMESTAMP: return false; @@ -1799,7 +1799,7 @@ public class DettPraticaLocalServiceImpl extends DettPraticaLocalServiceBaseImpl case Types.INTEGER: return true; default: - _log.info(dettPraticaFieldsTypes.get(field)); + _log.info(DomandaUtil.getDettPraticaFieldsTypes().get(field)); } return true; } @@ -1807,7 +1807,7 @@ public class DettPraticaLocalServiceImpl extends DettPraticaLocalServiceBaseImpl @Override public String format(String field, Serializable value) { - switch (dettPraticaFieldsTypes.get(field)) { + switch (DomandaUtil.getDettPraticaFieldsTypes().get(field)) { case Types.BOOLEAN: return (Boolean) value ? "Sì" : "No"; case Types.TIMESTAMP: @@ -1831,7 +1831,7 @@ public class DettPraticaLocalServiceImpl extends DettPraticaLocalServiceBaseImpl case Types.INTEGER: return NumberFormat.getInstance().format(value); default: - _log.info(dettPraticaFieldsTypes.get(field)); + _log.info(DomandaUtil.getDettPraticaFieldsTypes().get(field)); return "XXXXXXXXXXXXX"; } } @@ -1865,8 +1865,8 @@ public class DettPraticaLocalServiceImpl extends DettPraticaLocalServiceBaseImpl } @Override - public Map getDestinazioniuso() { - return DomandaUtil.getDestinazioniuso(); + public Map getDestinazioniUso() { + return DomandaUtil.getDestinazioniUso(); } @Override diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties index 95465c34..56b27315 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_bo - build.number=3202 - build.date=1624536257328 + build.number=3203 + build.date=1624539251511 build.auto.upgrade=true ## 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 20fb27dd..549a48b6 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 @@ -21,6 +21,7 @@ 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 VAT_ID = "vatId"; 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/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 46fd33bd..d50792a7 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 @@ -5,11 +5,13 @@ import it.mwg.sicilia.sue.api.v1.command.impl.DeleteApplication; import it.mwg.sicilia.sue.api.v1.command.impl.GetApplications; import it.mwg.sicilia.sue.api.v1.command.impl.ListApplications; import it.mwg.sicilia.sue.api.v1.command.impl.ListDocuments; +import it.mwg.sicilia.sue.api.v1.command.impl.ListFields; import it.mwg.sicilia.sue.api.v1.command.impl.ListUses; import it.mwg.sicilia.sue.api.v1.command.impl.Login; 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.SetUse; import java.util.Collection; @@ -33,13 +35,15 @@ public class CommandList { 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 ListFields("Elenco dei dati dell'istanza accettati dal portale", HttpMethods.GET, - // HttpMethods.POST)); + addCommand(new ListFields("Elenco dei dati dell'istanza accettati dal portale", HttpMethods.GET, + HttpMethods.POST)); addCommand(new ListUses("Elenco delle destinazioni d'uso riconosciute dal portale", HttpMethods.GET, HttpMethods.POST)); // 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 è fornito dal comando /" + + Command.getCommandName(ListFields.class))); addCommand(new SetUse("Imposta la destinazione d'uso dell'immobile relativo all'istanza")); addCommand(new GetApplications("Elenca le istanze in lavorazione da questo SUE", HttpMethods.GET, HttpMethods.POST)); 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 7c2f71bd..1cc7746f 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 @@ -66,7 +66,7 @@ public class DeleteApplication extends Command { try { Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); if (territorio.getComuneId() != sportello.getComuneId() || !intPratica.isInLavorazioneSue()) { - additionalInfo.add("Istanza " + applicationId + " non cancellabile"); + additionalInfo.add("Istanza " + applicationId + " non modificabile"); ServletResponseUtil.write(response, Response.get(Status.INVALID_INPUT, 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/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 95ec2fb4..343131c6 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 @@ -26,7 +26,7 @@ import com.liferay.portal.kernel.servlet.ServletResponseUtil; public class GetApplications extends Command { - private static final List OUTPUT_PARAMETERS = new ArrayList(); + private static final List OUTPUT_PARAMETERS = new ArrayList<>(); static { OUTPUT_PARAMETERS.addAll(BASE_OUTPUT_PARAMETERS); Parameter p = new Parameter(Parameters.APPLICATIONS, TYPES.ARRAY, "Elenco di istanze presentate"); 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 52d922c3..0a15d1ea 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 @@ -23,7 +23,7 @@ import com.liferay.portal.kernel.servlet.ServletResponseUtil; public class ListApplications extends Command { - private static final List OUTPUT_PARAMETERS = new ArrayList(); + 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"); 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/ListDocuments.java index 68046b0a..7feaf84f 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/ListDocuments.java @@ -23,7 +23,7 @@ import com.liferay.portal.kernel.servlet.ServletResponseUtil; public class ListDocuments extends Command { - private static final List OUTPUT_PARAMETERS = new ArrayList(); + 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"); 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 033af98c..422bd537 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 @@ -14,19 +14,17 @@ import java.sql.Types; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.servlet.ServletResponseUtil; import com.liferay.portal.kernel.util.StringPool; public class ListFields extends Command { - private static final List OUTPUT_PARAMETERS = new ArrayList(); + private static final List OUTPUT_PARAMETERS = new ArrayList<>(); static { OUTPUT_PARAMETERS.addAll(BASE_OUTPUT_PARAMETERS); Parameter p = new Parameter(Parameters.FIELDS, TYPES.ARRAY, "Elenco di dati accettati"); @@ -44,17 +42,21 @@ public class ListFields extends Command { @Override public void run(HttpServletRequest request, HttpServletResponse response) throws Exception { - List fields = new ArrayList<>(); + List list = new ArrayList<>(); Map fieldTypes = DettPraticaLocalServiceUtil.getDettPraticaFieldsTypes(); - Map> dpFields = DettPraticaLocalServiceUtil.getFields(); - for (String section : dpFields.keySet()) { - List sFields = dpFields.get(section); - for (String field : sFields) { - String description = StringPool.OPEN_BRACKET - + section - + "] " - + LanguageUtil.get(Locale.ITALIAN, field.replaceAll("([A-Z])", "-$1").toLowerCase()).replace( - "
", StringPool.SPACE); + List fields = DettPraticaLocalServiceUtil.getDettPraticaFields(); + for (String field : fields) { + String description = StringPool.BLANK; + boolean insert = true; + switch (field) { + case "destinazione": + description = "Codice della destinazione d'uso, l'elenco è fornito dal comando /" + + getCommandName(ListUses.class); + break; + default: + insert = false; + } + if (insert) { TYPES type = TYPES.UNKNOWN; switch (fieldTypes.get(field)) { case Types.BIGINT: @@ -74,11 +76,11 @@ public class ListFields extends Command { type = TYPES.STRING; break; } - fields.add(new Field(field, description, type)); + list.add(new Field(field, description, type)); } } Map result = new HashMap<>(); - result.put(Parameters.FIELDS, (Serializable) fields); + result.put(Parameters.FIELDS, (Serializable) list); ServletResponseUtil.write(response, Response.get(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/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 index efcdf954..28a386f3 100644 --- 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 @@ -23,7 +23,7 @@ import com.liferay.portal.kernel.servlet.ServletResponseUtil; public class ListUses extends Command { - private static final List OUTPUT_PARAMETERS = new ArrayList(); + 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"); @@ -40,7 +40,7 @@ public class ListUses extends Command { public void run(HttpServletRequest request, HttpServletResponse response) throws Exception { List uses = new ArrayList<>(); - for (Entry e : DettPraticaLocalServiceUtil.getDestinazioniuso().entrySet()) { + for (Entry e : DettPraticaLocalServiceUtil.getDestinazioniUso().entrySet()) { uses.add(new ListElement(e.getKey(), e.getValue())); } Map result = new HashMap<>(); 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/SetFields.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/SetFields.java new file mode 100644 index 00000000..955beac6 --- /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/SetFields.java @@ -0,0 +1,123 @@ +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.Date; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +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; +.portal.kernel.util.MapUtil; + +public class SetFields extends Command { + + private static final List INPUT_PARAMETERS = new ArrayList<>(); + static { + INPUT_PARAMETERS.add(new Parameter(Parameters.APPLICATION_ID, TYPES.INTEGER, "Id dell'istanza")); + Parameter p = new Parameter(Parameters.FIELDS, TYPES.ARRAY, "Elenco di campi da impostare"); + p.addSubParameter(new Parameter(Parameters.NAME, TYPES.STRING, "Nome del campo")); + p.addSubParameter(new Parameter(Parameters.VALUE, TYPES.VARYING, "Valore da impostare per il campo")); + } + + public SetFields(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(); + 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.FIELDS)) { + additionalInfo.add("Parametro " + Parameters.FIELDS + " mancante"); + ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo)); + return; + } + Object mapObj = parameters.get(Parameters.FIELDS); + if (!(mapObj instanceof Map)) { + additionalInfo.add("Formato del parametro " + Parameters.FIELDS + " errato"); + ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo)); + return; + } + @SuppressWarnings("unchecked") + Map mapMap = (Map) mapObj; + if (mapMap.size() > 0) { + Entry i = mapMap.entrySet().iterator().next(); + System.out.println("====== " + i.getValue().getClass().getName()); + if (!(i.getKey() instanceof String) || !(i.getValue() instanceof Serializable)) { + System.out.println("****** " + i.getValue().getClass().getName()); + } + if (i.getValue() instanceof String) { + System.out.println("String"); + } + if (i.getValue() instanceof Date) { + System.out.println("Date"); + } + if (i.getValue() instanceof Long) { + System.out.println("Long"); + } + System.out.println(i.getValue() + "!!!"); + } + long applicationId = MapUtil.getLong(parameters, Parameters.APPLICATION_ID); + IntPratica intPratica = null; + Object obj = parameters.get(Parameters.FIELDS); + 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; + } + ServletResponseUtil.write(response, Response.get(Status.OK)); + } + } + + @Override + public List getInputParameters() { + return INPUT_PARAMETERS; + } + + @Override + public List getOutputParameters() { + return BASE_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/SetUse.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/SetUse.java index 1f8ed51e..140579fd 100644 --- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/SetUse.java +++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/SetUse.java @@ -1,9 +1,17 @@ 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; @@ -11,6 +19,11 @@ 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") @@ -20,7 +33,7 @@ public class SetUse extends Command { 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)); + "Descrizione della destinazione d'uso, obbligatoria* se " + Parameters.CODE + " = 3", false)); } }; @@ -32,7 +45,49 @@ public class SetUse 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"); + 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)); } } diff --git a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/parameter/Parameter.java b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/parameter/Parameter.java index e478649e..f115f8e4 100644 --- a/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/parameter/Parameter.java +++ b/liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/parameter/Parameter.java @@ -56,6 +56,6 @@ public class Parameter { } public static enum TYPES { - ARRAY, BOOLEAN, FLOAT, INTEGER, STRING, TIMESTAMP, TEXT_HTML, TEXT_PLAIN, UNKNOWN + ARRAY, BOOLEAN, FLOAT, INTEGER, STRING, TIMESTAMP, TEXT_HTML, TEXT_PLAIN, UNKNOWN, VARYING } }