diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpPostUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpServiceUtil.java similarity index 60% rename from liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpPostUtil.java rename to liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpServiceUtil.java index 7d8f86dd..9c991d4f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpPostUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpServiceUtil.java @@ -13,15 +13,21 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; +import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.ContentTypes; +import com.liferay.portal.kernel.util.HttpUtil; import com.liferay.portal.kernel.util.StringPool; +import com.liferay.portal.kernel.util.Http.Options; -public class HttpPostUtil { +public class HttpServiceUtil { + private static final Log _log = LogFactoryUtil.getLog(HttpServiceUtil.class); public static JSONObject postProtocolloBean(long companyId, Protocollo protocolloBean) throws Exception { - JSONObject risposta = null; + flexjson.JSONSerializer serializer = new flexjson.JSONSerializer(); serializer.exclude("*.class"); String json = serializer.serialize(protocolloBean); @@ -29,6 +35,11 @@ public class HttpPostUtil { String url = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_URL); + return postJson(url, json); + } + + public static JSONObject postJson(String url, String json) throws Exception { + JSONObject risposta = null; HttpPost request = new HttpPost(url); request.setHeader("Content-type", ContentTypes.APPLICATION_JSON); request.setEntity(new StringEntity(json)); @@ -39,15 +50,31 @@ public class HttpPostUtil { String responseBody = EntityUtils.toString(response.getEntity(), StringPool.UTF8); client.close(); + _log.info(url + " || " + json + " || " + risposta); if (statusCode == HttpServletResponse.SC_OK || statusCode == HttpServletResponse.SC_CREATED) { risposta = JSONFactoryUtil.createJSONObject(responseBody); - // retval = risposta.getString("anno") + String.format("%07d", - // risposta.getInt("numero")); } else { - throw new Exception(statusCode + StringPool.SPACE + responseBody); + throw new PortalException(statusCode + StringPool.SPACE + responseBody); } - return risposta; } + public static String getUrl(String url) throws Exception { + return getUrl(url, StringPool.BLANK); + } + + public static String getUrl(String url, String defaultValue) throws Exception { + Options options = new Options(); + options.setLocation(url); + options.setPost(false); + + String responseBody = HttpUtil.URLtoString(options); + + _log.info(url + " || " + responseBody); + if (options.getResponse().getResponseCode() != HttpServletResponse.SC_OK) { + throw new Exception(url + ": " + options.getResponse().getResponseCode()); +// responseBody = defaultValue; + } + return responseBody; + } } 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 12db8c97..764e7a20 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 @@ -936,28 +936,18 @@ public interface DettPraticaLocalService extends BaseLocalService, com.liferay.portal.kernel.exception.SystemException; public void sendToVersioning(long dettPraticaId, java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException, java.lang.NoSuchFieldException, - java.lang.SecurityException; + throws java.lang.Exception; @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public int getNumeroDiVersioni(java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException; + throws java.lang.Exception, java.lang.NumberFormatException; @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public java.lang.String getVersionNumber(java.lang.String url, int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException; + throws java.lang.Exception; public com.liferay.portal.kernel.json.JSONArray callForChanges( - java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException; + java.lang.String url) throws java.lang.Exception; @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public it.tref.liferay.portos.bo.model.DettPratica fetchByOldDettPraticaId( 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 208a1f62..6001bc05 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 @@ -4591,10 +4591,7 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { @Override public void sendToVersioning(long dettPraticaId, java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException, java.lang.NoSuchFieldException, - java.lang.SecurityException { + throws java.lang.Exception { try { _invokableLocalService.invokeMethod(_methodName78, _methodParameterTypes78, @@ -4603,24 +4600,8 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.PortalException) { - throw (com.liferay.portal.kernel.exception.PortalException)t; - } - - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - - if (t instanceof java.io.IOException) { - throw (java.io.IOException)t; - } - - if (t instanceof java.lang.NoSuchFieldException) { - throw (java.lang.NoSuchFieldException)t; - } - - if (t instanceof java.lang.SecurityException) { - throw (java.lang.SecurityException)t; + if (t instanceof java.lang.Exception) { + throw (java.lang.Exception)t; } if (t instanceof RuntimeException) { @@ -4635,9 +4616,7 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { @Override public int getNumeroDiVersioni(java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + throws java.lang.Exception, java.lang.NumberFormatException { Object returnObj = null; try { @@ -4648,16 +4627,12 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.PortalException) { - throw (com.liferay.portal.kernel.exception.PortalException)t; + if (t instanceof java.lang.Exception) { + throw (java.lang.Exception)t; } - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - - if (t instanceof java.io.IOException) { - throw (java.io.IOException)t; + if (t instanceof java.lang.NumberFormatException) { + throw (java.lang.NumberFormatException)t; } if (t instanceof RuntimeException) { @@ -4674,9 +4649,7 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { @Override public java.lang.String getVersionNumber(java.lang.String url, int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + throws java.lang.Exception { Object returnObj = null; try { @@ -4687,16 +4660,8 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.PortalException) { - throw (com.liferay.portal.kernel.exception.PortalException)t; - } - - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - - if (t instanceof java.io.IOException) { - throw (java.io.IOException)t; + if (t instanceof java.lang.Exception) { + throw (java.lang.Exception)t; } if (t instanceof RuntimeException) { @@ -4713,10 +4678,7 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { @Override public com.liferay.portal.kernel.json.JSONArray callForChanges( - java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + java.lang.String url) throws java.lang.Exception { Object returnObj = null; try { @@ -4727,16 +4689,8 @@ public class DettPraticaLocalServiceClp implements DettPraticaLocalService { catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.PortalException) { - throw (com.liferay.portal.kernel.exception.PortalException)t; - } - - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - - if (t instanceof java.io.IOException) { - throw (java.io.IOException)t; + if (t instanceof java.lang.Exception) { + throw (java.lang.Exception)t; } if (t instanceof RuntimeException) { 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 9eaabe0a..477513d9 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 @@ -1285,33 +1285,22 @@ public class DettPraticaLocalServiceUtil { } public static void sendToVersioning(long dettPraticaId, java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException, java.lang.NoSuchFieldException, - java.lang.SecurityException { + throws java.lang.Exception { getService().sendToVersioning(dettPraticaId, url); } public static int getNumeroDiVersioni(java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + throws java.lang.Exception, java.lang.NumberFormatException { return getService().getNumeroDiVersioni(url); } public static java.lang.String getVersionNumber(java.lang.String url, - int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + int version) throws java.lang.Exception { return getService().getVersionNumber(url, version); } public static com.liferay.portal.kernel.json.JSONArray callForChanges( - java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + java.lang.String url) throws java.lang.Exception { return getService().callForChanges(url); } 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 f3d39776..fece25b3 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 @@ -1354,35 +1354,25 @@ public class DettPraticaLocalServiceWrapper implements DettPraticaLocalService, @Override public void sendToVersioning(long dettPraticaId, java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException, java.lang.NoSuchFieldException, - java.lang.SecurityException { + throws java.lang.Exception { _dettPraticaLocalService.sendToVersioning(dettPraticaId, url); } @Override public int getNumeroDiVersioni(java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + throws java.lang.Exception, java.lang.NumberFormatException { return _dettPraticaLocalService.getNumeroDiVersioni(url); } @Override public java.lang.String getVersionNumber(java.lang.String url, int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + throws java.lang.Exception { return _dettPraticaLocalService.getVersionNumber(url, version); } @Override public com.liferay.portal.kernel.json.JSONArray callForChanges( - java.lang.String url) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + java.lang.String url) throws java.lang.Exception { return _dettPraticaLocalService.callForChanges(url); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaService.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaService.java index 8a4fbe1e..ee60851a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaService.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaService.java @@ -332,26 +332,15 @@ public interface DettPraticaService extends BaseService, InvokableService { @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public int getNumeroDiVersioni(long intPraticaId, long companyId) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException; + throws java.lang.Exception; @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public java.lang.String getJsonVersion(long intPraticaId, long companyId, - int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException; + int version) throws java.lang.Exception; public java.lang.String callForChanges(long intPraticaId, long companyId, - int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException; + int version) throws java.lang.Exception; public void sendToVersioning(long dettPraticaId, long companyId) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException, java.lang.NoSuchFieldException, - java.lang.SecurityException; + throws java.lang.Exception; } \ 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/DettPraticaServiceClp.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceClp.java index f70e94de..b303319d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceClp.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceClp.java @@ -1659,9 +1659,7 @@ public class DettPraticaServiceClp implements DettPraticaService { @Override public int getNumeroDiVersioni(long intPraticaId, long companyId) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + throws java.lang.Exception { Object returnObj = null; try { @@ -1672,16 +1670,8 @@ public class DettPraticaServiceClp implements DettPraticaService { catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.PortalException) { - throw (com.liferay.portal.kernel.exception.PortalException)t; - } - - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - - if (t instanceof java.io.IOException) { - throw (java.io.IOException)t; + if (t instanceof java.lang.Exception) { + throw (java.lang.Exception)t; } if (t instanceof RuntimeException) { @@ -1698,10 +1688,7 @@ public class DettPraticaServiceClp implements DettPraticaService { @Override public java.lang.String getJsonVersion(long intPraticaId, long companyId, - int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + int version) throws java.lang.Exception { Object returnObj = null; try { @@ -1712,16 +1699,8 @@ public class DettPraticaServiceClp implements DettPraticaService { catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.PortalException) { - throw (com.liferay.portal.kernel.exception.PortalException)t; - } - - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - - if (t instanceof java.io.IOException) { - throw (java.io.IOException)t; + if (t instanceof java.lang.Exception) { + throw (java.lang.Exception)t; } if (t instanceof RuntimeException) { @@ -1738,10 +1717,7 @@ public class DettPraticaServiceClp implements DettPraticaService { @Override public java.lang.String callForChanges(long intPraticaId, long companyId, - int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + int version) throws java.lang.Exception { Object returnObj = null; try { @@ -1752,16 +1728,8 @@ public class DettPraticaServiceClp implements DettPraticaService { catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.PortalException) { - throw (com.liferay.portal.kernel.exception.PortalException)t; - } - - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - - if (t instanceof java.io.IOException) { - throw (java.io.IOException)t; + if (t instanceof java.lang.Exception) { + throw (java.lang.Exception)t; } if (t instanceof RuntimeException) { @@ -1778,10 +1746,7 @@ public class DettPraticaServiceClp implements DettPraticaService { @Override public void sendToVersioning(long dettPraticaId, long companyId) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException, java.lang.NoSuchFieldException, - java.lang.SecurityException { + throws java.lang.Exception { try { _invokableService.invokeMethod(_methodName26, _methodParameterTypes26, @@ -1790,24 +1755,8 @@ public class DettPraticaServiceClp implements DettPraticaService { catch (Throwable t) { t = ClpSerializer.translateThrowable(t); - if (t instanceof com.liferay.portal.kernel.exception.PortalException) { - throw (com.liferay.portal.kernel.exception.PortalException)t; - } - - if (t instanceof com.liferay.portal.kernel.exception.SystemException) { - throw (com.liferay.portal.kernel.exception.SystemException)t; - } - - if (t instanceof java.io.IOException) { - throw (java.io.IOException)t; - } - - if (t instanceof java.lang.NoSuchFieldException) { - throw (java.lang.NoSuchFieldException)t; - } - - if (t instanceof java.lang.SecurityException) { - throw (java.lang.SecurityException)t; + if (t instanceof java.lang.Exception) { + throw (java.lang.Exception)t; } if (t instanceof RuntimeException) { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceUtil.java index 8d679a6c..df007622 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceUtil.java @@ -473,33 +473,22 @@ public class DettPraticaServiceUtil { } public static int getNumeroDiVersioni(long intPraticaId, long companyId) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + throws java.lang.Exception { return getService().getNumeroDiVersioni(intPraticaId, companyId); } public static java.lang.String getJsonVersion(long intPraticaId, - long companyId, int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + long companyId, int version) throws java.lang.Exception { return getService().getJsonVersion(intPraticaId, companyId, version); } public static java.lang.String callForChanges(long intPraticaId, - long companyId, int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + long companyId, int version) throws java.lang.Exception { return getService().callForChanges(intPraticaId, companyId, version); } public static void sendToVersioning(long dettPraticaId, long companyId) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException, java.lang.NoSuchFieldException, - java.lang.SecurityException { + throws java.lang.Exception { getService().sendToVersioning(dettPraticaId, companyId); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceWrapper.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceWrapper.java index 1eeb4429..9c978213 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceWrapper.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/DettPraticaServiceWrapper.java @@ -478,38 +478,27 @@ public class DettPraticaServiceWrapper implements DettPraticaService, @Override public int getNumeroDiVersioni(long intPraticaId, long companyId) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + throws java.lang.Exception { return _dettPraticaService.getNumeroDiVersioni(intPraticaId, companyId); } @Override public java.lang.String getJsonVersion(long intPraticaId, long companyId, - int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + int version) throws java.lang.Exception { return _dettPraticaService.getJsonVersion(intPraticaId, companyId, version); } @Override public java.lang.String callForChanges(long intPraticaId, long companyId, - int version) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException { + int version) throws java.lang.Exception { return _dettPraticaService.callForChanges(intPraticaId, companyId, version); } @Override public void sendToVersioning(long dettPraticaId, long companyId) - throws com.liferay.portal.kernel.exception.PortalException, - com.liferay.portal.kernel.exception.SystemException, - java.io.IOException, java.lang.NoSuchFieldException, - java.lang.SecurityException { + throws java.lang.Exception { _dettPraticaService.sendToVersioning(dettPraticaId, companyId); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AvvisoUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AvvisoUtil.java index 0875ccd6..038e3ad8 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AvvisoUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AvvisoUtil.java @@ -174,12 +174,20 @@ public class AvvisoUtil { allTipoDocumentoFileTemplateProps.put("PG", "conf.geniocivile.avviso.template.id.doc_pagamento"); allTipoDocumentoFileTemplateProps.put("DOM", "conf.geniocivile.avviso.template.id.domanda_pdf"); - allTipoDocumentoFileTemplateProps.put("DPA", "conf.geniocivile.avviso.template.id.deposito.A"); - allTipoDocumentoFileTemplateProps.put("DPB", "conf.geniocivile.avviso.template.id.deposito.B"); - allTipoDocumentoFileTemplateProps.put("DPB1", "conf.geniocivile.avviso.template.id.deposito.B1"); + allTipoDocumentoFileTemplateProps.put("DPP0", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPP1", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPP2", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPP3", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPP4", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPP5", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPP6", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPP7", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPP8", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPP9", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPP10", "conf.geniocivile.avviso.template.id.deposito.A"); + allTipoDocumentoFileTemplateProps.put("DPB2", "conf.geniocivile.avviso.template.id.deposito.B2"); allTipoDocumentoFileTemplateProps.put("DPVNS", "conf.geniocivile.avviso.template.id.deposito.VNS"); - allTipoDocumentoFileTemplateProps.put("DPC", "conf.geniocivile.avviso.template.id.deposito.C"); allTipoDocumentoFileTemplateProps.put("DPPS", "conf.geniocivile.avviso.template.id.deposito.PS"); allTipoDocumentoFileTemplateProps.put("DPS", "conf.geniocivile.avviso.template.id.deposito.S"); /* diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AzioniPraticheUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AzioniPraticheUtil.java index d03e75bc..4dabc814 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AzioniPraticheUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AzioniPraticheUtil.java @@ -25,264 +25,278 @@ import com.liferay.portal.kernel.workflow.WorkflowConstants; public class AzioniPraticheUtil { - public static final String ACTION_AGGIUNGI_SOGGETTO = "AGGIUNGI_SOGGETTO"; - public static final String ACTION_RIMUOVI_SOGGETTO = "RIMUOVI_SOGGETTO"; - public static final String ACTION_VARIAZIONE_SOGGETTI = "VARIAZIONE_SOGGETTI"; - public static final String ACTION_VARIANTE = "VARIANTE"; - public static final String ACTION_FL_PARZIALE = "FL_PARZIALE"; - public static final String ACTION_FL_TOTALE = "FL_TOTALE"; - public static final String ACTION_ANNULLA = "ANNULLA"; - public static final String ACTION_CO_PARZIALE = "CO_PARZIALE"; - public static final String ACTION_CO_TOTALE = "CO_TOTALE"; - public static final String ACTION_INTEGRAZIONE = "INTEGRAZIONE"; - - public static final String STATE_COMPILAZIONE = "COMPILAZIONE"; - public static final String STATE_VIDIMATO = "VIDIMATO"; - public static final String STATE_SOTTOPOSTO_A_PARERE_AUTORIZZAZIONE = "SP_AUTORIZZAZIONE"; - public static final String STATE_SOTTOPOSTO_A_PARERE_DEPOSITO = "SP_DEPOSITO"; - public static final String STATE_ANNULLATO = "ANNULLATO"; - public static final String STATE_NON_CONFORME = "NON_CONFORME"; - public static final String NON_AUTORIZZATA = "NON_AUTORIZZATA"; - public static final String STATE_INTEGRAZIONE_AUTORIZZAZIONE = "INTEGRAZIONE_AUTORIZZAZIONE"; - public static final String STATE_INTEGRAZIONE_DEPOSITO = "INTEGRAZIONE_DEPOSITO"; - public static final String STATE_FINE_LAVORI_PARZIALE = "FINE_LAVORI_PARZIALE"; - public static final String STATE_FINE_LAVORI_TOTALE = "FINE_LAVORI_TOTALE"; - public static final String STATE_COLLAUDO_PARZIALE = "COLLAUDO_PARZIALE"; - - - public static List ALL_ACTIONS = new UniqueList() { - { - add(ACTION_AGGIUNGI_SOGGETTO); - add(ACTION_RIMUOVI_SOGGETTO); - add(ACTION_VARIAZIONE_SOGGETTI); - add(ACTION_VARIANTE); - add(ACTION_FL_PARZIALE); - add(ACTION_FL_TOTALE); - add(ACTION_ANNULLA); - add(ACTION_CO_PARZIALE); - add(ACTION_CO_TOTALE); - } - }; - - public static Map> STATE_ACTIONS_MAP = new HashMap>() { - { - put(STATE_VIDIMATO, ALL_ACTIONS); - put(STATE_SOTTOPOSTO_A_PARERE_AUTORIZZAZIONE, - ListUtil.toList(new String[] {ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, ACTION_VARIAZIONE_SOGGETTI, - ACTION_ANNULLA})); - put(STATE_SOTTOPOSTO_A_PARERE_DEPOSITO, ALL_ACTIONS); - put(STATE_ANNULLATO, new ArrayList()); - put(STATE_NON_CONFORME, new ArrayList()); - put(NON_AUTORIZZATA, new ArrayList()); - put(STATE_INTEGRAZIONE_AUTORIZZAZIONE, - ListUtil.toList(new String[] {ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, ACTION_INTEGRAZIONE, - ACTION_ANNULLA})); - put(STATE_INTEGRAZIONE_DEPOSITO, - ListUtil.toList(new String[] {ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, ACTION_INTEGRAZIONE, - // ACTION_ANNULLA, ACTION_FL_PARZIALE, ACTION_FL_TOTALE, ACTION_CO_PARZIALE, - // ACTION_CO_TOTALE})); - ACTION_ANNULLA})); - put(STATE_COMPILAZIONE, - ListUtil.toList(new String[] {ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, ACTION_ANNULLA})); - put(STATE_FINE_LAVORI_PARZIALE, - ListUtil.toList(new String[] {ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, ACTION_VARIANTE, - ACTION_FL_PARZIALE, ACTION_FL_TOTALE, ACTION_CO_PARZIALE})); - put(STATE_FINE_LAVORI_TOTALE, - ListUtil.toList(new String[] {ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, ACTION_CO_TOTALE , ACTION_CO_PARZIALE})); - put(STATE_COLLAUDO_PARZIALE, - ListUtil.toList(new String[] {ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, ACTION_VARIANTE, - ACTION_CO_PARZIALE, ACTION_CO_TOTALE})); - } - }; - - public static boolean isAllowedAction(long intPraticaId, String action) throws PortalException, SystemException { - - - if (!ALL_ACTIONS.contains(action) && !ACTION_INTEGRAZIONE.equalsIgnoreCase(action)) { - throw new SystemException("Azione non presente: " + action); - } - IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); - - boolean isDeposito = isDeposito(intPraticaId); - boolean isAutorizzazione = isAutorizzazione(intPraticaId); - - String status = StringPool.BLANK; - - if (intPratica.getStatus() == WorkflowConstants.STATUS_PENDING) { - - if (StatoPraticaConstants.INTEGRAZIONE.equalsIgnoreCase(intPratica.getStatoPratica())) { - if (isDeposito) { - status = STATE_INTEGRAZIONE_DEPOSITO; - } else if (isAutorizzazione) { - status = STATE_INTEGRAZIONE_AUTORIZZAZIONE; - } else { - throw new SystemException("Tipo pratica non esiste"); - } - - } else if (isDeposito) { - status = STATE_SOTTOPOSTO_A_PARERE_DEPOSITO; - } else if (isAutorizzazione) { - status = STATE_SOTTOPOSTO_A_PARERE_AUTORIZZAZIONE; - } else { - throw new SystemException("Tipo pratica non esiste"); - } - } else if (StatoPraticaConstants.CONFORME.equalsIgnoreCase(intPratica.getStatoPratica())) { - status = STATE_VIDIMATO; - } else if (StatoPraticaConstants.NON_CONFORME.equalsIgnoreCase(intPratica.getStatoPratica())) { - status = STATE_NON_CONFORME; - } else if (StatoPraticaConstants.AUTORIZZATA.equalsIgnoreCase(intPratica.getStatoPratica())) { - status = STATE_VIDIMATO; - } else if (StatoPraticaConstants.NON_AUTORIZZATA.equalsIgnoreCase(intPratica.getStatoPratica())) { - status = NON_AUTORIZZATA; - } else if (StatoPraticaConstants.ANNULLATA.equalsIgnoreCase(intPratica.getStatoPratica())) { - status = STATE_ANNULLATO; - } else if (StatoPraticaConstants.VIDIMATA.equalsIgnoreCase(intPratica.getStatoPratica())) { - status = STATE_VIDIMATO; - } else if (StatoPraticaConstants.FINE_LAVORI.equalsIgnoreCase(intPratica.getStatoPratica())) { - status = STATE_FINE_LAVORI_TOTALE; - } else if (StatoPraticaConstants.FINE_LAVORI_PARZIALE.equalsIgnoreCase(intPratica.getStatoPratica())) { - status = STATE_FINE_LAVORI_PARZIALE; - } else if (intPratica.getStatus() == WorkflowConstants.STATUS_ANY) { - status = STATE_COMPILAZIONE; - } else if (StatoPraticaConstants.COLLAUDO_PARZIALE.equalsIgnoreCase(intPratica.getStatoPratica())) { - status = STATE_COLLAUDO_PARZIALE; - } - - List actionList = STATE_ACTIONS_MAP.get(status); - if (actionList == null) { - actionList = new ArrayList<>(); - - } - if (!actionList.contains(action)) { - return false; - } - - if (!action.equalsIgnoreCase(ACTION_INTEGRAZIONE) && intPratica.getCollaudoTotale()) { - return false; - } - - if (action.equalsIgnoreCase(ACTION_FL_PARZIALE) && intPratica.getFineLavoriTotale()) { - return false; - } - - if (action.equalsIgnoreCase(ACTION_FL_TOTALE) && intPratica.getFineLavoriTotale()) { - return false; - } - - if (action.equalsIgnoreCase(ACTION_CO_PARZIALE) && !intPratica.getFineLavoriParziale()) { - return false; - } - - if (action.equalsIgnoreCase(ACTION_CO_TOTALE) && !intPratica.getFineLavoriTotale()) { - return false; - } - - if (action.equalsIgnoreCase(ACTION_VARIANTE) && intPratica.getFineLavoriTotale()) { - return false; - } - - if (action.equalsIgnoreCase(ACTION_ANNULLA) - && (intPratica.getFineLavoriTotale() || intPratica.getFineLavoriParziale() || intPratica.getCollaudoParziale())) { - return false; - } - - if (action.equalsIgnoreCase(ACTION_RIMUOVI_SOGGETTO) && intPratica.getCollaudoParziale()) { - return false; - } - return true; - } - - - public static boolean canPrintFascicolo(long intPraticaId) throws PortalException, SystemException{ - IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); - //ADT BUG ID = 3 - if((!intPratica.getStatoPratica().equals("") || intPratica.isValidata()) && !intPratica.getNumeroProgetto().equals("")){ - return true; - } else { - return false; - } - - } - - public static boolean canPrintFascicoloVariante(long intPraticaId) throws PortalException, SystemException{ - - int nVarianti = DettPraticaLocalServiceUtil.countCompletedByIntPraticaAndTipoPratica(intPraticaId, Arrays.asList(new String[]{TipoIntegrazioneUtil.VARIANTE})); - - if(nVarianti > 0){ - return true; - } else { - return false; - } - } - - public static boolean canAddSoggetto(long intPraticaId, String tipoSoggetto) throws PortalException, SystemException { - - IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); - - if (!isAllowedAction(intPraticaId, ACTION_AGGIUNGI_SOGGETTO)) { - return false; - } - - //ADT BUG FE ID = 11 - - /* if ((!TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(tipoSoggetto) && !TipoSoggettoUtil.COLLAUDATORE - .equalsIgnoreCase(tipoSoggetto)) && (intPratica.isFineLavoriTotale() || intPratica.getCollaudoParziale())) { - return false; - }*/ - if ((!TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(tipoSoggetto) && !TipoSoggettoUtil.COLLAUDATORE - .equalsIgnoreCase(tipoSoggetto)) && (intPratica.isFineLavoriTotale())) { - return false; - } - - return true; - } - - public static boolean canRemoveSoggetto(long intPraticaId, String tipoSoggetto) throws PortalException, - SystemException { - - IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); - if (!isAllowedAction(intPraticaId, ACTION_RIMUOVI_SOGGETTO)) { - return false; - } - - if ((!TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(tipoSoggetto) && !TipoSoggettoUtil.COLLAUDATORE - .equalsIgnoreCase(tipoSoggetto)) && (intPratica.isFineLavoriTotale() || intPratica.getCollaudoParziale())) { - return false; - } - if ((TipoSoggettoUtil.DIRETTORE_LAVORI.equalsIgnoreCase(tipoSoggetto) || TipoSoggettoUtil.DITTA - .equalsIgnoreCase(tipoSoggetto)) && intPratica.isFineLavoriParziale()) { - return false; - } - - return true; - } - - public static boolean isDeposito(long intPraticaId) throws PortalException, SystemException { - - IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); -// Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); -// return Constants.PRATICA_ZONE.get(territorio.getZona()).equalsIgnoreCase(Constants.TIPO_PRATICA_DEPOSITO); -// Manifattura Web Group per Regione Siciliana - return intPratica.getTipoPratica().equalsIgnoreCase(Constants.TIPO_PRATICA_DEPOSITO); - } - - public static boolean isAutorizzazione(long intPraticaId) throws PortalException, SystemException { - - IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); -// Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); -// return Constants.PRATICA_ZONE.get(territorio.getZona()).equalsIgnoreCase(Constants.TIPO_PRATICA_AUTORIZZAZIONE); -// Manifattura Web Group per Regione Siciliana - return intPratica.getTipoPratica().equalsIgnoreCase(Constants.TIPO_PRATICA_AUTORIZZAZIONE); - } - - //ADT BUG ID = 7 - public static boolean canAddVariazioneSoggetti(long intPraticaId) throws PortalException, SystemException{ - IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); - if(!intPratica.getStatoPratica().equals("") && !intPratica.getNumeroProgetto().equals("")){ - return true; - } else { - return false; - } - - } + public static final String ACTION_AGGIUNGI_SOGGETTO = "AGGIUNGI_SOGGETTO"; + public static final String ACTION_RIMUOVI_SOGGETTO = "RIMUOVI_SOGGETTO"; + public static final String ACTION_VARIAZIONE_SOGGETTI = "VARIAZIONE_SOGGETTI"; + public static final String ACTION_VARIANTE = "VARIANTE"; + public static final String ACTION_FL_PARZIALE = "FL_PARZIALE"; + public static final String ACTION_FL_TOTALE = "FL_TOTALE"; + public static final String ACTION_ANNULLA = "ANNULLA"; + public static final String ACTION_CO_PARZIALE = "CO_PARZIALE"; + public static final String ACTION_CO_TOTALE = "CO_TOTALE"; + public static final String ACTION_INTEGRAZIONE = "INTEGRAZIONE"; + + public static final String STATE_COMPILAZIONE = "COMPILAZIONE"; + public static final String STATE_VIDIMATO = "VIDIMATO"; + public static final String STATE_SOTTOPOSTO_A_PARERE_AUTORIZZAZIONE = "SP_AUTORIZZAZIONE"; + public static final String STATE_SOTTOPOSTO_A_PARERE_DEPOSITO = "SP_DEPOSITO"; + public static final String STATE_ANNULLATO = "ANNULLATO"; + public static final String STATE_NON_CONFORME = "NON_CONFORME"; + public static final String NON_AUTORIZZATA = "NON_AUTORIZZATA"; + public static final String STATE_INTEGRAZIONE_AUTORIZZAZIONE = "INTEGRAZIONE_AUTORIZZAZIONE"; + public static final String STATE_INTEGRAZIONE_DEPOSITO = "INTEGRAZIONE_DEPOSITO"; + public static final String STATE_FINE_LAVORI_PARZIALE = "FINE_LAVORI_PARZIALE"; + public static final String STATE_FINE_LAVORI_TOTALE = "FINE_LAVORI_TOTALE"; + public static final String STATE_COLLAUDO_PARZIALE = "COLLAUDO_PARZIALE"; + + public static List ALL_ACTIONS = new UniqueList() { + { + add(ACTION_AGGIUNGI_SOGGETTO); + add(ACTION_RIMUOVI_SOGGETTO); + add(ACTION_VARIAZIONE_SOGGETTI); + add(ACTION_VARIANTE); + add(ACTION_FL_PARZIALE); + add(ACTION_FL_TOTALE); + add(ACTION_ANNULLA); + add(ACTION_CO_PARZIALE); + add(ACTION_CO_TOTALE); + } + }; + + public static Map> STATE_ACTIONS_MAP = new HashMap>() { + { + put(STATE_VIDIMATO, ALL_ACTIONS); + put(STATE_SOTTOPOSTO_A_PARERE_AUTORIZZAZIONE, + ListUtil.toList(new String[] { ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, + ACTION_VARIAZIONE_SOGGETTI, ACTION_ANNULLA })); + put(STATE_SOTTOPOSTO_A_PARERE_DEPOSITO, ALL_ACTIONS); + put(STATE_ANNULLATO, new ArrayList()); + put(STATE_NON_CONFORME, new ArrayList()); + put(NON_AUTORIZZATA, new ArrayList()); + put(STATE_INTEGRAZIONE_AUTORIZZAZIONE, + ListUtil.toList(new String[] { ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, + ACTION_INTEGRAZIONE, ACTION_ANNULLA })); + put(STATE_INTEGRAZIONE_DEPOSITO, + ListUtil.toList(new String[] { ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, + ACTION_INTEGRAZIONE, + // ACTION_ANNULLA, ACTION_FL_PARZIALE, + // ACTION_FL_TOTALE, ACTION_CO_PARZIALE, + // ACTION_CO_TOTALE})); + ACTION_ANNULLA })); + put(STATE_COMPILAZIONE, + ListUtil.toList(new String[] { ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, + ACTION_ANNULLA })); + put(STATE_FINE_LAVORI_PARZIALE, + ListUtil.toList(new String[] { ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, + ACTION_VARIANTE, ACTION_FL_PARZIALE, ACTION_FL_TOTALE, ACTION_CO_PARZIALE })); + put(STATE_FINE_LAVORI_TOTALE, + ListUtil.toList(new String[] { ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, + ACTION_CO_TOTALE, ACTION_CO_PARZIALE })); + put(STATE_COLLAUDO_PARZIALE, + ListUtil.toList(new String[] { ACTION_AGGIUNGI_SOGGETTO, ACTION_RIMUOVI_SOGGETTO, + ACTION_VARIANTE, ACTION_CO_PARZIALE, ACTION_CO_TOTALE })); + } + }; + + public static boolean isAllowedAction(long intPraticaId, String action) throws PortalException, + SystemException { + + if (!ALL_ACTIONS.contains(action) && !ACTION_INTEGRAZIONE.equalsIgnoreCase(action)) { + throw new SystemException("Azione non presente: " + action); + } + IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); + + boolean isDeposito = isDeposito(intPraticaId); + boolean isAutorizzazione = isAutorizzazione(intPraticaId); + + String status = StringPool.BLANK; + + if (intPratica.getStatus() == WorkflowConstants.STATUS_PENDING) { + + if (StatoPraticaConstants.INTEGRAZIONE.equalsIgnoreCase(intPratica.getStatoPratica())) { + if (isDeposito) { + status = STATE_INTEGRAZIONE_DEPOSITO; + } else if (isAutorizzazione) { + status = STATE_INTEGRAZIONE_AUTORIZZAZIONE; + } else { + throw new SystemException("Tipo pratica non esiste"); + } + + } else if (isDeposito) { + status = STATE_SOTTOPOSTO_A_PARERE_DEPOSITO; + } else if (isAutorizzazione) { + status = STATE_SOTTOPOSTO_A_PARERE_AUTORIZZAZIONE; + } else { + throw new SystemException("Tipo pratica non esiste"); + } + } else if (StatoPraticaConstants.CONFORME.equalsIgnoreCase(intPratica.getStatoPratica())) { + status = STATE_VIDIMATO; + } else if (StatoPraticaConstants.NON_CONFORME.equalsIgnoreCase(intPratica.getStatoPratica())) { + status = STATE_NON_CONFORME; + } else if (StatoPraticaConstants.AUTORIZZATA.equalsIgnoreCase(intPratica.getStatoPratica())) { + status = STATE_VIDIMATO; + } else if (StatoPraticaConstants.NON_AUTORIZZATA.equalsIgnoreCase(intPratica.getStatoPratica())) { + status = NON_AUTORIZZATA; + } else if (StatoPraticaConstants.ANNULLATA.equalsIgnoreCase(intPratica.getStatoPratica())) { + status = STATE_ANNULLATO; + } else if (StatoPraticaConstants.VIDIMATA.equalsIgnoreCase(intPratica.getStatoPratica())) { + status = STATE_VIDIMATO; + } else if (StatoPraticaConstants.FINE_LAVORI.equalsIgnoreCase(intPratica.getStatoPratica())) { + status = STATE_FINE_LAVORI_TOTALE; + } else if (StatoPraticaConstants.FINE_LAVORI_PARZIALE.equalsIgnoreCase(intPratica.getStatoPratica())) { + status = STATE_FINE_LAVORI_PARZIALE; + } else if (intPratica.getStatus() == WorkflowConstants.STATUS_ANY) { + status = STATE_COMPILAZIONE; + } else if (StatoPraticaConstants.COLLAUDO_PARZIALE.equalsIgnoreCase(intPratica.getStatoPratica())) { + status = STATE_COLLAUDO_PARZIALE; + } + + List actionList = STATE_ACTIONS_MAP.get(status); + if (actionList == null) { + actionList = new ArrayList<>(); + + } + if (!actionList.contains(action)) { + return false; + } + + if (!action.equalsIgnoreCase(ACTION_INTEGRAZIONE) && intPratica.getCollaudoTotale()) { + return false; + } + + if (action.equalsIgnoreCase(ACTION_FL_PARZIALE) && intPratica.getFineLavoriTotale()) { + return false; + } + + if (action.equalsIgnoreCase(ACTION_FL_TOTALE) && intPratica.getFineLavoriTotale()) { + return false; + } + + if (action.equalsIgnoreCase(ACTION_CO_PARZIALE) && !intPratica.getFineLavoriParziale()) { + return false; + } + + if (action.equalsIgnoreCase(ACTION_CO_TOTALE) && !intPratica.getFineLavoriTotale()) { + return false; + } + + if (action.equalsIgnoreCase(ACTION_VARIANTE) && intPratica.getFineLavoriTotale()) { + return false; + } + + if (action.equalsIgnoreCase(ACTION_ANNULLA) + && (intPratica.getFineLavoriTotale() || intPratica.getFineLavoriParziale() || intPratica + .getCollaudoParziale())) { + return false; + } + + if (action.equalsIgnoreCase(ACTION_RIMUOVI_SOGGETTO) && intPratica.getCollaudoParziale()) { + return false; + } + return true; + } + + public static boolean canPrintFascicolo(long intPraticaId) throws PortalException, SystemException { + IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); + // ADT BUG ID = 3 + if ((!intPratica.getStatoPratica().equals("") || intPratica.isValidata()) + && !intPratica.getNumeroProgetto().equals("")) { + return true; + } else { + return false; + } + + } + + public static boolean canPrintFascicoloVariante(long intPraticaId) throws PortalException, + SystemException { + + int nVarianti = DettPraticaLocalServiceUtil.countCompletedByIntPraticaAndTipoPratica(intPraticaId, + Arrays.asList(new String[] { TipoIntegrazioneUtil.VARIANTE })); + + if (nVarianti > 0) { + return true; + } else { + return false; + } + } + + public static boolean canAddSoggetto(long intPraticaId, String tipoSoggetto) throws PortalException, + SystemException { + + IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); + + if (!isAllowedAction(intPraticaId, ACTION_AGGIUNGI_SOGGETTO)) { + return false; + } + + // ADT BUG FE ID = 11 + + /* + * if ((!TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(tipoSoggetto) && + * !TipoSoggettoUtil.COLLAUDATORE .equalsIgnoreCase(tipoSoggetto)) && + * (intPratica.isFineLavoriTotale() || + * intPratica.getCollaudoParziale())) { return false; } + */ + if ((!TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(tipoSoggetto) && !TipoSoggettoUtil.COLLAUDATORE + .equalsIgnoreCase(tipoSoggetto)) && (intPratica.isFineLavoriTotale())) { + return false; + } + + return true; + } + + public static boolean canRemoveSoggetto(long intPraticaId, String tipoSoggetto) throws PortalException, + SystemException { + + IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); + if (!isAllowedAction(intPraticaId, ACTION_RIMUOVI_SOGGETTO)) { + return false; + } + + if ((!TipoSoggettoUtil.COMMITTENTE.equalsIgnoreCase(tipoSoggetto) && !TipoSoggettoUtil.COLLAUDATORE + .equalsIgnoreCase(tipoSoggetto)) + && (intPratica.isFineLavoriTotale() || intPratica.getCollaudoParziale())) { + return false; + } + if ((TipoSoggettoUtil.DIRETTORE_LAVORI.equalsIgnoreCase(tipoSoggetto) || TipoSoggettoUtil.DITTA + .equalsIgnoreCase(tipoSoggetto)) && intPratica.isFineLavoriParziale()) { + return false; + } + + return true; + } + + public static boolean isDeposito(long intPraticaId) throws PortalException, SystemException { + + IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); + // Territorio territorio = + // TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); + // return + // Constants.PRATICA_ZONE.get(territorio.getZona()).equalsIgnoreCase(Constants.TIPO_PRATICA_DEPOSITO); + // Manifattura Web Group per Regione Siciliana + return intPratica.getTipoPratica().equalsIgnoreCase(Constants.TIPO_PRATICA_DEPOSITO); + } + + public static boolean isAutorizzazione(long intPraticaId) throws PortalException, SystemException { + + IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(intPraticaId); + // Territorio territorio = + // TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); + // return + // Constants.PRATICA_ZONE.get(territorio.getZona()).equalsIgnoreCase(Constants.TIPO_PRATICA_AUTORIZZAZIONE); + // Manifattura Web Group per Regione Siciliana + return intPratica.getTipoPratica().equalsIgnoreCase(Constants.TIPO_PRATICA_AUTORIZZAZIONE); + } + + // ADT BUG ID = 7 + public static boolean canAddVariazioneSoggetti(long intPraticaId) throws PortalException, SystemException { + IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); + if (!intPratica.getStatoPratica().equals("") && !intPratica.getNumeroProgetto().equals("")) { + return true; + } else { + return false; + } + + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ProtocolloUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ProtocolloUtil.java index 4762ac3f..2212338a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ProtocolloUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ProtocolloUtil.java @@ -1,30 +1,20 @@ package it.tref.liferay.portos.bo.util; +import it.mwg.sismica.bo.util.HttpServiceUtil; import it.tref.liferay.portos.bo.model.Avviso; import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; -import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; import it.tref.liferay.portos.bo.shared.protocollo.model.File; import it.tref.liferay.portos.bo.shared.protocollo.model.Protocollo; import it.tref.liferay.portos.bo.shared.protocollo.model.Protocollo.TipoProtocollo; -import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; - import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.codec.digest.DigestUtils; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; -import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; -import com.liferay.portal.kernel.util.ContentTypes; -import com.liferay.portal.kernel.util.Http.Body; -import com.liferay.portal.kernel.util.Http.Options; -import com.liferay.portal.kernel.util.HttpUtil; -import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; public class ProtocolloUtil { @@ -32,8 +22,6 @@ public class ProtocolloUtil { public static String protocollaPartenzaAccessoAtti(long accessoAttiId, long intPraticaId, long groupId, String className, long companyId, String screenName) throws Exception { - String protocollo = null; - File allegato = new File(); String doc = String.valueOf(accessoAttiId); @@ -57,25 +45,13 @@ public class ProtocolloUtil { protocolloBean.setUfficioId(String.valueOf(groupId)); protocolloBean.setPraticaId(String.valueOf(accessoAttiId)); protocolloBean.setFiles(Collections.singletonList(allegato)); - Options options = createCall(companyId, protocolloBean, true); - - String responseBody = HttpUtil.URLtoString(options); - if (options.getResponse().getResponseCode() == HttpServletResponse.SC_OK - || options.getResponse().getResponseCode() == HttpServletResponse.SC_CREATED) { - JSONObject risposta = JSONFactoryUtil.createJSONObject(responseBody); - protocollo = risposta.getString("anno") + String.format("%07d", risposta.getInt("numero")); - } else { - throw new Exception(options.getResponse().getResponseCode() + StringPool.SPACE + responseBody); - } - - return protocollo; + JSONObject risposta = HttpServiceUtil.postProtocolloBean(companyId, protocolloBean); + return risposta.getString("anno") + String.format("%07d", risposta.getInt("numero")); } public static String protocollaArrivoAccessoAtti(long groupId, long companyId, String userName, long accessoAttiId, String className) throws Exception { - String protocollo = null; - List allegati = new ArrayList(); File allegato = new File(); String doc = String.valueOf(accessoAttiId); @@ -93,18 +69,8 @@ public class ProtocolloUtil { protocolloBean.setPraticaId(String.valueOf(accessoAttiId)); protocolloBean.setFiles(allegati); - Options options = createCall(companyId, protocolloBean, true); - - String responseBody = HttpUtil.URLtoString(options); - if (options.getResponse().getResponseCode() == HttpServletResponse.SC_OK - || options.getResponse().getResponseCode() == HttpServletResponse.SC_CREATED) { - JSONObject risposta = JSONFactoryUtil.createJSONObject(responseBody); - protocollo = risposta.getString("anno") + String.format("%07d", risposta.getInt("numero")); - } else { - throw new Exception(options.getResponse().getResponseCode() + StringPool.SPACE + responseBody); - } - - return protocollo; + JSONObject risposta = HttpServiceUtil.postProtocolloBean(companyId, protocolloBean); + return risposta.getString("anno") + String.format("%07d", risposta.getInt("numero")); } public static String generaOggettoProtocollo(String className, long classPk) { @@ -120,26 +86,4 @@ public class ProtocolloUtil { return "Oggetto: " + className + " " + classPk; } - - private static Options createCall(long companyId, Protocollo protocolloBean, boolean post) - throws SystemException { - - String url = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, - ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_URL); - - Options options = new Options(); - options.setLocation(url); - options.setPost(post); - - flexjson.JSONSerializer serialize = new flexjson.JSONSerializer(); - serialize.exclude("*.class"); - String protocollo = serialize.serialize(protocolloBean); - Body body = new Body(protocollo, ContentTypes.APPLICATION_JSON, "UTF-8"); - - options.setBody(body); - - return options; - - } - } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java index 01e6c5c8..70e7efa1 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java @@ -18,8 +18,6 @@ import it.tref.liferay.portos.bo.service.IntPraticaServiceUtil; import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil; import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; import it.tref.liferay.portos.bo.shared.bean.FirmeBean; -import it.tref.liferay.portos.bo.shared.bean.FirmeDetail; -import it.tref.liferay.portos.bo.shared.util.Constants; import it.tref.liferay.portos.bo.shared.util.FirmeUtil; import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; import it.tref.liferay.portos.bo.shared.util.TipoIntegrazioneUtil; @@ -55,9 +53,7 @@ import com.liferay.portal.kernel.util.UniqueList; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.workflow.WorkflowConstants; import com.liferay.portal.model.Company; -import com.liferay.portal.model.User; import com.liferay.portal.service.CompanyLocalServiceUtil; -import com.liferay.portal.service.UserLocalServiceUtil; public class ValidazionePraticaUtil { @@ -1338,7 +1334,6 @@ public class ValidazionePraticaUtil { return firme; } - private static final List vuota = new ArrayList<>(); private static final Map> firmeObbligatorie = new HashMap>() { private static final long serialVersionUID = 1L; { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java index 6621f8aa..f97d384e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java @@ -152,12 +152,18 @@ public class SchedulerGeneraDocumento implements MessageListener { String resourcePath = getClass().getName().replaceAll("\\w+\\.", "../") .replace(getClass().getSimpleName(), ReportConstants.PATH_LOGO_REGIONE); - + String resourcePathDip = getClass().getName().replaceAll("\\w+\\.", "../") .replace(getClass().getSimpleName(), ReportConstants.PATH_LOGO_DIPARTIMENTO); - + + _log.info("0 " + resourcePath); + _log.info("1 " + getClass()); + _log.info("2 " + getClass().getResource(resourcePath)); + _log.info("3 " + getClass().getResource(resourcePath).getPath()); + parameters.put(ReportConstants.LOGO_REGIONE, getClass().getResource(resourcePath).getPath()); - parameters.put(ReportConstants.LOGO_DIPARTIMENTO, getClass().getResource(resourcePathDip).getPath()); + parameters.put(ReportConstants.LOGO_DIPARTIMENTO, getClass().getResource(resourcePathDip) + .getPath()); // avviso = gestioneProtocollazione(avviso, dettPratica); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java index 8cc4ca4b..36600946 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java @@ -18,7 +18,6 @@ import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; import it.tref.liferay.portos.bo.service.base.AvvisoLocalServiceBaseImpl; -import it.tref.liferay.portos.bo.shared.util.Constants; import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; import it.tref.liferay.portos.bo.shared.util.TipoIntegrazioneUtil; import it.tref.liferay.portos.bo.util.AvvisoUtil; @@ -135,9 +134,15 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl { long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong( serviceContext.getCompanyId(), propertiesTemplate); - return addAvviso(intPratica.getIntPraticaId(), StringPool.BLANK, new Date(), tipoAvviso, - statoPratica, fileEntryIdTemplate, classPk, className, userCodiceFiscalePrimaFirma, - jsonParameters, controlloPraticaId, serviceContext); + _log.info("statoPratica=" + statoPratica + ", tipoProcedura=" + tipoProcedura + + ", propertiesTemplate=" + propertiesTemplate + ", fileEntryIdTemplate=" + + fileEntryIdTemplate); + + if (fileEntryIdTemplate != 0) { + return addAvviso(intPratica.getIntPraticaId(), StringPool.BLANK, new Date(), tipoAvviso, + statoPratica, fileEntryIdTemplate, classPk, className, userCodiceFiscalePrimaFirma, + jsonParameters, controlloPraticaId, serviceContext); + } } return null; } @@ -204,7 +209,11 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl { _log.info("addAvviso: descLong=\"" + descLong + "\", tipoAvviso=\"" + tipoAvviso + "\", tipoDocumento=\"" + tipoDocumento + "\", className=\"" + className - + "\", jsonParameters=\"" + jsonParameters + "\""); + + "\", jsonParameters=\"" + jsonParameters + "\", fileEntryIdTemplate=" + fileEntryIdTemplate); + + if (0 == fileEntryIdTemplate) { + throw new PortalException("fileEntryIdTemplate=" + fileEntryIdTemplate); + } User user = userPersistence.fetchByPrimaryKey(serviceContext.getUserId()); Date now = new Date(); Avviso avviso = createAvviso(counterLocalService.increment(Avviso.class.getName())); 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 abe8cfbe..7e958047 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 @@ -12,6 +12,7 @@ package it.tref.liferay.portos.bo.service.impl; +import it.mwg.sismica.bo.util.HttpServiceUtil; import it.tref.liferay.portos.bo.NoSuchDettPraticaException; import it.tref.liferay.portos.bo.model.Asseverazione; import it.tref.liferay.portos.bo.model.ControlloPratica; @@ -41,14 +42,8 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; -import javax.servlet.http.HttpServletResponse; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; +import org.apache.http.client.ClientProtocolException; import com.liferay.portal.kernel.dao.orm.Disjunction; import com.liferay.portal.kernel.dao.orm.DynamicQuery; @@ -75,8 +70,6 @@ import com.liferay.portal.kernel.search.SearchContext; import com.liferay.portal.kernel.util.ContentTypes; import com.liferay.portal.kernel.util.FastDateFormatFactoryUtil; import com.liferay.portal.kernel.util.GetterUtil; -import com.liferay.portal.kernel.util.Http.Options; -import com.liferay.portal.kernel.util.HttpUtil; import com.liferay.portal.kernel.util.LocaleUtil; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; @@ -2445,54 +2438,23 @@ public class DettPraticaLocalServiceImpl extends DettPraticaLocalServiceBaseImpl return dettPratica; } - public void sendToVersioning(long dettPraticaId, String url) throws PortalException, SystemException, - NoSuchFieldException, SecurityException, IOException { + public void sendToVersioning(long dettPraticaId, String url) throws Exception { DettPratica dettPratica = dettPraticaLocalService.getDettPratica(dettPraticaId); String jsonToVersioning = dettPratica.serializeToVersioning(); - HttpPost request = new HttpPost(url); - request.setHeader("Content-type", ContentTypes.APPLICATION_JSON); - request.setEntity(new StringEntity(jsonToVersioning)); - CloseableHttpClient client = HttpClientBuilder.create().build(); - HttpResponse response = client.execute(request); - - int statusCode = response.getStatusLine().getStatusCode(); - String responseBody = EntityUtils.toString(response.getEntity(), StringPool.UTF8); - client.close(); - - if (statusCode == HttpServletResponse.SC_OK || statusCode == HttpServletResponse.SC_CREATED) { - JSONObject responseObj = JSONFactoryUtil.createJSONObject(responseBody); - int version = responseObj.getInt("version"); - dettPratica.setVersion(version); - dettPratica.setVersionata(true); - dettPraticaLocalService.updateDettPratica(dettPratica); - - } else { - throw new PortalException(statusCode + StringPool.SPACE + responseBody); - } - + JSONObject responseObj = HttpServiceUtil.postJson(url, jsonToVersioning); + int version = responseObj.getInt("version"); + dettPratica.setVersion(version); + dettPratica.setVersionata(true); + dettPraticaLocalService.updateDettPratica(dettPratica); } - public int getNumeroDiVersioni(String url) throws IOException, PortalException, SystemException { - - Options options = new Options(); - options.setLocation(url); - options.setPost(false); - - String responseBody = HttpUtil.URLtoString(options); - - if (options.getResponse().getResponseCode() == HttpServletResponse.SC_OK) { - return Integer.parseInt(responseBody); - } else { - _log.error(options.getLocation() + ": " + options.getResponse().getResponseCode()); - } - - return 0; + public int getNumeroDiVersioni(String url) throws NumberFormatException, Exception { + return Integer.parseInt(HttpServiceUtil.getUrl(url, "0")); } - public String getVersionNumber(String url, int version) throws IOException, PortalException, - SystemException { + public String getVersionNumber(String url, int version) throws Exception { String response = callToVersion(url); @@ -2510,23 +2472,11 @@ public class DettPraticaLocalServiceImpl extends DettPraticaLocalServiceBaseImpl return jsonFields.toString(); } - private String callToVersion(String versioningURL) throws IOException { - - Options options = new Options(); - options.setLocation(versioningURL); - options.setPost(false); - - String responseBody = HttpUtil.URLtoString(options); - - if (options.getResponse().getResponseCode() == HttpServletResponse.SC_OK) { - return responseBody; - } else { - _log.error(options.getLocation() + ": " + options.getResponse().getResponseCode()); - } - return StringPool.BLANK; + private String callToVersion(String versioningURL) throws Exception { + return HttpServiceUtil.getUrl(versioningURL); } - public JSONArray callForChanges(String url) throws IOException, PortalException, SystemException { + public JSONArray callForChanges(String url) throws Exception { String response = callToVersion(url); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DettPraticaServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DettPraticaServiceImpl.java index 7fb5dc0e..a2afa140 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DettPraticaServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DettPraticaServiceImpl.java @@ -186,12 +186,12 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { boolean normArt3com4, boolean normOrd01, boolean normDm04, boolean normDm05, boolean normCI01, boolean normLTC01, boolean suap, boolean normSismaBonus, String clRischioPreInt, String clRischioPostInt, boolean intervFinPub, String intervFinPubDesc, - ServiceContext serviceContext, boolean bozza, boolean disabledSubmit, boolean geoDisabledSubmit, String paesaggioLocale, - String livelloDiTutela, String vincoli, String destinazioneAltroIntervento, Boolean tcCostruzioniEsistenti, Boolean tcManutOrdStraord, + ServiceContext serviceContext, boolean bozza, boolean disabledSubmit, boolean geoDisabledSubmit, + String paesaggioLocale, String livelloDiTutela, String vincoli, + String destinazioneAltroIntervento, Boolean tcCostruzioniEsistenti, Boolean tcManutOrdStraord, Boolean tcAltriInterventi, String tcAltriInterventiDesc, boolean noCollaudo, - boolean tcNuovaCostruzionePertinenza, boolean tcInterventoOpereEscavazione, - boolean tcViarch, boolean tcOperaA25) - throws PortalException, SystemException { + boolean tcNuovaCostruzionePertinenza, boolean tcInterventoOpereEscavazione, boolean tcViarch, + boolean tcOperaA25) throws PortalException, SystemException { DettPratica dettPratica = null; if (oldDettPraticaId == 0) { @@ -231,8 +231,8 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { tcAdeguamentoSismico, tcMiglioramentoSismico, tcRiparazioneInterventoLocale, normLavoriInProprio, normEsenteBollo, normEsenteSpese, normDpr01Dep, normDpr02Dep, normDpr01Aut, normDpr02Aut, normArt3com3, normArt3com4, - serviceContext, bozza, noCollaudo, tcNuovaCostruzionePertinenza, tcInterventoOpereEscavazione, - tcViarch, tcOperaA25); + serviceContext, bozza, noCollaudo, tcNuovaCostruzionePertinenza, + tcInterventoOpereEscavazione, tcViarch, tcOperaA25); } else { @@ -277,10 +277,10 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { normDm03, normDm2018, normDprg01, normDprg02, normAnr, normArt3com3, normArt3com4, normOrd01, normDm04, normDm05, normCI01, normLTC01, suap, normSismaBonus, clRischioPreInt, clRischioPostInt, intervFinPub, - intervFinPubDesc, serviceContext, bozza, paesaggioLocale, - livelloDiTutela, vincoli, destinazioneAltroIntervento, tcCostruzioniEsistenti, tcManutOrdStraord, - tcAltriInterventi, tcAltriInterventiDesc, noCollaudo, tcNuovaCostruzionePertinenza, tcInterventoOpereEscavazione, - tcViarch, tcOperaA25); + intervFinPubDesc, serviceContext, bozza, paesaggioLocale, livelloDiTutela, + vincoli, destinazioneAltroIntervento, tcCostruzioniEsistenti, tcManutOrdStraord, + tcAltriInterventi, tcAltriInterventiDesc, noCollaudo, + tcNuovaCostruzionePertinenza, tcInterventoOpereEscavazione, tcViarch, tcOperaA25); } @@ -354,23 +354,20 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { normDpr02Dep, normDpr01Aut, normDpr02Aut, normDm01, normDm02, normDm03, normDm2018, normDprg01, normDprg02, normAnr, normArt3com3, normArt3com4, normOrd01, normDm04, normDm05, normCI01, normLTC01, suap, normSismaBonus, clRischioPreInt, clRischioPostInt, - intervFinPub, intervFinPubDesc, serviceContext, bozza, paesaggioLocale, - livelloDiTutela, vincoli, destinazioneAltroIntervento, tcCostruzioniEsistenti, tcManutOrdStraord, - tcAltriInterventi, tcAltriInterventiDesc, noCollaudo, tcNuovaCostruzionePertinenza, tcInterventoOpereEscavazione, - tcViarch, tcOperaA25); + intervFinPub, intervFinPubDesc, serviceContext, bozza, paesaggioLocale, livelloDiTutela, + vincoli, destinazioneAltroIntervento, tcCostruzioniEsistenti, tcManutOrdStraord, + tcAltriInterventi, tcAltriInterventiDesc, noCollaudo, tcNuovaCostruzionePertinenza, + tcInterventoOpereEscavazione, tcViarch, tcOperaA25); } return dettPratica; } public DettPratica fetchDettPratica(long dettPraticaId) throws SystemException { - - // TODO permessi return dettPraticaLocalService.fetchDettPratica(dettPraticaId); } public DettPratica getLastCompletedByIntPratica(long intPraticaId) throws SystemException { - return dettPraticaLocalService.getLastCompletedByIntPratica(intPraticaId); } @@ -440,14 +437,15 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { return dettPraticaLocalService.updateCheckPagamenti(dettPraticaId, normEsenteSpese, normEsenteBollo); } - public DettPratica updateEsito(long dettPraticaId, int stato) throws IOException,SystemException, PortalException { + public DettPratica updateEsito(long dettPraticaId, int stato) throws IOException, SystemException, + PortalException { DettPratica dettPratica = DettPraticaServiceUtil.getDettPratica(dettPraticaId); DettPraticaPermission.check(getPermissionChecker(), dettPratica.getGroupId(), ActionKeys.ADD_ENTRY); return dettPraticaLocalService.updateEsito(dettPraticaId, stato); } - public DettPratica updateEsitoIntegrazione(long dettPraticaId, int stato) throws IOException,SystemException, - PortalException { + public DettPratica updateEsitoIntegrazione(long dettPraticaId, int stato) throws IOException, + SystemException, PortalException { DettPratica dettPratica = DettPraticaServiceUtil.getDettPratica(dettPraticaId); DettPraticaPermission.check(getPermissionChecker(), dettPratica.getGroupId(), ActionKeys.ADD_ENTRY); return dettPraticaLocalService.updateEsitoIntegrazione(dettPraticaId, stato); @@ -477,8 +475,7 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { return dettPraticaLocalService.updatePrincipale(dettPraticaId, codiceFiscale, tipologiaSoggetto); } - public int getNumeroDiVersioni(long intPraticaId, long companyId) throws IOException, PortalException, - SystemException { + public int getNumeroDiVersioni(long intPraticaId, long companyId) throws Exception { Company company = CompanyLocalServiceUtil.getCompany(companyId); String shapshotsCountURL = (String) company.getExpandoBridge().getAttribute( Constants.COMPANY_CUSTOM_FIELD_VERSIONING_SNAPSHOTS_COUNT, false); @@ -488,8 +485,7 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { return dettPraticaLocalService.getNumeroDiVersioni(shapshotsCountURL); } - public String getJsonVersion(long intPraticaId, long companyId, int version) throws PortalException, - SystemException, IOException { + public String getJsonVersion(long intPraticaId, long companyId, int version) throws Exception { Company company = CompanyLocalServiceUtil.getCompany(companyId); String shapshotsURL = (String) company.getExpandoBridge().getAttribute( @@ -501,8 +497,7 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { } - public String callForChanges(long intPraticaId, long companyId, int version) throws IOException, - PortalException, SystemException { + public String callForChanges(long intPraticaId, long companyId, int version) throws Exception { Company company = CompanyLocalServiceUtil.getCompany(companyId); String changesURL = (String) company.getExpandoBridge().getAttribute( Constants.COMPANY_CUSTOM_FIELD_VERSIONING_CHANGES, false); @@ -532,8 +527,7 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { } - public void sendToVersioning(long dettPraticaId, long companyId) throws PortalException, SystemException, - NoSuchFieldException, SecurityException, IOException { + public void sendToVersioning(long dettPraticaId, long companyId) throws Exception { Company company = CompanyLocalServiceUtil.getCompany(companyId); String commitURL = (String) company.getExpandoBridge().getAttribute( diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java index 4f65f41e..785f0930 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/ProtocollazioneUtil.java @@ -1,6 +1,6 @@ package it.tref.liferay.portos.bo.util; -import it.mwg.sismica.bo.util.HttpPostUtil; +import it.mwg.sismica.bo.util.HttpServiceUtil; import it.tref.liferay.portos.bo.model.Avviso; import it.tref.liferay.portos.bo.model.Collaudo; import it.tref.liferay.portos.bo.model.DettPratica; @@ -29,25 +29,14 @@ import java.util.Collections; import java.util.List; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVRecord; import org.apache.commons.io.IOUtils; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; - import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; -import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.repository.model.FileEntry; -import com.liferay.portal.kernel.util.ContentTypes; import com.liferay.portal.kernel.util.GetterUtil; import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.StreamUtil; @@ -104,8 +93,8 @@ public class ProtocollazioneUtil { protocolloBean.setUfficioId(String.valueOf(groupId)); protocolloBean.setPraticaId(String.valueOf(avviso.getClassPk())); protocolloBean.setFiles(Collections.singletonList(allegato)); - JSONObject risposta = HttpPostUtil.postProtocolloBean(avviso.getCompanyId(), protocolloBean); - protocollo = call(avviso.getCompanyId(), protocolloBean); + JSONObject risposta = HttpServiceUtil.postProtocolloBean(avviso.getCompanyId(), protocolloBean); + protocollo = risposta.getString("anno") + String.format("%07d", risposta.getInt("numero")); } finally { StreamUtil.cleanUp(inputStream); } @@ -181,7 +170,8 @@ public class ProtocollazioneUtil { protocolloBean.setPraticaId(String.valueOf(praticaId)); protocolloBean.setFiles(allegati); - return call(companyId, protocolloBean); + JSONObject risposta = HttpServiceUtil.postProtocolloBean(companyId, protocolloBean); + return risposta.getString("anno") + String.format("%07d", risposta.getInt("numero")); } public static String protocollaArrivoAccessoAtti(long groupId, long companyId, String userName, @@ -204,7 +194,8 @@ public class ProtocollazioneUtil { protocolloBean.setPraticaId(String.valueOf(accessoAttiId)); protocolloBean.setFiles(allegati); - return call(companyId, protocolloBean); + JSONObject risposta = HttpServiceUtil.postProtocolloBean(companyId, protocolloBean); + return risposta.getString("anno") + String.format("%07d", risposta.getInt("numero")); } public static String generaOggettoProtocollo(String className, long classPk) { 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 c2e35069..bbc4079a 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=2574 - build.date=1599664865866 + build.number=2589 + build.date=1599752942075 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/lib/httpclient.jar b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/lib/httpclient.jar new file mode 100644 index 00000000..970c9891 Binary files /dev/null and b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/lib/httpclient.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/navigator/domanda/page_dettagli_principali.jsp b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/navigator/domanda/page_dettagli_principali.jsp index 32ff3c08..4a9d7f49 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/navigator/domanda/page_dettagli_principali.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/navigator/domanda/page_dettagli_principali.jsp @@ -188,6 +188,13 @@ + +
+
+ +
+
@@ -291,10 +298,6 @@
-->
-
- -