diff --git a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/commons-logging.jar b/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/commons-logging.jar deleted file mode 100644 index 8758a96b..00000000 Binary files a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/commons-logging.jar and /dev/null differ diff --git a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/log4j.jar b/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/log4j.jar deleted file mode 100644 index 068867eb..00000000 Binary files a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/log4j.jar and /dev/null differ diff --git a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/util-bridges.jar b/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/util-bridges.jar deleted file mode 100644 index 7d7435fe..00000000 Binary files a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/util-bridges.jar and /dev/null differ diff --git a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/util-taglib.jar b/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/util-taglib.jar deleted file mode 100644 index fbba5f0a..00000000 Binary files a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/lib/util-taglib.jar and /dev/null differ diff --git a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/src/it/tref/liferay/portlet/p7mpreview/P7mPreview.java b/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/src/it/tref/liferay/portlet/p7mpreview/P7mPreview.java index 39ed7ce9..c1c6c68d 100644 --- a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/src/it/tref/liferay/portlet/p7mpreview/P7mPreview.java +++ b/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/docroot/WEB-INF/src/it/tref/liferay/portlet/p7mpreview/P7mPreview.java @@ -1,6 +1,8 @@ package it.tref.liferay.portlet.p7mpreview; import com.liferay.portal.kernel.lar.PortletDataContext; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.repository.model.FileEntry; import com.liferay.portal.kernel.repository.model.FileVersion; import com.liferay.portal.kernel.xml.Element; @@ -8,35 +10,34 @@ import com.liferay.portlet.documentlibrary.util.DLPreviewableProcessor; import java.util.List; -public class P7mPreview extends DLPreviewableProcessor{ +public class P7mPreview extends DLPreviewableProcessor { + Log _log = LogFactoryUtil.getLog(P7mPreview.class); @Override public void afterPropertiesSet() throws Exception { // TODO Auto-generated method stub - + } @Override public boolean isSupported(String mimeType) { + _log.info("isSupported(\"" + mimeType + "\""); // TODO Auto-generated method stub return false; } @Override - protected void doExportGeneratedFiles( - PortletDataContext portletDataContext, FileEntry fileEntry, + protected void doExportGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement) throws Exception { // TODO Auto-generated method stub - + } @Override - protected void doImportGeneratedFiles( - PortletDataContext portletDataContext, FileEntry fileEntry, - FileEntry importedFileEntry, Element fileEntryElement) - throws Exception { + protected void doImportGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, + FileEntry importedFileEntry, Element fileEntryElement) throws Exception { // TODO Auto-generated method stub - + } @Override diff --git a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/ivy.xml.MD5 b/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/ivy.xml.MD5 index 3b053b72..65d421b8 100644 --- a/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/ivy.xml.MD5 +++ b/liferay-plugins-sdk-6.2/hooks/portos-p7m-preview-hook/ivy.xml.MD5 @@ -1 +1 @@ -875e1c4437fb71ef78ec054720f63e50 +2c267788e15963b22e4e720e12f5611c diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/hook/CfOrganizationMembershipPolicy.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/hook/CfOrganizationMembershipPolicy.java index 8ac1f3b4..45e6c75f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/hook/CfOrganizationMembershipPolicy.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/hook/CfOrganizationMembershipPolicy.java @@ -24,57 +24,62 @@ import com.liferay.portlet.asset.model.AssetTag; public class CfOrganizationMembershipPolicy extends BaseOrganizationMembershipPolicy { - private static Log _log = LogFactoryUtil.getLog(CfOrganizationMembershipPolicy.class); - - @Override - public void checkMembership(long[] userIds, long[] addOrganizationIds, long[] removeOrganizationIds) {} - - @Override - public boolean isMembershipAllowed(long userId, long groupId) { - - try { - Group group = GroupLocalServiceUtil.getGroup(groupId); - Company company = CompanyLocalServiceUtil.getCompany(group.getCompanyId()); - String allowedCF = (String) company.getExpandoBridge().getAttribute(Constants.CF_ORGANIZATION_MEMBERSHIP, false); - - List allowedCFs = Arrays.asList(allowedCF.split("\\,")); - - User user = UserLocalServiceUtil.getUser(userId); - if (allowedCFs.contains(user.getScreenName())) { - return true; - } - - } catch (PortalException | SystemException e) { - _log.error(e, e); - } - - return false; - } - - @Override - public boolean isMembershipRequired(long userId, long groupId) { - return false; - } - - @Override - public boolean isRoleAllowed(long userId, long groupId, long roleId) { - return true; - } - - @Override - public boolean isRoleRequired(long userId, long groupId, long roleId) { - return false; - } - - @Override - public void propagateMembership(long[] userIds, long[] addOrganizationIds, long[] removeOrganizationIds) {} - - @Override - public void verifyPolicy(Organization organization) {} - - @Override - public void verifyPolicy(Organization organization, Organization oldOrganization, - List oldAssetCategories, List oldAssetTags, - Map oldExpandoAttributes) {} + private static Log _log = LogFactoryUtil.getLog(CfOrganizationMembershipPolicy.class); + + @Override + public void checkMembership(long[] userIds, long[] addOrganizationIds, long[] removeOrganizationIds) { + } + + @Override + public boolean isMembershipAllowed(long userId, long groupId) { + + try { + Group group = GroupLocalServiceUtil.getGroup(groupId); + Company company = CompanyLocalServiceUtil.getCompany(group.getCompanyId()); + String allowedCF = (String) company.getExpandoBridge().getAttribute( + Constants.CF_ORGANIZATION_MEMBERSHIP, false); + + List allowedCFs = Arrays.asList(allowedCF.split("\\,")); + + User user = UserLocalServiceUtil.getUser(userId); + if (allowedCFs.contains(user.getScreenName())) { + return true; + } + + } catch (PortalException | SystemException e) { + _log.error(e, e); + } + + return false; + } + + @Override + public boolean isMembershipRequired(long userId, long groupId) { + return false; + } + + @Override + public boolean isRoleAllowed(long userId, long groupId, long roleId) { + return true; + } + + @Override + public boolean isRoleRequired(long userId, long groupId, long roleId) { + return false; + } + + @Override + public void propagateMembership(long[] userIds, long[] addOrganizationIds, long[] removeOrganizationIds) { + } + + @Override + public void verifyPolicy(Organization organization) { + } + + @Override + public void verifyPolicy(Organization organization, Organization oldOrganization, + List oldAssetCategories, List oldAssetTags, + Map oldExpandoAttributes) { + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java index 0d7231cd..f6ef59b2 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java @@ -746,13 +746,19 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi public Long calculateDateAvvioProcedimento(long controlloPraticaId) throws SystemException, PortalException { + ControlloPratica controllo = ControlloPraticaLocalServiceUtil .fetchControlloPratica(controlloPraticaId); + IntPratica pratica = IntPraticaLocalServiceUtil.fetchIntPratica(controllo.getIntPraticaId()); + + if (pratica.getStatoPratica().equalsIgnoreCase(StatoPraticaConstants.AUTORIZZATA)) { + return 0L; + } Date apertura = pratica.getDtPratica(); Date chiusura = null; - long stop = 0; + long stop = 0L; List avvisi = AvvisoLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, OrderByComparatorFactoryUtil @@ -764,35 +770,39 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi for (Avviso avviso : avvisi) { if (!avviso.isAnnullato()) { String tipo = avviso.getTipoDocumento().toUpperCase(); - _log.debug("Avviso " + avviso.getTipoDocumento() + " " + avviso.getDtAvviso() + " " - + avviso.getCreateDate()); - if (tipo.equals(StatoPraticaConstants.INTEGRAZIONE)) { + _log.debug("Avviso " + tipo + " " + avviso.getDtAvviso() + " " + avviso.getCreateDate()); + switch (tipo) { + case StatoPraticaConstants.INTEGRAZIONE: start = avviso.getCreateDate(); end = null; if (Validator.isNotNull(chiusura)) { apertura = avviso.getDtAvviso(); chiusura = null; - stop = 0; + stop = 0L; _log.debug("Reset apertura al " + apertura); } _log.debug("IN start = " + start + ", pratica " + pratica.getNumeroProgetto()); - } else if (tipo.equals(StatoPraticaConstants.VIDIMATA)) { + break; + case StatoPraticaConstants.VIDIMATA: if (Validator.isNull(chiusura)) { end = avviso.getCreateDate(); _log.debug(tipo + " end = " + end + ", pratica " + pratica.getNumeroProgetto()); } else { apertura = avviso.getDtAvviso(); chiusura = start = end = null; - stop = 0; + stop = 0L; _log.debug("Reset apertura al " + apertura); } - } else if (tipo.equals(StatoPraticaConstants.INTEGRAZIONE_ACCETTATA)) { + break; + case StatoPraticaConstants.INTEGRAZIONE_ACCETTATA: end = avviso.getCreateDate(); _log.debug(tipo + " end = " + end + ", pratica " + pratica.getNumeroProgetto()); - } else if (tipo.equals(StatoPraticaConstants.AUTORIZZATA) - || tipo.equals(StatoPraticaConstants.NON_AUTORIZZATA)) { + break; + case StatoPraticaConstants.AUTORIZZATA: + case StatoPraticaConstants.NON_AUTORIZZATA: chiusura = avviso.getCreateDate(); _log.debug("Chiusura al " + chiusura); + break; } } if (Validator.isNotNull(start) && Validator.isNotNull(end)) { 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 e8d11184..1ea652fd 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 @@ -184,12 +184,11 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { boolean normDprg01, boolean normDprg02, boolean normAnr, boolean normArt3com3, boolean normArt3com4, boolean normOrd01, boolean normDm04, boolean normDm05, boolean normCI01, boolean normLTC01, boolean suap, boolean normSismaBonus, String clRischioPreInt, - String clRischioPostInt, boolean intervFinPub, String intervFinPubDesc, boolean tcNuovaCostruzioneComplessa, - ServiceContext serviceContext, boolean bozza, boolean disabledSubmit, boolean geoDisabledSubmit) - throws PortalException, SystemException { + String clRischioPostInt, boolean intervFinPub, String intervFinPubDesc, + boolean tcNuovaCostruzioneComplessa, ServiceContext serviceContext, boolean bozza, + boolean disabledSubmit, boolean geoDisabledSubmit) throws PortalException, SystemException { DettPratica dettPratica = null; - if (!disabledSubmit && DelegheUtil.hasDelegaCompilazioneDomanda(userId, dettPraticaId)) { dettPratica = dettPraticaLocalService.updateDettPraticaDatiDomanda(userId, dettPraticaId, @@ -227,8 +226,8 @@ public class DettPraticaServiceImpl extends DettPraticaServiceBaseImpl { normEsenteSpese, normDpr01Dep, normDpr02Dep, normDpr01Aut, normDpr02Aut, normDm01, normDm02, normDm03, normDm2018, normDprg01, normDprg02, normAnr, normArt3com3, normArt3com4, normOrd01, normDm04, normDm05, normCI01, normLTC01, suap, normSismaBonus, - clRischioPreInt, clRischioPostInt, intervFinPub, intervFinPubDesc, tcNuovaCostruzioneComplessa, - serviceContext, bozza); + clRischioPreInt, clRischioPostInt, intervFinPub, intervFinPubDesc, + tcNuovaCostruzioneComplessa, serviceContext, bozza); } if (!geoDisabledSubmit && DelegheUtil.hasDelegaCompilazioneSezioneGeologica(userId, dettPraticaId)) { 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 f62bce9b..7a67df93 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=2526 - build.date=1608047904204 + build.number=2533 + build.date=1608199554355 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/view_columns.jspf b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/view_columns.jspf index 59b651c0..0f02300e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/view_columns.jspf +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/view_columns.jspf @@ -60,7 +60,8 @@ DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntP } //Informazioni relative al workflow WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink( - controlloPratica.getCompanyId(),controlloPratica.getGroupId(), ControlloPratica.class.getName(),controlloPratica.getPrimaryKey()); + controlloPratica.getCompanyId(), controlloPratica.getGroupId(), ControlloPratica.class.getName(), + controlloPratica.getPrimaryKey()); List listaTask = null; WorkflowInstance workflowInstance = null; @@ -209,14 +210,16 @@ DettPratica lastDettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntP - <%=provincia.getProvincia()+" - "+comune.getDenominazione() %> + <%= provincia.getProvincia() + " - " + comune.getDenominazione() %> <% long days = ControlloPraticaLocalServiceUtil.calculateDateAvvioProcedimento(controlloPratica.getControlloPraticaId()); + if (days > 0) { + out.print(days); + } %> - <%=days %> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java index a268681d..dd9102c4 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java @@ -909,7 +909,6 @@ public class FascicoloFePortlet extends MVCPortlet { } public void saveDettPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { - ServiceContext serviceContext = ServiceContextFactory.getInstance(DettPratica.class.getName(), actionRequest); long dettPraticaId = ParamUtil.getLong(actionRequest, "dettPraticaId"); @@ -1341,7 +1340,8 @@ public class FascicoloFePortlet extends MVCPortlet { boolean tcMiglioramentoSismico = ParamUtil.getBoolean(actionRequest, "tcMiglioramentoSismico"); boolean tcRiparazioneInterventoLocale = ParamUtil.getBoolean(actionRequest, "tcRiparazioneInterventoLocale"); - boolean tcNuovaCostruzioneComplessa = ParamUtil.getBoolean(actionRequest, "tcNuovaCostruzioneComplessa"); + boolean tcNuovaCostruzioneComplessa = ParamUtil.getBoolean(actionRequest, + "tcNuovaCostruzioneComplessa"); boolean tcInCA = ParamUtil.getBoolean(actionRequest, "tcInCA"); boolean tcInOpera = ParamUtil.getBoolean(actionRequest, "tcInOpera"); @@ -1590,7 +1590,8 @@ public class FascicoloFePortlet extends MVCPortlet { normDpr02Dep, normDpr01Aut, normDpr02Aut, normDm01, normDm02, normDm03, normDm2018, normDprg01, normDprg02, normAnr, normArt3com3, normArt3com4, normOrd01, normDm04, normDm05, normCI01, normLTC01, suap, normSismaBonus, clRischioPreInt, clRischioPostInt, - intervFinPub, intervFinPubDesc, tcNuovaCostruzioneComplessa, serviceContext, bozza, disabledSubmit, geoDisabledSubmit); + intervFinPub, intervFinPubDesc, tcNuovaCostruzioneComplessa, serviceContext, bozza, + disabledSubmit, geoDisabledSubmit); String redirect = ParamUtil.getString(actionRequest, "redirect"); if (Validator.isNull(redirect)) { @@ -1800,7 +1801,8 @@ public class FascicoloFePortlet extends MVCPortlet { boolean tcMiglioramentoSismico = ParamUtil.getBoolean(actionRequest, "tcMiglioramentoSismico"); boolean tcRiparazioneInterventoLocale = ParamUtil.getBoolean(actionRequest, "tcRiparazioneInterventoLocale"); - boolean tcNuovaCostruzioneComplessa = ParamUtil.getBoolean(actionRequest, "tcNuovaCostruzioneComplessa"); + boolean tcNuovaCostruzioneComplessa = ParamUtil.getBoolean(actionRequest, + "tcNuovaCostruzioneComplessa"); boolean tcInCA = ParamUtil.getBoolean(actionRequest, "tcInCA"); boolean tcInOpera = ParamUtil.getBoolean(actionRequest, "tcInOpera"); @@ -2059,7 +2061,8 @@ public class FascicoloFePortlet extends MVCPortlet { normDpr02Dep, normDpr01Aut, normDpr02Aut, normDm01, normDm02, normDm03, normDm2018, normDprg01, normDprg02, normAnr, normArt3com3, normArt3com4, normOrd01, normDm04, normDm05, normCI01, normLTC01, suap, normSismaBonus, clRischioPreInt, clRischioPostInt, - intervFinPub, intervFinPubDesc, tcNuovaCostruzioneComplessa, serviceContext, bozza, disabledSubmit, geoDisabledSubmit); + intervFinPub, intervFinPubDesc, tcNuovaCostruzioneComplessa, serviceContext, bozza, + disabledSubmit, geoDisabledSubmit); String redirect = ParamUtil.getString(actionRequest, "redirect"); if (Validator.isNull(redirect)) { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/allegati_action.jsp b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/allegati_action.jsp index abe623e7..52abdb9a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/allegati_action.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/allegati_action.jsp @@ -1,5 +1,4 @@ <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> - <%@page import="it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil"%> <%@page import="it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil"%> <%@page import="it.tref.liferay.portos.bo.model.IntPratica"%> @@ -21,38 +20,37 @@ <%@include file="/html/allegatipratica/init.jsp"%> <% - - String redirect = ParamUtil.getString(request, "backUrl"); - String comingFrom = ParamUtil.getString(request, "comingFrom"); - long classPk = ParamUtil.getLong(request, "classPk"); - String className = ParamUtil.getString(request, "className"); +String redirect = ParamUtil.getString(request, "backUrl"); +String comingFrom = ParamUtil.getString(request, "comingFrom"); +long classPk = ParamUtil.getLong(request, "classPk"); +String className = ParamUtil.getString(request, "className"); - String refresh="Liferay.fire('allegati-"+comingFrom+"-open');Liferay.Portlet.refresh('#p_p_id_"+PortletKeys.ALLEGATI+"_INSTANCE_page_allegati_');Liferay.Portlet.refresh('#p_p_id_"+PortletKeys.ALLEGATI+"_INSTANCE_page_geologica_');"; +String refresh="Liferay.fire('allegati-"+comingFrom+"-open');Liferay.Portlet.refresh('#p_p_id_"+PortletKeys.ALLEGATI+"_INSTANCE_page_allegati_');Liferay.Portlet.refresh('#p_p_id_"+PortletKeys.ALLEGATI+"_INSTANCE_page_geologica_');"; - long docPraticaId = ParamUtil.getLong(request, "docPraticaId"); - DocPratica docPratica = DocPraticaServiceUtil.getDocPratica(docPraticaId); - FirmeBean firme = FirmeUtil.deserialize(docPratica.getJsonFirmatari()); +long docPraticaId = ParamUtil.getLong(request, "docPraticaId"); +DocPratica docPratica = DocPraticaServiceUtil.getDocPratica(docPraticaId); +FirmeBean firme = FirmeUtil.deserialize(docPratica.getJsonFirmatari()); - boolean disabledInput = ParamUtil.getBoolean(request,"disabledInput", false); +boolean disabledInput = ParamUtil.getBoolean(request,"disabledInput", false); - boolean hasDelegaFirma = DelegheUtil.hasDelegaFirma(user.getUserId(), docPraticaId, "page_geologica".equalsIgnoreCase(comingFrom)); - boolean canSignGeoDocs = "page_geologica".equalsIgnoreCase(comingFrom) && hasDelegaFirma; +boolean hasDelegaFirma = DelegheUtil.hasDelegaFirma(user.getUserId(), docPraticaId, "page_geologica".equalsIgnoreCase(comingFrom)); +boolean canSignGeoDocs = "page_geologica".equalsIgnoreCase(comingFrom) && hasDelegaFirma; %> - <% - if(firme.firmaIsPresent(user.getScreenName())){ - if(firme.firmaIsAnnullabile(user.getScreenName())){ - %> +<% + if (firme.firmaIsPresent(user.getScreenName())) { + if (firme.firmaIsAnnullabile(user.getScreenName())) { +%> - - + +
- +
@@ -89,8 +87,8 @@ <% - } - }else{ + } + } else { %> @@ -133,14 +131,14 @@ <% - } + } %>
- +
diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view.jsp index 70ff3493..10b99f69 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view.jsp @@ -90,7 +90,6 @@ if (Validator.isNotNull(request.getParameter("disabled"))) { Boolean hasDelegaCompilazioneDomanda = (Boolean) SessionUtil.getDettPraticaObject(request, classPk, "hasDelegaCompilazioneDomanda"); if (null == hasDelegaCompilazioneDomanda) { hasDelegaCompilazioneDomanda = DelegheUtil.hasDelegaCompilazioneDomanda(user.getUserId(),classPk); - SessionUtil.setDettPraticaObject(request, classPk, "hasDelegaCompilazioneDomanda", hasDelegaCompilazioneDomanda); } disabledInput = !hasDelegaCompilazioneDomanda && !DelegheUtil.hasDelegaFirmaAllegati(user.getUserId(),classPk); @@ -429,7 +428,7 @@ for (String codiceDoc:tipologiaAllegati) { - diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view_accordion.jsp b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view_accordion.jsp index f7c42c75..0cab8ab1 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view_accordion.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view_accordion.jsp @@ -1,6 +1,4 @@ <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@page import="com.liferay.portal.kernel.log.LogFactoryUtil"%> -<%@page import="com.liferay.portal.kernel.log.Log"%> <%@page import="it.tref.liferay.portos.bo.shared.util.PortletKeys"%> <%@page import="it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil"%> <%@page import="it.tref.liferay.portos.bo.service.IntPraticaLocalService"%> @@ -43,7 +41,6 @@ <%@ include file="/html/allegatipratica/init.jsp"%> <% - Log _log = LogFactoryUtil.getLog("view_accordion.jsp"); String comingFrom = ParamUtil.getString(request,"comingFrom", GetterUtil.getString( PortalUtil.getOriginalServletRequest(request).getParameter("page_allegati"), @@ -151,7 +148,6 @@ <% for(DocPratica docPratica:docPraticas){ long docPraticaId = docPratica.getDocPraticaId(); - _log.info("Processo docPratica id = "+docPraticaId); %> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/build.xml b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/build.xml index 1d83004a..ae43446a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/build.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/build.xml @@ -2,6 +2,6 @@ - + diff --git a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/action/StartUpAction.java b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/action/StartUpAction.java index 6f081627..806f1700 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/action/StartUpAction.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/action/StartUpAction.java @@ -1,6 +1,5 @@ package it.tref.liferay.portos.firma.action; - import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.events.SimpleAction; import com.liferay.portal.kernel.exception.PortalException; @@ -26,99 +25,103 @@ import com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil; public class StartUpAction extends SimpleAction { - private final static Log _log = LogFactoryUtil.getLog(StartUpAction.class); + private final static Log _log = LogFactoryUtil.getLog(StartUpAction.class); - @Override - public void run(String[] companyIds) throws ActionException { + @Override + public void run(String[] companyIds) throws ActionException { - for (String id : companyIds) { - try { - long companyId = GetterUtil.getLong(id); + for (String id : companyIds) { + try { + long companyId = GetterUtil.getLong(id); - String[] defaultActions = {ActionKeys.VIEW, ActionKeys.UPDATE}; - String[] guestActions = {ActionKeys.VIEW}; + String[] defaultActions = { ActionKeys.VIEW, ActionKeys.UPDATE }; + String[] guestActions = { ActionKeys.VIEW }; - // Organization custom fields - addExpandoColumnIfNotExists(companyId, Company.class.getName(), "url_pdf_extractor", - ExpandoColumnConstants.STRING, true, false, defaultActions, guestActions); - addExpandoColumnIfNotExists(companyId, Company.class.getName(), "url-bo-gestione-pratica-firma", - ExpandoColumnConstants.STRING, true, false, defaultActions, guestActions); - } catch (Exception e) { - _log.error("Errore nella procedura automatizzata di configurazione", e); - } - } - } + // Organization custom fields + addExpandoColumnIfNotExists(companyId, Company.class.getName(), "url_pdf_extractor", + ExpandoColumnConstants.STRING, true, false, defaultActions, guestActions); + addExpandoColumnIfNotExists(companyId, Company.class.getName(), + "url-bo-gestione-pratica-firma", ExpandoColumnConstants.STRING, true, false, + defaultActions, guestActions); + } catch (Exception e) { + _log.error("Errore nella procedura automatizzata di configurazione", e); + } + } + } - private ExpandoColumn addExpandoColumnIfNotExists(long companyId, String className, String name, int type, - boolean indexed, boolean hidden, String[] defaultActions, String[] guestActions) throws SystemException { + private ExpandoColumn addExpandoColumnIfNotExists(long companyId, String className, String name, + int type, boolean indexed, boolean hidden, String[] defaultActions, String[] guestActions) + throws SystemException { - long classNameId = PortalUtil.getClassNameId(className); + long classNameId = PortalUtil.getClassNameId(className); - ExpandoTable expandoTable = null; - try { - expandoTable = - ExpandoTableLocalServiceUtil.getTable(companyId, classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME); - } catch (PortalException e) { - try { - expandoTable = - ExpandoTableLocalServiceUtil.addTable(companyId, classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME); - } catch (PortalException e1) { - } - } + ExpandoTable expandoTable = null; + try { + expandoTable = ExpandoTableLocalServiceUtil.getTable(companyId, classNameId, + ExpandoTableConstants.DEFAULT_TABLE_NAME); + } catch (PortalException e) { + try { + expandoTable = ExpandoTableLocalServiceUtil.addTable(companyId, classNameId, + ExpandoTableConstants.DEFAULT_TABLE_NAME); + } catch (PortalException e1) { + } + } - ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), name); + ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil + .getColumn(expandoTable.getTableId(), name); - if (expandoColumn == null) { + if (expandoColumn == null) { - try { - expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), name, type); + try { + expandoColumn = ExpandoColumnLocalServiceUtil + .addColumn(expandoTable.getTableId(), name, type); - } catch (PortalException e) { - } - } + } catch (PortalException e) { + } + } - try { + try { - if (indexed) { + if (indexed) { - UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties(); + UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties(); - typeSettingsProperties.put(ExpandoColumnConstants.INDEX_TYPE, - String.valueOf(ExpandoColumnConstants.INDEX_TYPE_TEXT)); + typeSettingsProperties.put(ExpandoColumnConstants.INDEX_TYPE, + String.valueOf(ExpandoColumnConstants.INDEX_TYPE_TEXT)); - expandoColumn.setTypeSettingsProperties(typeSettingsProperties); + expandoColumn.setTypeSettingsProperties(typeSettingsProperties); - expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn); - } + expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn); + } - if (hidden) { + if (hidden) { - UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties(); + UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties(); - typeSettingsProperties.put(ExpandoColumnConstants.PROPERTY_HIDDEN, String.valueOf(1)); + typeSettingsProperties.put(ExpandoColumnConstants.PROPERTY_HIDDEN, String.valueOf(1)); - expandoColumn.setTypeSettingsProperties(typeSettingsProperties); + expandoColumn.setTypeSettingsProperties(typeSettingsProperties); - expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn); - } + expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn); + } - Role roleGuest = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST); - Role rolePowerUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.POWER_USER); - Role roleUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER); + Role roleGuest = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST); + Role rolePowerUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.POWER_USER); + Role roleUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER); - ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), - ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), roleGuest.getRoleId(), - guestActions); - ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), - ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), rolePowerUser.getRoleId(), - defaultActions); - ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), - ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), roleUser.getRoleId(), - defaultActions); - } catch (PortalException e) { - } + ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, + ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, + String.valueOf(expandoColumn.getColumnId()), roleGuest.getRoleId(), guestActions); + ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, + ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, + String.valueOf(expandoColumn.getColumnId()), rolePowerUser.getRoleId(), defaultActions); + ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, + ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, + String.valueOf(expandoColumn.getColumnId()), roleUser.getRoleId(), defaultActions); + } catch (PortalException e) { + } - return expandoColumn; - } + return expandoColumn; + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/servlet/FirmaServlet.java b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/servlet/FirmaServlet.java index 65058fa5..af4c8de1 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/servlet/FirmaServlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/servlet/FirmaServlet.java @@ -33,156 +33,161 @@ import javax.servlet.http.HttpServletResponse; public class FirmaServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - private static final String GET_CONFIGURATION = "get-configuration"; // get - private static final String GET_FILE_LIST = "get-file-list"; // post - private static final String GET_FILE = "get-file"; // post - private static final String GET_TYPE = "get-type"; // get - private static final String GET_TYPE_VERBALE = "get-type-verbale"; // get - private static final String LOGIN = "login"; // get - private static final String OPEN_PRATICA = "open-pratica"; // post - private static final String RIFIUTA = "rifiuta"; // post - private static final String SET_FILE = "set-file"; // post - private static final String VERSION = "version"; // get - private static final String GET_STILE = "get-stile"; // get - - private static final Log _log = LogFactoryUtil.getLog(FirmaServlet.class); - - /** - * @see HttpServlet#HttpServlet() - */ - public FirmaServlet() { - - super(); - } - - /** - * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String pathInfo = request.getPathInfo().substring(1); - String[] pathArray = StringUtil.split(pathInfo, "/"); - FirmaGetUtil firmaGetUtil = new FirmaGetUtil(); - String metodo = pathArray[0]; - Risposta risposta = new Risposta<>(); - - switch (metodo) { - case GET_CONFIGURATION: - risposta = firmaGetUtil.getConfiguration(); - break; - - case GET_TYPE: - risposta = firmaGetUtil.getType(); - break; - - case GET_TYPE_VERBALE: - risposta = firmaGetUtil.getTypeVerbale(); - break; - - case LOGIN: - if (pathArray.length == 2) { - String codiceFiscale = pathArray[1]; - risposta = firmaGetUtil.loginCodiceFiscale(codiceFiscale); - } - if (pathArray.length == 3) { - String nome = pathArray[1]; - String cognome = pathArray[2]; - risposta = firmaGetUtil.loginNomeCognome(nome, cognome); - } - break; - - case VERSION: - risposta = firmaGetUtil.version(); - break; - - case GET_STILE: - risposta = firmaGetUtil.getStile(); - break; - - } - JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer(); - jsonSerializer.exclude("*.class"); - String jsonResponse = jsonSerializer.serializeDeep(risposta); - - response.setContentType("application/json; charset=UTF-8"); - ServletResponseUtil.write(response, jsonResponse); - - } - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - String pathInfo = request.getPathInfo().substring(1); - String[] pathArray = StringUtil.split(pathInfo, "/"); - - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - StreamUtil.transfer(request.getInputStream(), outputStream); - String token = new String(outputStream.toByteArray(), StandardCharsets.UTF_8); - - FirmaPostUtil firmaPostUtil = new FirmaPostUtil(); - String metodo = pathArray[0]; - Risposta risposta = new Risposta<>(); - - switch (metodo) { - case GET_FILE: - if (pathArray.length == 3) { - String tipo = pathArray[1]; - String id = pathArray[2]; - risposta = firmaPostUtil.getFile(token, tipo, id); - } - break; - - case GET_FILE_LIST: - risposta = firmaPostUtil.getFileList(token); - break; - - case OPEN_PRATICA: - if (pathArray.length == 2) { - String idFile = pathArray[1]; - risposta = firmaPostUtil.openPratica(token, idFile); - } - break; - - case RIFIUTA: - if (pathArray.length == 5) { - String idFile = pathArray[1]; - String messaggio = pathArray[2]; - String cambiaFase = pathArray[3]; - String assegna = pathArray[4]; - risposta = firmaPostUtil.rifiuta(token, idFile, messaggio, cambiaFase, assegna); - } - break; - - case SET_FILE: - if (pathArray.length == 3) { - String tipo = pathArray[1]; - String idFile = pathArray[2]; - JSONDeserializer> jsonDeserializer = JSONFactoryUtil.createJSONDeserializer(); - Map map = jsonDeserializer.deserialize(token); - - ServiceContext serviceContext = null; - try { - serviceContext = ServiceContextFactory.getInstance(request); - } catch (PortalException | SystemException e) { - _log.error(e.getMessage()); - } - - risposta = firmaPostUtil.setFile(map.get("token"), map.get("file"), tipo, idFile, serviceContext); - } - break; - } - - JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer(); - jsonSerializer.exclude("*.class"); - String jsonResponse = jsonSerializer.serialize(risposta); - - response.setContentType("application/json; charset=UTF-8"); - ServletResponseUtil.write(response, jsonResponse); - } + private static final long serialVersionUID = 1L; + + private static final String GET_CONFIGURATION = "get-configuration"; // get + private static final String GET_FILE_LIST = "get-file-list"; // post + private static final String GET_FILE = "get-file"; // post + private static final String GET_TYPE = "get-type"; // get + private static final String GET_TYPE_VERBALE = "get-type-verbale"; // get + private static final String LOGIN = "login"; // get + private static final String OPEN_PRATICA = "open-pratica"; // post + private static final String RIFIUTA = "rifiuta"; // post + private static final String SET_FILE = "set-file"; // post + private static final String VERSION = "version"; // get + private static final String GET_STILE = "get-stile"; // get + + private static final Log _log = LogFactoryUtil.getLog(FirmaServlet.class); + + /** + * @see HttpServlet#HttpServlet() + */ + public FirmaServlet() { + super(); + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse + * response) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, + IOException { + + String pathInfo = request.getPathInfo().substring(1); + String[] pathArray = StringUtil.split(pathInfo, "/"); + FirmaGetUtil firmaGetUtil = new FirmaGetUtil(); + String metodo = pathArray[0]; + Risposta risposta = new Risposta<>(); + + switch (metodo) { + case GET_CONFIGURATION: + risposta = firmaGetUtil.getConfiguration(); + break; + + case GET_TYPE: + risposta = firmaGetUtil.getType(); + break; + + case GET_TYPE_VERBALE: + risposta = firmaGetUtil.getTypeVerbale(); + break; + + case LOGIN: + if (pathArray.length == 2) { + String codiceFiscale = pathArray[1]; + risposta = firmaGetUtil.loginCodiceFiscale(codiceFiscale); + } + if (pathArray.length == 3) { + String nome = pathArray[1]; + String cognome = pathArray[2]; + risposta = firmaGetUtil.loginNomeCognome(nome, cognome); + } + break; + + case VERSION: + risposta = firmaGetUtil.version(); + break; + + case GET_STILE: + risposta = firmaGetUtil.getStile(); + break; + + } + JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer(); + jsonSerializer.exclude("*.class"); + String jsonResponse = jsonSerializer.serializeDeep(risposta); + + response.setContentType("application/json; charset=UTF-8"); + ServletResponseUtil.write(response, jsonResponse); + + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse + * response) + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, + IOException { + + String pathInfo = request.getPathInfo().substring(1); + String[] pathArray = StringUtil.split(pathInfo, "/"); + + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + StreamUtil.transfer(request.getInputStream(), outputStream); + String token = new String(outputStream.toByteArray(), StandardCharsets.UTF_8); + + FirmaPostUtil firmaPostUtil = new FirmaPostUtil(); + String metodo = pathArray[0]; + Risposta risposta = new Risposta<>(); + + switch (metodo) { + case GET_FILE: + if (pathArray.length == 3) { + String tipo = pathArray[1]; + String id = pathArray[2]; + risposta = firmaPostUtil.getFile(token, tipo, id); + } + break; + + case GET_FILE_LIST: + risposta = firmaPostUtil.getFileList(token); + break; + + case OPEN_PRATICA: + if (pathArray.length == 2) { + String idFile = pathArray[1]; + risposta = firmaPostUtil.openPratica(token, idFile); + } + break; + + case RIFIUTA: + if (pathArray.length == 5) { + String idFile = pathArray[1]; + String messaggio = pathArray[2]; + String cambiaFase = pathArray[3]; + String assegna = pathArray[4]; + risposta = firmaPostUtil.rifiuta(token, idFile, messaggio, cambiaFase, assegna); + } + break; + + case SET_FILE: + if (pathArray.length == 3) { + String tipo = pathArray[1]; + String idFile = pathArray[2]; + JSONDeserializer> jsonDeserializer = JSONFactoryUtil + .createJSONDeserializer(); + Map map = jsonDeserializer.deserialize(token); + + ServiceContext serviceContext = null; + try { + serviceContext = ServiceContextFactory.getInstance(request); + } catch (PortalException | SystemException e) { + _log.error(e.getMessage()); + } + + risposta = firmaPostUtil.setFile(map.get("token"), map.get("file"), tipo, idFile, + serviceContext); + } + break; + } + + JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer(); + jsonSerializer.exclude("*.class"); + String jsonResponse = jsonSerializer.serialize(risposta); + + response.setContentType("application/json; charset=UTF-8"); + ServletResponseUtil.write(response, jsonResponse); + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/ExtractorResponse.java b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/ExtractorResponse.java index 9eb9bc21..2618ea7a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/ExtractorResponse.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/ExtractorResponse.java @@ -3,19 +3,14 @@ package it.tref.liferay.portos.firma.util; import java.util.List; public class ExtractorResponse { + private boolean success; + private List cf; - private boolean success; - private List cf; - - public boolean isSuccess() { - - return success; - } - - public List getCf() { - - return cf; - } - + public boolean isSuccess() { + return success; + } + public List getCf() { + return cf; + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaPostUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaPostUtil.java index 4d241107..fb99e891 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaPostUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaPostUtil.java @@ -40,268 +40,248 @@ import org.apache.commons.io.IOUtils; public class FirmaPostUtil { - private static final Log _log = LogFactoryUtil.getLog(FirmaPostUtil.class); - - public Risposta> getFileList(String token) { - - /** - * Verificare che il token sia il codice fiscale altrimenti c e un metodo che estre il cod fisc - * dal token userCodiceFiscalePrimaFirma = al cod fisc di Avviso...tipoAvviso = S && - * fileEntryIdInvio = 0 && fileEntryIdBase != 0 && !rifiutato ( aggiungere campo al service e - * anche campo dtRifiuto) con il fileEntryIdBase prendo il file e uso per riempire lista di - * ritorno - * - * NEL RITORNO "tipoDocumento" è documenttype con intPraticaId faccio fetch su tabella - * intPratica e prendo campo tipopratica - * - */ - long[] companyIds = PortalUtil.getCompanyIds(); - Risposta> risposta = new Risposta>(); - for (long companyId : companyIds) { - - - Company company = null; - try { - company = CompanyLocalServiceUtil.getCompany(companyId); - } catch (Exception e) { - _log.error(e, e); - } - String urlPdfExtractor = (String) company.getExpandoBridge().getAttribute("url_pdf_extractor", false); - if (Validator.isNotNull(urlPdfExtractor)) { - byte[] fileArray = Base64.decode(token); - - List listaCodiciFiscali = FirmaUtil.getCodiceFiscale(fileArray, urlPdfExtractor); - String cf = listaCodiciFiscali.get(0); - - List listaFile = new ArrayList(); - - // Ricordarsi di verificare che nel token ci sia il cod fisc in chiaro altrimenti va - // estratto - try { - - // List listaAvvisi = AvvisoLocalServiceUtil.findByIntPratica(1001, -1, -1, null); - - List listaAvvisi = AvvisoLocalServiceUtil.getListaAvvisiPerApplet(cf); - if (Validator.isNotNull(listaAvvisi) && listaAvvisi.size() > 0) { - - for (Avviso avviso : listaAvvisi) { - - if (Validator.isNotNull(avviso.getFileEntryIdBase())) { - DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.fetchDLFileEntry(avviso.getFileEntryIdBase()); - IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(avviso.getIntPraticaId()); - if (Validator.isNotNull(fileEntry)) { - - RestFile restFile = new RestFile(); - restFile.setIdFile(GetterUtil.getInteger(avviso.getAvvisoId())); - restFile.setDataInvio(new Date()); - - String tipoDocumento = avviso.translateTipoDocumento(); - - restFile.setDocumentiType(avviso.getTipoDocumento()); // TO-VERIFY - restFile.setNomeFile(LanguageUtil.get(Locale.ITALIAN, tipoDocumento) + StringPool.SPACE - + StringPool.DASH + StringPool.SPACE + intPratica.getTitle(Locale.ITALIAN, true)); - restFile.setFile(""); - - Group group = GroupLocalServiceUtil.getGroup(avviso.getGroupId()); - Organization organization = OrganizationLocalServiceUtil.getOrganization(group.getOrganizationId()); - restFile.setTipoPratica(organization.getName()); - - listaFile.add(restFile); - } - } - } - } - - risposta.setObj(listaFile); - risposta.setRisposta(RispostaCostanti.OK); - - } catch (Exception e) { - _log.error(e.getMessage(), e); - risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); - } - } - } - return risposta; - } - - public Risposta getFile(String token, String tipo, String id) { - - /* - * verra passato l avviso id facciamo query per riprendere file entry e ritorniamo quel file con - * il contenuto - */ - - Risposta risposta = new Risposta(); - - try { - - Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(GetterUtil.getLong(id)); - if (Validator.isNotNull(avviso)) { - - if (Validator.isNotNull(avviso.getFileEntryIdBase())) { - DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.fetchDLFileEntry(avviso.getFileEntryIdBase()); - if (Validator.isNotNull(fileEntry)) { - - RestFile restFile = new RestFile(); - restFile.setIdFile(GetterUtil.getInteger(avviso.getAvvisoId())); - restFile.setDataInvio(new Date()); - restFile.setDocumentiType(avviso.getTipoDocumento()); // TO-VERIFY - restFile.setNomeFile(fileEntry.getTitle() + StringPool.PERIOD + fileEntry.getExtension()); - restFile.setTipoPratica(StringPool.BLANK); - // Recupero il tipo di pratica - /* - * if (Validator.isNotNull(avviso.getIntPraticaId())) { IntPratica intPratica = - * IntPraticaLocalServiceUtil.fetchIntPratica(avviso.getIntPraticaId()); if - * (Validator.isNotNull(intPratica)) { - * restFile.setTipoPratica(intPratica.getTipoPratica()); } } - */ - - // Inserisco il contenuto del file in Base64 - - InputStream fileInputStream = - DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), fileEntry.getVersion()); - - ByteArrayOutputStream bao = new ByteArrayOutputStream(); - IOUtils.copy(fileInputStream, bao); - restFile.setFile(Base64.encode(bao.toByteArray())); - - risposta.setRisposta(RispostaCostanti.OK); - risposta.setObj(restFile); - - } - } - } - - } catch (SystemException e) { - _log.error(e.getMessage(), e); - risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); - } catch (PortalException e) { - _log.error(e.getMessage(), e); - risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); - } catch (IOException e) { - _log.error(e.getMessage(), e); - risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); - } - - return risposta; - } - - public Risposta openPratica(String token, String idFile) { - - /** - * mi arriva l'avviso id e mi recupero l intpraticaid bisogna ritornare ad una pagina privata di - * bo con la view sistemata per gestire direttamente la pratica portos-bo-portlet fascicolo - * portlet ..... intpraticaid - */ - Risposta risposta = new Risposta(); - - try { - - Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(GetterUtil.getLong(idFile)); - if (Validator.isNotNull(avviso)) { - - // Prendo la url della pagina da ritornare settata nel expando custom field della company - // di riferimento e ci aggiungo nella url l attributo relativo all id della intPratica - Company company = CompanyLocalServiceUtil.fetchCompany(avviso.getCompanyId()); - if (Validator.isNotNull(company)) { - - String urlToBack = - GetterUtil.getString(company.getExpandoBridge().getAttribute("url-bo-gestione-pratica-firma", false)); - - urlToBack = urlToBack + "&_1_WAR_portosboportlet_intPraticaId=" + avviso.getIntPraticaId(); - risposta.setObj(urlToBack); - risposta.setRisposta(RispostaCostanti.OK); - } - - } - - - } catch (SystemException e) { - _log.error(e.getMessage(), e); - risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); - } - - return risposta; - - } - - public Risposta rifiuta(String token, String idFile, String messaggio, String cambiaFase, String assegna) { - - /** - * mi arriva l'avviso id lo recupero e setto rifiutato e dtRifiuto e aggiorno - * - * - */ - Risposta risposta = new Risposta(); - - - try { - - Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(GetterUtil.getLong(idFile)); - if (Validator.isNotNull(avviso)) { - avviso.setRifiutato(true); - avviso.setDtRifiuto(new Date()); - avviso.setCommentoRifiuto(Validator.isNotNull(messaggio) ? messaggio : StringPool.BLANK); - - AvvisoLocalServiceUtil.updateAvviso(avviso); - risposta.setObj(true); - risposta.setRisposta(RispostaCostanti.OK); - - } - - } catch (SystemException e) { - _log.error(e.getMessage(), e); - risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); - } - - return risposta; - } - - public Risposta setFile(String token, String fileToSave, String tipo, String idFile, - ServiceContext serviceContext) { - - /** - * Mi arriverà l avviso id e il contenuto e creero un file entry e aggiornero l avviso con il - * fileEntryIdInvio - * - * per la creazione del fileentry devo vedere SchedulerGeneraDocumento per creare il filename e - * la folder - * - */ - Risposta risposta = new Risposta(); - - try { - - Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(GetterUtil.getLong(idFile)); - if (Validator.isNotNull(avviso)) { - - // CREO IL FILE - serviceContext.setCompanyId(avviso.getCompanyId()); - serviceContext.setScopeGroupId(avviso.getGroupId()); - serviceContext.setUserId(avviso.getUserId()); - - avviso = - AvvisoLocalServiceUtil - .addFileFirmato(avviso.getAvvisoId(), avviso.getClassPk(), fileToSave, serviceContext); - - risposta.setObj(true); - risposta.setRisposta(RispostaCostanti.OK); - } - - } catch (SystemException e) { - _log.error(e.getMessage(), e); - risposta.setObj(false); - risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); - } catch (PortalException e) { - _log.error(e.getMessage(), e); - risposta.setObj(false); - risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); - } catch (Exception e) { - _log.error(e.getMessage(), e); - risposta.setObj(false); - risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); - } - - return risposta; - } + private static final Log _log = LogFactoryUtil.getLog(FirmaPostUtil.class); + + public Risposta> getFileList(String token) { + + /** + * Verificare che il token sia il codice fiscale altrimenti c e un + * metodo che estre il cod fisc dal token userCodiceFiscalePrimaFirma = + * al cod fisc di Avviso...tipoAvviso = S && fileEntryIdInvio = 0 && + * fileEntryIdBase != 0 && !rifiutato ( aggiungere campo al service e + * anche campo dtRifiuto) con il fileEntryIdBase prendo il file e uso + * per riempire lista di ritorno + * + * NEL RITORNO "tipoDocumento" è documenttype con intPraticaId faccio + * fetch su tabella intPratica e prendo campo tipopratica + * + */ + long[] companyIds = PortalUtil.getCompanyIds(); + Risposta> risposta = new Risposta>(); + for (long companyId : companyIds) { + + Company company = null; + try { + company = CompanyLocalServiceUtil.getCompany(companyId); + } catch (Exception e) { + _log.error(e, e); + } + String urlPdfExtractor = (String) company.getExpandoBridge().getAttribute("url_pdf_extractor", + false); + if (Validator.isNotNull(urlPdfExtractor)) { + byte[] fileArray = Base64.decode(token); + + List listaCodiciFiscali = FirmaUtil.getCodiceFiscale(fileArray, urlPdfExtractor); + String cf = listaCodiciFiscali.get(0); + + List listaFile = new ArrayList(); + + try { + List listaAvvisi = AvvisoLocalServiceUtil.getListaAvvisiPerApplet(cf); + if (Validator.isNotNull(listaAvvisi) && listaAvvisi.size() > 0) { + + for (Avviso avviso : listaAvvisi) { + + if (Validator.isNotNull(avviso.getFileEntryIdBase())) { + DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.fetchDLFileEntry(avviso + .getFileEntryIdBase()); + IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(avviso + .getIntPraticaId()); + if (Validator.isNotNull(fileEntry)) { + + RestFile restFile = new RestFile(); + restFile.setIdFile(GetterUtil.getInteger(avviso.getAvvisoId())); + restFile.setDataInvio(new Date()); + + String tipoDocumento = avviso.translateTipoDocumento(); + + restFile.setDocumentiType(avviso.getTipoDocumento()); // TO-VERIFY + restFile.setNomeFile(LanguageUtil.get(Locale.ITALIAN, tipoDocumento) + + StringPool.SPACE + StringPool.DASH + StringPool.SPACE + + intPratica.getTitle(Locale.ITALIAN, true)); + restFile.setFile(""); + + Group group = GroupLocalServiceUtil.getGroup(avviso.getGroupId()); + Organization organization = OrganizationLocalServiceUtil + .getOrganization(group.getOrganizationId()); + restFile.setTipoPratica(organization.getName()); + + listaFile.add(restFile); + } + } + } + } + + risposta.setObj(listaFile); + risposta.setRisposta(RispostaCostanti.OK); + + } catch (Exception e) { + _log.error(e.getMessage(), e); + risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); + } + } + } + return risposta; + } + + public Risposta getFile(String token, String tipo, String id) { + + /* + * verra passato l avviso id facciamo query per riprendere file entry e + * ritorniamo quel file con il contenuto + */ + + Risposta risposta = new Risposta(); + + try { + + Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(GetterUtil.getLong(id)); + if (Validator.isNotNull(avviso)) { + + if (Validator.isNotNull(avviso.getFileEntryIdBase())) { + DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.fetchDLFileEntry(avviso + .getFileEntryIdBase()); + if (Validator.isNotNull(fileEntry)) { + + RestFile restFile = new RestFile(); + restFile.setIdFile(GetterUtil.getInteger(avviso.getAvvisoId())); + restFile.setDataInvio(new Date()); + restFile.setDocumentiType(avviso.getTipoDocumento()); // TO-VERIFY + restFile.setNomeFile(fileEntry.getTitle() + StringPool.PERIOD + + fileEntry.getExtension()); + restFile.setTipoPratica(StringPool.BLANK); + + // Inserisco il contenuto del file in Base64 + InputStream fileInputStream = DLFileEntryLocalServiceUtil.getFileAsStream( + fileEntry.getFileEntryId(), fileEntry.getVersion()); + ByteArrayOutputStream bao = new ByteArrayOutputStream(); + IOUtils.copy(fileInputStream, bao); + restFile.setFile(Base64.encode(bao.toByteArray())); + + risposta.setRisposta(RispostaCostanti.OK); + risposta.setObj(restFile); + + } + } + } + + } catch (SystemException | PortalException | IOException e) { + _log.error(e.getMessage(), e); + risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); + } + + return risposta; + } + + public Risposta openPratica(String token, String idFile) { + + /** + * mi arriva l'avviso id e mi recupero l intpraticaid bisogna ritornare + * ad una pagina privata di bo con la view sistemata per gestire + * direttamente la pratica portos-bo-portlet fascicolo portlet ..... + * intpraticaid + */ + Risposta risposta = new Risposta(); + + try { + + Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(GetterUtil.getLong(idFile)); + if (Validator.isNotNull(avviso)) { + + // Prendo la url della pagina da ritornare settata nel expando + // custom field della company + // di riferimento e ci aggiungo nella url l attributo relativo + // all id della intPratica + Company company = CompanyLocalServiceUtil.fetchCompany(avviso.getCompanyId()); + if (Validator.isNotNull(company)) { + + String urlToBack = GetterUtil.getString(company.getExpandoBridge().getAttribute( + "url-bo-gestione-pratica-firma", false)); + + urlToBack = urlToBack + "&_1_WAR_portosboportlet_intPraticaId=" + + avviso.getIntPraticaId(); + risposta.setObj(urlToBack); + risposta.setRisposta(RispostaCostanti.OK); + } + + } + + } catch (SystemException e) { + _log.error(e.getMessage(), e); + risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); + } + + return risposta; + + } + + public Risposta rifiuta(String token, String idFile, String messaggio, String cambiaFase, + String assegna) { + + /** + * mi arriva l'avviso id lo recupero e setto rifiutato e dtRifiuto e + * aggiorno + * + * + */ + Risposta risposta = new Risposta(); + + try { + + Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(GetterUtil.getLong(idFile)); + if (Validator.isNotNull(avviso)) { + avviso.setRifiutato(true); + avviso.setDtRifiuto(new Date()); + avviso.setCommentoRifiuto(Validator.isNotNull(messaggio) ? messaggio : StringPool.BLANK); + + AvvisoLocalServiceUtil.updateAvviso(avviso); + risposta.setObj(true); + risposta.setRisposta(RispostaCostanti.OK); + + } + + } catch (SystemException e) { + _log.error(e.getMessage(), e); + risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); + } + + return risposta; + } + + public Risposta setFile(String token, String fileToSave, String tipo, String idFile, + ServiceContext serviceContext) { + + /** + * Mi arriverà l avviso id e il contenuto e creero un file entry e + * aggiornero l avviso con il fileEntryIdInvio + * + * per la creazione del fileentry devo vedere SchedulerGeneraDocumento + * per creare il filename e la folder + * + */ + Risposta risposta = new Risposta(); + + try { + Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(GetterUtil.getLong(idFile)); + if (Validator.isNotNull(avviso)) { + + // CREO IL FILE + serviceContext.setCompanyId(avviso.getCompanyId()); + serviceContext.setScopeGroupId(avviso.getGroupId()); + serviceContext.setUserId(avviso.getUserId()); + + avviso = AvvisoLocalServiceUtil.addFileFirmato(avviso.getAvvisoId(), avviso.getClassPk(), + fileToSave, serviceContext); + + risposta.setObj(true); + risposta.setRisposta(RispostaCostanti.OK); + } + } catch (Exception e) { + _log.error(e.getMessage(), e); + risposta.setObj(false); + risposta.setRisposta(RispostaCostanti.ERRORE_APPLICAZIONE); + } + + return risposta; + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java index 741f2cc6..4a8308e3 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/firma/util/FirmaUtil.java @@ -25,65 +25,64 @@ import org.apache.http.impl.client.DefaultHttpClient; public class FirmaUtil { - private static final Log _log = LogFactoryUtil.getLog(FirmaUtil.class); + private static final Log _log = LogFactoryUtil.getLog(FirmaUtil.class); - public static javax.portlet.PortletPreferences getPortletPreferences() { + public static javax.portlet.PortletPreferences getPortletPreferences() { - List pr = null; - String preferencesXML; - javax.portlet.PortletPreferences jxPortletPreferences = null; - try { - pr = - PortletPreferencesLocalServiceUtil.getPortletPreferences(PortletKeys.PREFS_OWNER_TYPE_COMPANY, 0, - "firma_WAR_portosfirmaportlet"); - preferencesXML = pr.get(0).getPreferences(); - jxPortletPreferences = PortletPreferencesFactoryUtil.fromDefaultXML(preferencesXML); - } catch (SystemException e) { - _log.error(e.getMessage()); - } + List pr = null; + String preferencesXML; + javax.portlet.PortletPreferences jxPortletPreferences = null; + try { + pr = PortletPreferencesLocalServiceUtil.getPortletPreferences( + PortletKeys.PREFS_OWNER_TYPE_COMPANY, 0, "firma_WAR_portosfirmaportlet"); + preferencesXML = pr.get(0).getPreferences(); + jxPortletPreferences = PortletPreferencesFactoryUtil.fromDefaultXML(preferencesXML); + } catch (SystemException e) { + _log.error(e.getMessage()); + } - return jxPortletPreferences; - } + return jxPortletPreferences; + } - public static List getCodiceFiscale(byte[] fileArray, String urlPdfExtractor) { + public static List getCodiceFiscale(byte[] fileArray, String urlPdfExtractor) { - List listaCodiciFiscali = null; - try { + List listaCodiciFiscali = null; + try { - File file = File.createTempFile("codicefiscale", ".p7m"); - FileUtils.writeByteArrayToFile(file, fileArray); + File file = File.createTempFile("codicefiscale", ".p7m"); + FileUtils.writeByteArrayToFile(file, fileArray); - ObjectMapper mapper = new ObjectMapper(); + ObjectMapper mapper = new ObjectMapper(); - // long companyId = CompanyThreadLocal.getCompanyId(); + // long companyId = CompanyThreadLocal.getCompanyId(); + ContentBody body = new FileBody(file); - ContentBody body = new FileBody(file); + MultipartEntity entity = new MultipartEntity(); + entity.addPart("file", body); - MultipartEntity entity = new MultipartEntity(); - entity.addPart("file", body); - - HttpPost request = new HttpPost(urlPdfExtractor); - request.setEntity(entity); + HttpPost request = new HttpPost(urlPdfExtractor); + request.setEntity(entity); - HttpClient client = new DefaultHttpClient(); - HttpResponse response = client.execute(request); + HttpClient client = new DefaultHttpClient(); + HttpResponse response = client.execute(request); - if (response.getStatusLine().getStatusCode() != 200) { - throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); - } - InputStream inputStream = response.getEntity().getContent(); + if (response.getStatusLine().getStatusCode() != 200) { + throw new RuntimeException("Failed : HTTP error code : " + + response.getStatusLine().getStatusCode()); + } + InputStream inputStream = response.getEntity().getContent(); - ExtractorResponse extractorResponse = mapper.readValue(inputStream, ExtractorResponse.class); + ExtractorResponse extractorResponse = mapper.readValue(inputStream, ExtractorResponse.class); - if (extractorResponse.isSuccess()) { - listaCodiciFiscali = extractorResponse.getCf(); - } + if (extractorResponse.isSuccess()) { + listaCodiciFiscali = extractorResponse.getCf(); + } - } catch (IOException e) { - _log.error(e.getMessage()); - } + } catch (IOException e) { + _log.error(e.getMessage()); + } - return listaCodiciFiscali; - } + return listaCodiciFiscali; + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java index ed938df1..170b06b4 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java @@ -59,7 +59,7 @@ import javax.mail.internet.MimeMultipart; * @author Brian Wing Shun Chan * @author Brian Myunghun Kim * @author Jorge Ferrer - * @author Neil Griffin + * @author Neil Griffin<< * @author Thiago Moreira * @author Brett Swaim */ diff --git a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/.classpath b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/.classpath index 20614503..ab48b570 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/.classpath +++ b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/.classpath @@ -1,6 +1,11 @@ - + + + + + + diff --git a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AttributesBuilder.java b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AttributesBuilder.java index 5436320b..60a5ea6f 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AttributesBuilder.java +++ b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AttributesBuilder.java @@ -19,139 +19,140 @@ import com.liferay.portal.kernel.util.Validator; public class AttributesBuilder { - private List _attributes = new ArrayList(); - private T _newBean; - private T _oldBean; - - public AttributesBuilder(T newBean, T oldBean) { - - _newBean = newBean; - _oldBean = oldBean; - } - - public void add(String name) { - - DateFormat format = DateFormatFactoryUtil.getSimpleDateFormat("yyyy/MM/dd HH:mm z", TimeZone.getTimeZone("UTC")); - Object newValueObj = BeanPropertiesUtil.getObject(_newBean, name); - Object oldValueObj = BeanPropertiesUtil.getObject(_oldBean, name); - - String newValue = null; - String oldValue = null; - if (Validator.isNotNull(newValueObj)) { - newValue = newValueObj instanceof Date ? format.format(newValueObj) : newValueObj.toString(); - } - if (Validator.isNotNull(oldValueObj)) { - oldValue = oldValueObj instanceof Date ? format.format(oldValueObj) : oldValueObj.toString(); - } - if (!Validator.equals(newValue, oldValue)) { - Attribute attribute = new Attribute(name, newValue, oldValue); - - _attributes.add(attribute); - } - } - - public void addLocalized(String name) { - - DateFormat format = DateFormatFactoryUtil.getSimpleDateFormat("yyyy/MM/dd HH:mm z", TimeZone.getTimeZone("UTC")); - Object newValueObj = BeanPropertiesUtil.getObject(_newBean, name); - Object oldValueObj = BeanPropertiesUtil.getObject(_oldBean, name); - - String newValue = null; - String oldValue = null; - if (Validator.isNotNull(newValueObj)) { - newValue = newValueObj instanceof Date ? format.format(newValueObj) : newValueObj.toString(); - } - if (Validator.isNotNull(oldValueObj)) { - oldValue = oldValueObj instanceof Date ? format.format(oldValueObj) : oldValueObj.toString(); - } - - if (!Validator.equals(newValue, oldValue)) { - boolean createAttribute = false; - - Map newValueMap = LocalizationUtil.getLocalizationMap(newValue); - Map oldValueMap = LocalizationUtil.getLocalizationMap(oldValue); - - if (Validator.isNull(newValueMap) && Validator.isNotNull(oldValueMap)) { - createAttribute = true; - } else if (Validator.isNotNull(newValueMap) && Validator.isNull(oldValueMap)) { - createAttribute = true; - } else if (newValueMap.keySet().size() != oldValueMap.keySet().size()) { - createAttribute = true; - } else { - for (Locale locale : newValueMap.keySet()) { - if (!oldValueMap.keySet().contains(locale)) { - createAttribute = true; - break; - } - - String newLocalizedValue = newValueMap.get(locale); - String oldLocalizedValue = oldValueMap.get(locale); - if (!Validator.equals(newLocalizedValue, oldLocalizedValue)) { - createAttribute = true; - break; - } - } - } - - if (createAttribute) { - Attribute attribute = new Attribute(name, newValue, oldValue); - _attributes.add(attribute); - } - } - } - - public JSONObject getAttributesJSON() { - - JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); - - for (Attribute attribute : _attributes) { - JSONObject attributeJSONObject = JSONFactoryUtil.createJSONObject(); - - attributeJSONObject.put("name", attribute.getName()); - attributeJSONObject.put("newValue", attribute.getNewValue()); - attributeJSONObject.put("oldValue", attribute.getOldValue()); - - jsonArray.put(attributeJSONObject); - } - - JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); - jsonObject.put("attributes", jsonArray); - - return jsonObject; - } + private List _attributes = new ArrayList(); + private T _newBean; + private T _oldBean; + + public AttributesBuilder(T newBean, T oldBean) { + + _newBean = newBean; + _oldBean = oldBean; + } + + public void add(String name) { + + DateFormat format = DateFormatFactoryUtil.getSimpleDateFormat("yyyy/MM/dd HH:mm z", + TimeZone.getTimeZone("UTC")); + Object newValueObj = BeanPropertiesUtil.getObject(_newBean, name); + Object oldValueObj = BeanPropertiesUtil.getObject(_oldBean, name); + + String newValue = null; + String oldValue = null; + if (Validator.isNotNull(newValueObj)) { + newValue = newValueObj instanceof Date ? format.format(newValueObj) : newValueObj.toString(); + } + if (Validator.isNotNull(oldValueObj)) { + oldValue = oldValueObj instanceof Date ? format.format(oldValueObj) : oldValueObj.toString(); + } + if (!Validator.equals(newValue, oldValue)) { + Attribute attribute = new Attribute(name, newValue, oldValue); + + _attributes.add(attribute); + } + } + + public void addLocalized(String name) { + + DateFormat format = DateFormatFactoryUtil.getSimpleDateFormat("yyyy/MM/dd HH:mm z", + TimeZone.getTimeZone("UTC")); + Object newValueObj = BeanPropertiesUtil.getObject(_newBean, name); + Object oldValueObj = BeanPropertiesUtil.getObject(_oldBean, name); + + String newValue = null; + String oldValue = null; + if (Validator.isNotNull(newValueObj)) { + newValue = newValueObj instanceof Date ? format.format(newValueObj) : newValueObj.toString(); + } + if (Validator.isNotNull(oldValueObj)) { + oldValue = oldValueObj instanceof Date ? format.format(oldValueObj) : oldValueObj.toString(); + } + + if (!Validator.equals(newValue, oldValue)) { + boolean createAttribute = false; + + Map newValueMap = LocalizationUtil.getLocalizationMap(newValue); + Map oldValueMap = LocalizationUtil.getLocalizationMap(oldValue); + + if (Validator.isNull(newValueMap) && Validator.isNotNull(oldValueMap)) { + createAttribute = true; + } else if (Validator.isNotNull(newValueMap) && Validator.isNull(oldValueMap)) { + createAttribute = true; + } else if (newValueMap.keySet().size() != oldValueMap.keySet().size()) { + createAttribute = true; + } else { + for (Locale locale : newValueMap.keySet()) { + if (!oldValueMap.keySet().contains(locale)) { + createAttribute = true; + break; + } + + String newLocalizedValue = newValueMap.get(locale); + String oldLocalizedValue = oldValueMap.get(locale); + if (!Validator.equals(newLocalizedValue, oldLocalizedValue)) { + createAttribute = true; + break; + } + } + } + + if (createAttribute) { + Attribute attribute = new Attribute(name, newValue, oldValue); + _attributes.add(attribute); + } + } + } + + public JSONObject getAttributesJSON() { + + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); + + for (Attribute attribute : _attributes) { + JSONObject attributeJSONObject = JSONFactoryUtil.createJSONObject(); + + attributeJSONObject.put("name", attribute.getName()); + attributeJSONObject.put("newValue", attribute.getNewValue()); + attributeJSONObject.put("oldValue", attribute.getOldValue()); + + jsonArray.put(attributeJSONObject); + } + + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + jsonObject.put("attributes", jsonArray); + + return jsonObject; + } } - class Attribute { - private String _name; - private String _newValue; - private String _oldValue; + private String _name; + private String _newValue; + private String _oldValue; - public Attribute(String name) { + public Attribute(String name) { - this(name, StringPool.BLANK, StringPool.BLANK); - } + this(name, StringPool.BLANK, StringPool.BLANK); + } - public Attribute(String name, String newValue, String oldValue) { + public Attribute(String name, String newValue, String oldValue) { - _name = name; - _newValue = newValue; - _oldValue = oldValue; - } + _name = name; + _newValue = newValue; + _oldValue = oldValue; + } - public String getName() { + public String getName() { - return _name; - } + return _name; + } - public String getNewValue() { + public String getNewValue() { - return _newValue; - } + return _newValue; + } - public String getOldValue() { + public String getOldValue() { - return _oldValue; - } + return _oldValue; + } } diff --git a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AuditModelListener.java b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AuditModelListener.java index 2c3f7f16..2d381562 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AuditModelListener.java +++ b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AuditModelListener.java @@ -16,158 +16,164 @@ import com.liferay.portal.model.BaseModelListener; public abstract class AuditModelListener> extends BaseModelListener { - - @Override - public void onBeforeCreate(T model) throws ModelListenerException { - - routeAuditMessage(Constants.ADD.toUpperCase(), model, getMessage(model), null, false); - } - - @Override - public void onBeforeRemove(T model) throws ModelListenerException { - - routeAuditMessage(Constants.DELETE.toUpperCase(), model, getMessage(model), null, false); - } - - @Override - public void onBeforeUpdate(T newModel) throws ModelListenerException { - - try { - - T oldModel = getOldModel(newModel); - - JSONObject attributes = getModifiedAttributes(newModel, oldModel); - JSONArray array = attributes.getJSONArray("attributes"); - boolean isUpdate = true; - if (array != null) { - for (int i = 0; i < array.length(); i++) { - String name = array.getJSONObject(i).getString("name"); - String newValue = array.getJSONObject(i).getString("newValue"); - if (name.equalsIgnoreCase(getStatoAttributesName())) { - - routeAuditMessage(convertStatoToEventString(newValue), newModel, getMessage(newModel), attributes, true); - - if (array.length() == 1) { - isUpdate = false; - } - - } - attributes.remove(getStatoAttributesName()); - - } - } - if (isUpdate) { - boolean sended = - routeAuditMessage(Constants.UPDATE.toUpperCase(), newModel, getMessage(newModel), attributes, false); - if (sended) { - onBeforeRealUpdate(newModel, oldModel); - } - } - } catch (Exception e) { - throw new ModelListenerException(e); - } - } - - protected String convertStatoToEventString(String newValue) { - if ("1".equalsIgnoreCase(newValue) || "true".equalsIgnoreCase(newValue)) { - return Constants.ATTIVA.toUpperCase(); - } else { - return Constants.DISATTIVA.toUpperCase(); - } - } - - protected String getStatoAttributesName() { - return "valido"; - } - - protected String getStatoAttivaString() { - return "1"; - } - - protected abstract T getOldModel(T newModel) throws ModelListenerException; - - protected List getExcludedFields() { - List esclusioni = new ArrayList() { - { - add("modifiedDate"); - add("createDate"); - } - }; - return esclusioni; - } - - protected JSONObject getModifiedAttributes(T newRelazioniAnagrafiche, T oldRelazioniAnagrafiche) { - - AttributesBuilder attributesBuilder = new AttributesBuilder(newRelazioniAnagrafiche, oldRelazioniAnagrafiche); - - Map model = newRelazioniAnagrafiche.getModelAttributes(); - Iterator modelList = model.keySet().iterator(); - while (modelList.hasNext()) { - String name = (String) modelList.next(); - if (!getExcludedFields().contains(name)) { - attributesBuilder.add(name); - } - } - - return attributesBuilder.getAttributesJSON(); - } - - protected boolean routeAuditMessage(String eventAction, T model, String message, JSONObject additionalInfo, - boolean cambiostato) throws ModelListenerException { - String className = getClassName(model); - if (cambiostato) { - AuditUtil.doCambioStato(getEventType(model), className, (Long) model.getPrimaryKeyObj(), message, - getEventCategory(model), eventAction); - onBeforeCambioStato(model); - return true; - } else if (additionalInfo == null) { - AuditUtil.doLog(getEventType(model), className, (Long) model.getPrimaryKeyObj(), message, - getEventCategory(model), eventAction, getParentClassName(model), getParentClassPk(model), - getRelatedClassName(model), getRelatedClassPk(model), getAdditionalInfoForLogEvent(eventAction, model)); - onBeforeLog(model); - return true; - } else { - return AuditUtil.doStorico(getEventType(model), className, (Long) model.getPrimaryKeyObj(), message, - getEventCategory(model), eventAction, getParentClassName(model), getParentClassPk(model), - getRelatedClassName(model), getRelatedClassPk(model), additionalInfo, null); - } - - } - - protected JSONObject getAdditionalInfoForLogEvent(String eventAction, T model) { - - return null; - } - - protected void onBeforeRealUpdate(T newModel, T oldModel) throws ModelListenerException {} - - protected void onBeforeLog(T model) throws ModelListenerException {} - - protected void onBeforeCambioStato(T model) throws ModelListenerException {} - - protected Long getParentClassPk(T model) { - return 0l; - } - - protected String getParentClassName(T model) { - return StringPool.BLANK; - } - - protected Long getRelatedClassPk(T model) { - return 0l; - } - - protected String getRelatedClassName(T model) { - return StringPool.BLANK; - } - - protected String getMessage(T model) { - return StringPool.BLANK; - } - - protected abstract String getClassName(T model); - - protected abstract String getEventType(T model); - - protected abstract String getEventCategory(T model); + @Override + public void onBeforeCreate(T model) throws ModelListenerException { + + routeAuditMessage(Constants.ADD.toUpperCase(), model, getMessage(model), null, false); + } + + @Override + public void onBeforeRemove(T model) throws ModelListenerException { + + routeAuditMessage(Constants.DELETE.toUpperCase(), model, getMessage(model), null, false); + } + + @Override + public void onBeforeUpdate(T newModel) throws ModelListenerException { + + try { + + T oldModel = getOldModel(newModel); + + JSONObject attributes = getModifiedAttributes(newModel, oldModel); + JSONArray array = attributes.getJSONArray("attributes"); + boolean isUpdate = true; + if (array != null) { + for (int i = 0; i < array.length(); i++) { + String name = array.getJSONObject(i).getString("name"); + String newValue = array.getJSONObject(i).getString("newValue"); + if (name.equalsIgnoreCase(getStatoAttributesName())) { + + routeAuditMessage(convertStatoToEventString(newValue), newModel, + getMessage(newModel), attributes, true); + + if (array.length() == 1) { + isUpdate = false; + } + + } + attributes.remove(getStatoAttributesName()); + + } + } + if (isUpdate) { + boolean sended = routeAuditMessage(Constants.UPDATE.toUpperCase(), newModel, + getMessage(newModel), attributes, false); + if (sended) { + onBeforeRealUpdate(newModel, oldModel); + } + } + } catch (Exception e) { + throw new ModelListenerException(e); + } + } + + protected String convertStatoToEventString(String newValue) { + if ("1".equalsIgnoreCase(newValue) || "true".equalsIgnoreCase(newValue)) { + return Constants.ATTIVA.toUpperCase(); + } else { + return Constants.DISATTIVA.toUpperCase(); + } + } + + protected String getStatoAttributesName() { + return "valido"; + } + + protected String getStatoAttivaString() { + return "1"; + } + + protected abstract T getOldModel(T newModel) throws ModelListenerException; + + protected List getExcludedFields() { + List esclusioni = new ArrayList() { + { + add("modifiedDate"); + add("createDate"); + } + }; + return esclusioni; + } + + protected JSONObject getModifiedAttributes(T newRelazioniAnagrafiche, T oldRelazioniAnagrafiche) { + + AttributesBuilder attributesBuilder = new AttributesBuilder(newRelazioniAnagrafiche, + oldRelazioniAnagrafiche); + + Map model = newRelazioniAnagrafiche.getModelAttributes(); + Iterator modelList = model.keySet().iterator(); + while (modelList.hasNext()) { + String name = (String) modelList.next(); + if (!getExcludedFields().contains(name)) { + attributesBuilder.add(name); + } + } + + return attributesBuilder.getAttributesJSON(); + } + + protected boolean routeAuditMessage(String eventAction, T model, String message, + JSONObject additionalInfo, boolean cambiostato) throws ModelListenerException { + String className = getClassName(model); + if (cambiostato) { + AuditUtil.doCambioStato(getEventType(model), className, (Long) model.getPrimaryKeyObj(), message, + getEventCategory(model), eventAction); + onBeforeCambioStato(model); + return true; + } else if (additionalInfo == null) { + AuditUtil.doLog(getEventType(model), className, (Long) model.getPrimaryKeyObj(), message, + getEventCategory(model), eventAction, getParentClassName(model), getParentClassPk(model), + getRelatedClassName(model), getRelatedClassPk(model), + getAdditionalInfoForLogEvent(eventAction, model)); + onBeforeLog(model); + return true; + } else { + return AuditUtil.doStorico(getEventType(model), className, (Long) model.getPrimaryKeyObj(), + message, getEventCategory(model), eventAction, getParentClassName(model), + getParentClassPk(model), getRelatedClassName(model), getRelatedClassPk(model), + additionalInfo, null); + } + + } + + protected JSONObject getAdditionalInfoForLogEvent(String eventAction, T model) { + + return null; + } + + protected void onBeforeRealUpdate(T newModel, T oldModel) throws ModelListenerException { + } + + protected void onBeforeLog(T model) throws ModelListenerException { + } + + protected void onBeforeCambioStato(T model) throws ModelListenerException { + } + + protected Long getParentClassPk(T model) { + return 0l; + } + + protected String getParentClassName(T model) { + return StringPool.BLANK; + } + + protected Long getRelatedClassPk(T model) { + return 0l; + } + + protected String getRelatedClassName(T model) { + return StringPool.BLANK; + } + + protected String getMessage(T model) { + return StringPool.BLANK; + } + + protected abstract String getClassName(T model); + + protected abstract String getEventType(T model); + + protected abstract String getEventCategory(T model); } diff --git a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AuditUtil.java b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AuditUtil.java index 241c6de2..fde213f7 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AuditUtil.java +++ b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/AuditUtil.java @@ -16,99 +16,102 @@ import com.liferay.portal.util.PortalUtil; public class AuditUtil { - public static void doLog(String eventType, String className, long classPK) throws ModelListenerException { - - doLog(eventType, className, classPK, StringPool.BLANK); - } - - public static void doLog(String eventType, String className, long classPK, String message) - throws ModelListenerException { - - doLog(eventType, className, classPK, message, StringPool.BLANK, StringPool.BLANK, StringPool.BLANK, 0l, - StringPool.BLANK, 0l, null); - } - - public static void doLog(String eventType, String className, long classPK, String message, String eventCategory, - String eventAction, String parentClassName, Long parentClassPK, String relatedClassName, Long relatedClassPK, - JSONObject additionalInfo) throws ModelListenerException { - - doAudit(eventType, className, classPK, message, AuditKey.EVENT_TABLE_LOG, eventCategory, eventAction, - parentClassName, parentClassPK, relatedClassName, relatedClassPK, null, additionalInfo); - } - - public static boolean doStorico(String eventType, String className, long classPK, String message, - String eventCategory, String eventAction, String parentClassName, Long parentClassPK, String relatedClassName, - Long relatedClassPK, JSONObject diff, JSONObject additionalInfo) throws ModelListenerException { - if (diff != null && !diff.isNull("attributes") && diff.getJSONArray("attributes").length() > 0) { - doAudit(eventType, className, classPK, message, AuditKey.EVENT_TABLE_STORICO, eventCategory, eventAction, - parentClassName, parentClassPK, relatedClassName, relatedClassPK, diff, additionalInfo); - return true; - } else { - return false; - } - } - - public static void doCambioStato(String eventType, String className, long classPK, String message, - String eventCategory, String eventAction) throws ModelListenerException { - doAudit(eventType, className, classPK, message, AuditKey.EVENT_TABLE_CAMBIO_STATO, eventCategory, eventAction, - StringPool.BLANK, 0l, StringPool.BLANK, 0l, null, null); - - } - - private static void doAudit(String eventType, String className, long classPK, String message, String auditEventTable, - String eventCategory, String eventAction, String parentClassName, Long parentClassPK, String relatedClassName, - Long relatedClassPK, JSONObject diff, JSONObject additionalInfo) throws ModelListenerException { - - try { - if (additionalInfo == null) - additionalInfo = JSONFactoryUtil.createJSONObject(); - - addIfNotNull(additionalInfo, AuditKey.FIELD_AUDIT_EVENT_TABLE, auditEventTable); - addIfNotNull(additionalInfo, AuditKey.FIELD_EVENT_CATEGORY, eventCategory); - addIfNotNull(additionalInfo, AuditKey.FIELD_EVENT_ACTION, eventAction); - addIfNotNull(additionalInfo, AuditKey.FIELD_PARENT_CLASS_NAME, parentClassName); - addIfNotNull(additionalInfo, AuditKey.FIELD_PARENT_CLASS_PK, parentClassPK); - addIfNotNull(additionalInfo, AuditKey.FIELD_RELATED_CLASS_NAME, relatedClassName); - addIfNotNull(additionalInfo, AuditKey.FIELD_RELATED_CLASS_PK, relatedClassPK); - if (diff != null) { - additionalInfo.put(AuditKey.FIELD_DIFF, diff); - } - - long companyId = CompanyThreadLocal.getCompanyId(); - - long userId = 0; - if (PrincipalThreadLocal.getName() != null) { - userId = GetterUtil.getLong(PrincipalThreadLocal.getName()); - } - - AuditRequestThreadLocal auditRequestThreadLocal = AuditRequestThreadLocal.getAuditThreadLocal(); - long realUserId = auditRequestThreadLocal.getRealUserId(); - String realUserName = PortalUtil.getUserName(realUserId, StringPool.BLANK); - - if ((realUserId > 0) && (userId != realUserId)) { - additionalInfo.put("doAsUserId", String.valueOf(userId)); - additionalInfo.put("doAsUserName", PortalUtil.getUserName(userId, StringPool.BLANK)); - } - - AuditMessage auditMessage = - new AuditMessage(eventType, companyId, realUserId, realUserName, className, String.valueOf(classPK), message, - additionalInfo); - - AuditRouterUtil.route(auditMessage); - } catch (PortalException e) { - throw new ModelListenerException(e); - } - } - - private static void addIfNotNull(JSONObject additionalInfo, String key, String value) { - if (Validator.isNotNull(value)) { - additionalInfo.put(key, value); - } - } - - private static void addIfNotNull(JSONObject additionalInfo, String key, Long value) { - if (Validator.isNotNull(value)) { - additionalInfo.put(key, value); - } - } + public static void doLog(String eventType, String className, long classPK) throws ModelListenerException { + + doLog(eventType, className, classPK, StringPool.BLANK); + } + + public static void doLog(String eventType, String className, long classPK, String message) + throws ModelListenerException { + + doLog(eventType, className, classPK, message, StringPool.BLANK, StringPool.BLANK, StringPool.BLANK, + 0l, StringPool.BLANK, 0l, null); + } + + public static void doLog(String eventType, String className, long classPK, String message, + String eventCategory, String eventAction, String parentClassName, Long parentClassPK, + String relatedClassName, Long relatedClassPK, JSONObject additionalInfo) + throws ModelListenerException { + + doAudit(eventType, className, classPK, message, AuditKey.EVENT_TABLE_LOG, eventCategory, eventAction, + parentClassName, parentClassPK, relatedClassName, relatedClassPK, null, additionalInfo); + } + + public static boolean doStorico(String eventType, String className, long classPK, String message, + String eventCategory, String eventAction, String parentClassName, Long parentClassPK, + String relatedClassName, Long relatedClassPK, JSONObject diff, JSONObject additionalInfo) + throws ModelListenerException { + if (diff != null && !diff.isNull("attributes") && diff.getJSONArray("attributes").length() > 0) { + doAudit(eventType, className, classPK, message, AuditKey.EVENT_TABLE_STORICO, eventCategory, + eventAction, parentClassName, parentClassPK, relatedClassName, relatedClassPK, diff, + additionalInfo); + return true; + } else { + return false; + } + } + + public static void doCambioStato(String eventType, String className, long classPK, String message, + String eventCategory, String eventAction) throws ModelListenerException { + doAudit(eventType, className, classPK, message, AuditKey.EVENT_TABLE_CAMBIO_STATO, eventCategory, + eventAction, StringPool.BLANK, 0l, StringPool.BLANK, 0l, null, null); + + } + + private static void doAudit(String eventType, String className, long classPK, String message, + String auditEventTable, String eventCategory, String eventAction, String parentClassName, + Long parentClassPK, String relatedClassName, Long relatedClassPK, JSONObject diff, + JSONObject additionalInfo) throws ModelListenerException { + + try { + if (additionalInfo == null) + additionalInfo = JSONFactoryUtil.createJSONObject(); + + addIfNotNull(additionalInfo, AuditKey.FIELD_AUDIT_EVENT_TABLE, auditEventTable); + addIfNotNull(additionalInfo, AuditKey.FIELD_EVENT_CATEGORY, eventCategory); + addIfNotNull(additionalInfo, AuditKey.FIELD_EVENT_ACTION, eventAction); + addIfNotNull(additionalInfo, AuditKey.FIELD_PARENT_CLASS_NAME, parentClassName); + addIfNotNull(additionalInfo, AuditKey.FIELD_PARENT_CLASS_PK, parentClassPK); + addIfNotNull(additionalInfo, AuditKey.FIELD_RELATED_CLASS_NAME, relatedClassName); + addIfNotNull(additionalInfo, AuditKey.FIELD_RELATED_CLASS_PK, relatedClassPK); + if (diff != null) { + additionalInfo.put(AuditKey.FIELD_DIFF, diff); + } + + long companyId = CompanyThreadLocal.getCompanyId(); + + long userId = 0; + if (PrincipalThreadLocal.getName() != null) { + userId = GetterUtil.getLong(PrincipalThreadLocal.getName()); + } + + AuditRequestThreadLocal auditRequestThreadLocal = AuditRequestThreadLocal.getAuditThreadLocal(); + long realUserId = auditRequestThreadLocal.getRealUserId(); + String realUserName = PortalUtil.getUserName(realUserId, StringPool.BLANK); + + if ((realUserId > 0) && (userId != realUserId)) { + additionalInfo.put("doAsUserId", String.valueOf(userId)); + additionalInfo.put("doAsUserName", PortalUtil.getUserName(userId, StringPool.BLANK)); + } + + AuditMessage auditMessage = new AuditMessage(eventType, companyId, realUserId, realUserName, + className, String.valueOf(classPK), message, additionalInfo); + + AuditRouterUtil.route(auditMessage); + } catch (PortalException e) { + throw new ModelListenerException(e); + } + } + + private static void addIfNotNull(JSONObject additionalInfo, String key, String value) { + if (Validator.isNotNull(value)) { + additionalInfo.put(key, value); + } + } + + private static void addIfNotNull(JSONObject additionalInfo, String key, Long value) { + if (Validator.isNotNull(value)) { + additionalInfo.put(key, value); + } + } } diff --git a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/permission/HistoryPermission.java b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/permission/HistoryPermission.java index 63671cac..cca32903 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/permission/HistoryPermission.java +++ b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/permission/HistoryPermission.java @@ -9,25 +9,25 @@ import com.liferay.portal.security.permission.PermissionChecker; public class HistoryPermission { - public static final String RESOURCE_NAME = "it.tref.liferay.portos.audit.history"; + public static final String RESOURCE_NAME = "it.tref.liferay.portos.audit.history"; - public static void check(PermissionChecker permissionChecker, long groupId, String actionId) throws PortalException { + public static void check(PermissionChecker permissionChecker, long groupId, String actionId) + throws PortalException { - if (!contains(permissionChecker, groupId, actionId)) { - throw new PrincipalException(); - } - } + if (!contains(permissionChecker, groupId, actionId)) { + throw new PrincipalException(); + } + } - public static boolean contains(PermissionChecker permissionChecker, long groupId, String actionId) { + public static boolean contains(PermissionChecker permissionChecker, long groupId, String actionId) { - Boolean hasPermission = - StagingPermissionUtil.hasPermission(permissionChecker, groupId, RESOURCE_NAME, groupId, - PortletKeys.AUDIT_DETAIL, actionId); + Boolean hasPermission = StagingPermissionUtil.hasPermission(permissionChecker, groupId, + RESOURCE_NAME, groupId, PortletKeys.AUDIT_DETAIL, actionId); - if (hasPermission != null) { - return hasPermission.booleanValue(); - } + if (hasPermission != null) { + return hasPermission.booleanValue(); + } - return permissionChecker.hasPermission(groupId, RESOURCE_NAME, groupId, actionId); - } + return permissionChecker.hasPermission(groupId, RESOURCE_NAME, groupId, actionId); + } } diff --git a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/util/Constants.java b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/util/Constants.java index 5e872449..07770b2d 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/util/Constants.java +++ b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/util/Constants.java @@ -1,8 +1,6 @@ package it.tref.liferay.portos.audit.shared.util; public class Constants implements com.liferay.portal.kernel.util.Constants { - - public static final String ATTIVA = "ATTIVA"; - public static final String DISATTIVA = "DISATTIVA"; - + public static final String ATTIVA = "ATTIVA"; + public static final String DISATTIVA = "DISATTIVA"; } diff --git a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/util/PortletKeys.java b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/util/PortletKeys.java index e324eed5..a71e9228 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/util/PortletKeys.java +++ b/liferay-plugins-sdk-6.2/shared/portos-audit-shared/src/it/tref/liferay/portos/audit/shared/util/PortletKeys.java @@ -1,9 +1,6 @@ package it.tref.liferay.portos.audit.shared.util; public class PortletKeys extends com.liferay.portal.util.PortletKeys { - - public static final String AUDIT = "1_WAR_portosauditportlet"; - - public static final String AUDIT_DETAIL = "2_WAR_portosauditportlet"; - + public static final String AUDIT = "1_WAR_portosauditportlet"; + public static final String AUDIT_DETAIL = "2_WAR_portosauditportlet"; } diff --git a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/FirmeBean.java b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/FirmeBean.java index 6373d1dd..58a2b997 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/FirmeBean.java +++ b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/FirmeBean.java @@ -8,87 +8,87 @@ import java.util.List; public class FirmeBean implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private List firmeDigitali = new UniqueList(); - private List firmeApplicativo = new UniqueList(); + private List firmeDigitali = new UniqueList(); + private List firmeApplicativo = new UniqueList(); - public List getFirmeDigitali() { - return new UnmodifiableList<>(firmeDigitali); - } + public List getFirmeDigitali() { + return new UnmodifiableList<>(firmeDigitali); + } - public void setFirmeDigitali(List firmeDigitali) { - this.firmeDigitali = new UniqueList(); - for (FirmeDetail firmaDigitale : firmeDigitali) { - this.firmeDigitali.add(firmaDigitale); - } - } + public void setFirmeDigitali(List firmeDigitali) { + this.firmeDigitali = new UniqueList(); + for (FirmeDetail firmaDigitale : firmeDigitali) { + this.firmeDigitali.add(firmaDigitale); + } + } - public List getFirmeApplicativo() { - return new UnmodifiableList<>(firmeApplicativo); - } + public List getFirmeApplicativo() { + return new UnmodifiableList<>(firmeApplicativo); + } - public void setFirmeApplicativo(List firmeApplicativo) { - this.firmeApplicativo = new UniqueList(); - for (FirmeDetail firmaApplicativo : firmeApplicativo) { - this.firmeApplicativo.add(firmaApplicativo); - } - } + public void setFirmeApplicativo(List firmeApplicativo) { + this.firmeApplicativo = new UniqueList(); + for (FirmeDetail firmaApplicativo : firmeApplicativo) { + this.firmeApplicativo.add(firmaApplicativo); + } + } - public boolean firmaIsPresent(String codiceFiscale) { - for (FirmeDetail firmaDigitale : firmeDigitali) { - if (firmaDigitale.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) { - return true; - } - } - for (FirmeDetail firmaApplicativo : firmeApplicativo) { - if (firmaApplicativo.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) { - return true; - } - } - return false; - } + public boolean firmaIsPresent(String codiceFiscale) { + for (FirmeDetail firmaDigitale : firmeDigitali) { + if (firmaDigitale.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) { + return true; + } + } + for (FirmeDetail firmaApplicativo : firmeApplicativo) { + if (firmaApplicativo.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) { + return true; + } + } + return false; + } - public boolean firmaIsAnnullabile(String codiceFiscale) { - for (FirmeDetail firmaApplicativo : firmeApplicativo) { - if (firmaApplicativo.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) { - return true; - } - } - return false; - } + public boolean firmaIsAnnullabile(String codiceFiscale) { + for (FirmeDetail firmaApplicativo : firmeApplicativo) { + if (firmaApplicativo.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) { + return true; + } + } + return false; + } - public int numeroFirme() { - List allSignatures = allSignatures(); - return allSignatures.size(); - } + public int numeroFirme() { + List allSignatures = allSignatures(); + return allSignatures.size(); + } - public List allSignatures() { - List all = new UniqueList(); - for (FirmeDetail firmaDigitale : firmeDigitali) { - all.add(firmaDigitale.getCfFirmatario().toLowerCase()); - } - for (FirmeDetail firmaApplicativo : firmeApplicativo) { - all.add(firmaApplicativo.getCfFirmatario().toLowerCase()); - } - return all; - } + public List allSignatures() { + List all = new UniqueList(); + for (FirmeDetail firmaDigitale : firmeDigitali) { + all.add(firmaDigitale.getCfFirmatario().toLowerCase()); + } + for (FirmeDetail firmaApplicativo : firmeApplicativo) { + all.add(firmaApplicativo.getCfFirmatario().toLowerCase()); + } + return all; + } - public List allFirmeDetails() { - List all = new UniqueList(); - all.addAll(firmeDigitali); - all.addAll(firmeApplicativo); - return all; - } + public List allFirmeDetails() { + List all = new UniqueList(); + all.addAll(firmeDigitali); + all.addAll(firmeApplicativo); + return all; + } - public void removeFirmeApplicativo(String codiceFiscale) { - FirmeDetail firmeDetailToRemove = null; - for (FirmeDetail firmeDetail : firmeApplicativo) { - if (codiceFiscale.equalsIgnoreCase(firmeDetail.getCfFirmatario())) { - firmeDetailToRemove = firmeDetail; - break; - } - } + public void removeFirmeApplicativo(String codiceFiscale) { + FirmeDetail firmeDetailToRemove = null; + for (FirmeDetail firmeDetail : firmeApplicativo) { + if (codiceFiscale.equalsIgnoreCase(firmeDetail.getCfFirmatario())) { + firmeDetailToRemove = firmeDetail; + break; + } + } firmeApplicativo.remove(firmeDetailToRemove); } } diff --git a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/protocollo/model/Fascicolo.java b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/protocollo/model/Fascicolo.java index c6ad64d8..5c78e0fa 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/protocollo/model/Fascicolo.java +++ b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/protocollo/model/Fascicolo.java @@ -3,7 +3,6 @@ package it.tref.liferay.portos.bo.shared.protocollo.model; public class Fascicolo { private int anno; - private int numero; public Fascicolo() {} diff --git a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/protocollo/model/Protocollo.java b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/protocollo/model/Protocollo.java index 7666e045..946eda2f 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/protocollo/model/Protocollo.java +++ b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/protocollo/model/Protocollo.java @@ -5,105 +5,80 @@ import java.util.List; public class Protocollo { - public enum TipoProtocollo { - INGRESSO, - USCITA - } - - private Date dataInserimento; - - private boolean chiuso; - - private String ufficioId; - - private String praticaId; - - private String utenteId; - - private String oggetto; - - private TipoProtocollo tipo; - - private List files; - - public boolean isChiuso() { - - return chiuso; - } - - public void setChiuso(boolean chiuso) { - - this.chiuso = chiuso; - } - - public String getUfficioId() { - - return ufficioId; - } - - public void setUfficioId(String ufficioId) { - - this.ufficioId = ufficioId; - } - - public String getUtenteId() { - - return utenteId; - } - - public void setUtenteId(String utenteId) { - - this.utenteId = utenteId; - } - - public String getOggetto() { - - return oggetto; - } - - public void setOggetto(String oggetto) { - - this.oggetto = oggetto; - } - - public TipoProtocollo getTipo() { - - return tipo; - } - - public void setTipo(TipoProtocollo tipo) { - - this.tipo = tipo; - } - - public List getFiles() { - - return files; - } - - public void setFiles(List files) { - - this.files = files; - } - - public String getPraticaId() { - - return praticaId; - } - - public void setPraticaId(String praticaId) { - - this.praticaId = praticaId; - } - - public Date getDataInserimento() { - - return dataInserimento; - } - - public void setDataInserimento(Date dataInserimento) { - - this.dataInserimento = dataInserimento; - } - + public enum TipoProtocollo { + INGRESSO, USCITA + } + + private Date dataInserimento; + private boolean chiuso; + private String ufficioId; + private String praticaId; + private String utenteId; + private String oggetto; + private TipoProtocollo tipo; + private List files; + + public boolean isChiuso() { + return chiuso; + } + + public void setChiuso(boolean chiuso) { + this.chiuso = chiuso; + } + + public String getUfficioId() { + return ufficioId; + } + + public void setUfficioId(String ufficioId) { + this.ufficioId = ufficioId; + } + + public String getUtenteId() { + return utenteId; + } + + public void setUtenteId(String utenteId) { + this.utenteId = utenteId; + } + + public String getOggetto() { + return oggetto; + } + + public void setOggetto(String oggetto) { + this.oggetto = oggetto; + } + + public TipoProtocollo getTipo() { + return tipo; + } + + public void setTipo(TipoProtocollo tipo) { + this.tipo = tipo; + } + + public List getFiles() { + return files; + } + + public void setFiles(List files) { + this.files = files; + } + + public String getPraticaId() { + return praticaId; + } + + public void setPraticaId(String praticaId) { + this.praticaId = praticaId; + } + + public Date getDataInserimento() { + return dataInserimento; + } + + public void setDataInserimento(Date dataInserimento) { + this.dataInserimento = dataInserimento; + } } diff --git a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/StatoPraticaConstants.java b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/StatoPraticaConstants.java index f0e0df4a..0bc33032 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/StatoPraticaConstants.java +++ b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/StatoPraticaConstants.java @@ -3,91 +3,84 @@ package it.tref.liferay.portos.bo.shared.util; import java.util.LinkedHashMap; import java.util.Map; - public class StatoPraticaConstants { - public final static String SORTEGGIATA = "SO"; - - public final static String SOTTOPOSTA_A_PARERE = "SP"; - - public final static String RIFIUTATA = "RI"; - public final static String VIDIMATA = "VI"; - - public final static String CONFORME = "CO"; - public final static String NON_CONFORME = "NC"; - - public final static String INTEGRAZIONE = "IN"; - - public final static String VARIATA = "VA"; - - public static final String FINE_LAVORI = "FL"; - public static final String COLLAUDO = "CL"; - public static final String FINE_LAVORI_PARZIALE = "FP"; - public static final String COLLAUDO_PARZIALE = "CP"; - - public static final String ANNULLATA = "AL"; - - // public static final String INTEGRAZIONE_RIFIUTATA = "NI"; - public static final String INTEGRAZIONE_ACCETTATA = "SI"; - - /* Stati "virtuali" */ - public static final String CAMBIO_ISTRUTTORE = "CI"; - public final static String AUTORIZZATA = "AU"; - public final static String NON_AUTORIZZATA = "AN"; - public final static String ANNULLA_ISTANZA = "AI"; - public final static String VARIAZIONE_SOGGETTI = "VS"; - // public static final String ASSEGNATA = "AS"; - // public static final String ATTESA_FIRMA = "AF"; - // public static final String APPROVAZIONE = "AP"; - // public static final String FINE_LAVORI_CON_ANOMALIA = "FA"; - - private static final Map statusLabel; - private static final Map statusFilterLabel; - - static { - statusLabel = new LinkedHashMap(); - statusLabel.put(StatoPraticaConstants.SORTEGGIATA, "label.admingeniocivile.statopratica.sorteggiata"); - statusLabel.put(StatoPraticaConstants.SOTTOPOSTA_A_PARERE, "label.admingeniocivile.statopratica.sottopostaaparere"); - statusLabel.put(StatoPraticaConstants.VIDIMATA, "label.admingeniocivile.statopratica.vidimata"); - statusLabel.put(StatoPraticaConstants.CONFORME, "label.admingeniocivile.statopratica.conforme"); - statusLabel.put(StatoPraticaConstants.NON_CONFORME, "label.admingeniocivile.statopratica.nonconforme"); - statusLabel.put(StatoPraticaConstants.AUTORIZZATA, "label.admingeniocivile.statopratica.autorizzazione"); - statusLabel.put(StatoPraticaConstants.NON_AUTORIZZATA, "label.admingeniocivile.statopratica.autorizzazionenegata"); - statusLabel.put(StatoPraticaConstants.INTEGRAZIONE, "label.admingeniocivile.statopratica.integrazione"); - statusLabel.put(StatoPraticaConstants.RIFIUTATA, "label.admingeniocivile.statopratica.rifiutata"); - statusLabel.put(StatoPraticaConstants.FINE_LAVORI, "label.admingeniocivile.statopratica.finelavori"); - statusLabel.put(StatoPraticaConstants.COLLAUDO, "label.admingeniocivile.statopratica.collaudo"); - statusLabel.put(StatoPraticaConstants.FINE_LAVORI_PARZIALE, - "label.admingeniocivile.statopratica.finelavoriparziale"); - statusLabel.put(StatoPraticaConstants.COLLAUDO_PARZIALE, "label.admingeniocivile.statopratica.collaudoparziale"); - statusLabel.put(StatoPraticaConstants.ANNULLATA, "label.admingeniocivile.statopratica.annullata"); - statusLabel.put(StatoPraticaConstants.CAMBIO_ISTRUTTORE, "label.admingeniocivile.statopratica.cambiIstruttore"); - // statusLabel.put(StatoPraticaConstants.ASSEGNATA, - // "label.admingeniocivile.statopratica.assegnata"); - // statusLabel.put(StatoPraticaConstants.ATTESA_FIRMA, - // "label.admingeniocivile.statopratica.attesafirma"); - // statusLabel.put(StatoPraticaConstants.APPROVAZIONE, - // "label.admingeniocivile.statopratica.approvazione"); - // statusLabel.put(StatoPraticaConstants.FINE_LAVORI_CON_ANOMALIA, - // "label.admingeniocivile.statopratica.finelavorianomalia"); - - statusFilterLabel = new LinkedHashMap(); - for (String statoPratica : statusLabel.keySet()) { - if (/* !statoPratica.equals(StatoPraticaConstants.FINE_LAVORI_CON_ANOMALIA) && */ - !statoPratica.equals(StatoPraticaConstants.SORTEGGIATA)) { - statusFilterLabel.put(statoPratica, statusLabel.get(statoPratica)); - } - } - } - - public static String getStatusLabel(String statoPratica) { - - return getStatusLabelMap().get(statoPratica); - } - - public static Map getStatusLabelMap() { - - return statusLabel; - } + public final static String SORTEGGIATA = "SO"; + + public final static String SOTTOPOSTA_A_PARERE = "SP"; + + public final static String RIFIUTATA = "RI"; + public final static String VIDIMATA = "VI"; + + public final static String CONFORME = "CO"; + public final static String NON_CONFORME = "NC"; + + public final static String INTEGRAZIONE = "IN"; + + public final static String VARIATA = "VA"; + + public static final String FINE_LAVORI = "FL"; + public static final String COLLAUDO = "CL"; + public static final String FINE_LAVORI_PARZIALE = "FP"; + public static final String COLLAUDO_PARZIALE = "CP"; + + public static final String ANNULLATA = "AL"; + + public static final String INTEGRAZIONE_ACCETTATA = "SI"; + + /* Stati "virtuali" */ + public static final String CAMBIO_ISTRUTTORE = "CI"; + public final static String AUTORIZZATA = "AU"; + public final static String NON_AUTORIZZATA = "AN"; + public final static String ANNULLA_ISTANZA = "AI"; + public final static String VARIAZIONE_SOGGETTI = "VS"; + public static final String INVIO_AVVISO_MANUALE = "MA"; + + private static final Map statusLabel; + private static final Map statusFilterLabel; + + static { + statusLabel = new LinkedHashMap(); + statusLabel.put(StatoPraticaConstants.SORTEGGIATA, "label.admingeniocivile.statopratica.sorteggiata"); + statusLabel.put(StatoPraticaConstants.SOTTOPOSTA_A_PARERE, + "label.admingeniocivile.statopratica.sottopostaaparere"); + statusLabel.put(StatoPraticaConstants.VIDIMATA, "label.admingeniocivile.statopratica.vidimata"); + statusLabel.put(StatoPraticaConstants.CONFORME, "label.admingeniocivile.statopratica.conforme"); + statusLabel + .put(StatoPraticaConstants.NON_CONFORME, "label.admingeniocivile.statopratica.nonconforme"); + statusLabel.put(StatoPraticaConstants.AUTORIZZATA, + "label.admingeniocivile.statopratica.autorizzazione"); + statusLabel.put(StatoPraticaConstants.NON_AUTORIZZATA, + "label.admingeniocivile.statopratica.autorizzazionenegata"); + statusLabel.put(StatoPraticaConstants.INTEGRAZIONE, + "label.admingeniocivile.statopratica.integrazione"); + statusLabel.put(StatoPraticaConstants.RIFIUTATA, "label.admingeniocivile.statopratica.rifiutata"); + statusLabel.put(StatoPraticaConstants.FINE_LAVORI, "label.admingeniocivile.statopratica.finelavori"); + statusLabel.put(StatoPraticaConstants.COLLAUDO, "label.admingeniocivile.statopratica.collaudo"); + statusLabel.put(StatoPraticaConstants.FINE_LAVORI_PARZIALE, + "label.admingeniocivile.statopratica.finelavoriparziale"); + statusLabel.put(StatoPraticaConstants.COLLAUDO_PARZIALE, + "label.admingeniocivile.statopratica.collaudoparziale"); + statusLabel.put(StatoPraticaConstants.ANNULLATA, "label.admingeniocivile.statopratica.annullata"); + statusLabel.put(StatoPraticaConstants.CAMBIO_ISTRUTTORE, + "label.admingeniocivile.statopratica.cambiIstruttore"); + + statusFilterLabel = new LinkedHashMap(); + for (String statoPratica : statusLabel.keySet()) { + if (!statoPratica.equals(StatoPraticaConstants.SORTEGGIATA)) { + statusFilterLabel.put(statoPratica, statusLabel.get(statoPratica)); + } + } + } + + public static String getStatusLabel(String statoPratica) { + + return getStatusLabelMap().get(statoPratica); + } + + public static Map getStatusLabelMap() { + + return statusLabel; + } } diff --git a/liferay-plugins-sdk-6.2/shared/portos-kaleo-shared/.classpath b/liferay-plugins-sdk-6.2/shared/portos-kaleo-shared/.classpath index 625fb07b..ab48b570 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-kaleo-shared/.classpath +++ b/liferay-plugins-sdk-6.2/shared/portos-kaleo-shared/.classpath @@ -1,7 +1,7 @@ - +