From 42b5422ff250d893a186fcf03c5a31f64852edfa Mon Sep 17 00:00:00 2001 From: Salvatore La Manna Date: Sat, 14 Nov 2020 01:05:40 +0100 Subject: [PATCH] FixPulizia --- ...atabase.java => ManutenzioneDatabase.java} | 228 +-- .../it/mwg/sismica/bo/util/SismicaUtil.java | 1311 +++++++---------- .../portlet/SismicaAdministrationPortlet.java | 6 +- .../bo/scheduler/SchedulerInvioDocumento.java | 12 +- .../impl/AsseverazioneLocalServiceImpl.java | 2 +- .../impl/IntPraticaLocalServiceImpl.java | 2 +- .../html/fascicolo/advanced_search.jsp | 5 - .../docroot/html/fascicolo/view.jsp | 2 +- .../html/sismica_administration/view.jsp | 4 +- .../portlets/portos-firma-portlet/build.xml | 1 + .../lib/firma-application-shared-0.0.1.jar | Bin 5440 -> 0 bytes .../portos-mail-manager-portlet/.tern-project | 1 + .../docroot/WEB-INF/service.xml | 2 +- .../shared/portos-firma-shared/.classpath | 6 + .../shared/portos-firma-shared/.gitignore | 1 + .../shared/portos-firma-shared/.project | 17 + .../shared/portos-firma-shared/build.xml | 8 + .../src/it/tref/firma/shared/RestFile.java | 92 ++ .../src/it/tref/firma/shared/Risposta.java | 23 + .../tref/firma/shared/RispostaCostanti.java | 13 + .../src/it/tref/firma/shared/Stile.java | 26 + .../portos-mail-manager-shared/.classpath | 2 +- .../messaging/dto/MailTemplateMessage.java | 58 +- .../shared/messaging/dto/TemplateMessage.java | 167 ++- .../messaging/util/DestinationNames.java | 10 +- .../messaging/util/MailManagerUtil.java | 6 +- .../shared/model/FileAttachment.java | 163 +- .../shared/util/MailManagerConstants.java | 49 +- .../mailmanager/shared/util/MailUtil.java | 165 +-- .../mailmanager/shared/util/StringUtil.java | 15 +- 30 files changed, 1181 insertions(+), 1216 deletions(-) rename liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/{SvuotaDatabase.java => ManutenzioneDatabase.java} (86%) delete mode 100644 liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/lib/firma-application-shared-0.0.1.jar create mode 100644 liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/.tern-project create mode 100644 liferay-plugins-sdk-6.2/shared/portos-firma-shared/.classpath create mode 100644 liferay-plugins-sdk-6.2/shared/portos-firma-shared/.gitignore create mode 100644 liferay-plugins-sdk-6.2/shared/portos-firma-shared/.project create mode 100644 liferay-plugins-sdk-6.2/shared/portos-firma-shared/build.xml create mode 100644 liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/RestFile.java create mode 100644 liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/Risposta.java create mode 100644 liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/RispostaCostanti.java create mode 100644 liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/Stile.java diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SvuotaDatabase.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java similarity index 86% rename from liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SvuotaDatabase.java rename to liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java index fc3e4f73..aca061de 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SvuotaDatabase.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java @@ -149,8 +149,8 @@ import com.liferay.sync.service.SyncDLObjectLocalServiceUtil; * DELETE FROM "users_groups" WHERE "userid" IN (SELECT DISTINCT "ug"."userid" FROM "users_groups" "ug" LEFT JOIN "user_" "u" ON "ug"."userid"="u"."userid" WHERE "u"."userid" IS NULL); * */ -public class SvuotaDatabase { - private static final Log _log = LogFactoryUtil.getLog(SvuotaDatabase.class); +public class ManutenzioneDatabase { + private static final Log _log = LogFactoryUtil.getLog(ManutenzioneDatabase.class); private static final int SLICE = 1000; // !Run!IntPratica!User!Reset! @@ -158,7 +158,7 @@ public class SvuotaDatabase { public static List pulisci(ServiceContext serviceContext, String mode) throws SystemException, PortalException { List esito = new ArrayList<>(); - if (mode.contains("!Run!")) { + if (mode.contains("!Pulisci!")) { long companyId = serviceContext.getCompanyId(); esito.addAll(puliziaDocumentLibrary(companyId)); if (mode.contains("!IntPratica!")) { @@ -180,6 +180,8 @@ public class SvuotaDatabase { } catch (IllegalStateException e) { } _log.info("Elaborazione completata correttamente."); + } else if (mode.contains("!Integrazioni!")) { + SismicaUtil.integrazioniScadute(); } else { esitoLog(esito, "Nessun comando"); } @@ -589,7 +591,7 @@ public class SvuotaDatabase { int rimossi = 0; intPratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, start + SLICE); for (IntPratica intPratica : intPratiche) { - IntPraticaLocalServiceUtil.deleteIntPratica(intPratica); + IntPraticaLocalServiceUtil.deleteIntPratica(intPratica, true); cancellati++; rimossi++; } @@ -916,118 +918,120 @@ public class SvuotaDatabase { } private static boolean esiste(String className, long classPK, long companyId) throws SystemException { - try { - if (ALLEGATOMANUALE_CLASS_NAME.equals(className)) { - AllegatoManualeLocalServiceUtil.getAllegatoManuale(classPK); - } else if (ASSETTAG_CLASS_NAME.equals(className)) { - AssetTagLocalServiceUtil.getAssetTag(classPK); - } else if (ASSETVOCABULARY_CLASS_NAME.equals(className)) { - AssetVocabularyLocalServiceUtil.getAssetVocabulary(classPK); - } else if (ASSEVERAZIONE_CLASS_NAME.equals(className)) { - AsseverazioneLocalServiceUtil.getAsseverazione(classPK); - } else if (AVVISO_CLASS_NAME.equals(className)) { - AvvisoLocalServiceUtil.getAvviso(classPK); - } else if (COLLAUDO_CLASS_NAME.equals(className)) { - CollaudoLocalServiceUtil.getCollaudo(classPK); - } else if (COMPANY_CLASS_NAME.equals(className)) { - CompanyLocalServiceUtil.getCompany(classPK); - } else if (CONTROLLOPRATICA_CLASS_NAME.equals(className)) { - ControlloPraticaLocalServiceUtil.getControlloPratica(classPK); - } else if (DOCAGGIUNTIVA_CLASS_NAME.equals(className)) { - DocAggiuntivaLocalServiceUtil.getDocAggiuntiva(classPK); - } else if (DOCPRATICA_CLASS_NAME.equals(className)) { - DocPraticaLocalServiceUtil.getDocPratica(classPK); - } else if (DDMSTRUCTURE_CLASS_NAME.equals(className)) { - DDMStructureLocalServiceUtil.getDDMStructure(classPK); - } else if (DDMTEMPLATE_CLASS_NAME.equals(className)) { - DDMTemplateLocalServiceUtil.getDDMTemplate(classPK); - } else if (DELEGA_CLASS_NAME.equals(className)) { - DelegaLocalServiceUtil.getDelega(classPK); - } else if (DETTPRATICA_CLASS_NAME.equals(className)) { - DettPraticaLocalServiceUtil.getDettPratica(classPK); - } else if (DLFILEENTRY_CLASS_NAME.equals(className)) { - DLAppLocalServiceUtil.getFileEntry(classPK); - } else if (DLFILEENTRYTYPE_CLASS_NAME.equals(className)) { - DLFileEntryTypeLocalServiceUtil.getDLFileEntryType(classPK); - } else if (DLFOLDER_CLASS_NAME.equals(className)) { - DLAppLocalServiceUtil.getFolder(classPK); - } else if (EMAIL_CLASS_NAME.equals(className)) { - EmailLocalServiceUtil.getEmail(classPK); - } else if (EMAILADDRESS_CLASS_NAME.equals(className)) { - EmailAddressLocalServiceUtil.getEmailAddress(classPK); - } else if (EMAILTEMPLATE_CLASS_NAME.equals(className)) { - EmailTemplateLocalServiceUtil.getEmailTemplate(classPK); - } else if (EXPANDOCOLUMN_CLASS_NAME.equals(className)) { - ExpandoColumnLocalServiceUtil.getExpandoColumn(classPK); - } else if (FINELAVORI_CLASS_NAME.equals(className)) { - FineLavoriLocalServiceUtil.getFineLavori(classPK); - } else if (GROUP_CLASS_NAME.equals(className)) { - GroupLocalServiceUtil.getGroup(classPK); - } else if (INTPRATICA_CLASS_NAME.equals(className)) { - IntPraticaLocalServiceUtil.getIntPratica(classPK); - } else if (JOURNALARTICLE_CLASS_NAME.equals(className)) { - JournalArticleLocalServiceUtil.getArticle(classPK); - } else if (JOURNALARTICLERESOURCE_CLASS_NAME.equals(className)) { - JournalArticleResourceLocalServiceUtil.getJournalArticleResource(classPK); - } else if (JOURNALFOLDER_CLASS_NAME.equals(className)) { - JournalFolderLocalServiceUtil.getJournalFolder(classPK); - } else if (LAYOUT_CLASS_NAME.equals(className)) { - LayoutLocalServiceUtil.getLayout(classPK); - } else if (LAYOUTPROTOTYPE_CLASS_NAME.equals(className)) { - LayoutPrototypeLocalServiceUtil.getLayoutPrototype(classPK); - } else if (LAYOUTSETPROTOTYPE_CLASS_NAME.equals(className)) { - LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(classPK); - } else if (MBDISCUSSION_CLASS_NAME.equals(className)) { - MBDiscussionLocalServiceUtil.getMBDiscussion(classPK); - } else if (MBMESSAGE_CLASS_NAME.equals(className)) { - MBMessageLocalServiceUtil.getMBMessage(classPK); - } else if (MBTHREAD_CLASS_NAME.equals(className)) { - MBThreadLocalServiceUtil.getMBThread(classPK); - } else if (ORGANIZATION_CLASS_NAME.equals(className)) { - OrganizationLocalServiceUtil.getOrganization(classPK); - } else if (PAGAMENTO_CLASS_NAME.equals(className)) { - PagamentoLocalServiceUtil.getPagamento(classPK); - } else if (PAREREGEOLOGO_CLASS_NAME.equals(className)) { - ParereGeologoLocalServiceUtil.getParereGeologo(classPK); - } else if (PASSWORDPOLICY_CLASS_NAME.equals(className)) { - PasswordPolicyLocalServiceUtil.getPasswordPolicy(classPK); - } else if (ROLE_CLASS_NAME.equals(className)) { - RoleLocalServiceUtil.getRole(classPK); - } else if (SOGGETTO_CLASS_NAME.equals(className)) { - SoggettoLocalServiceUtil.getSoggetto(classPK); - } else if (SORTEGGIO_CLASS_NAME.equals(className)) { - SorteggioLocalServiceUtil.getSorteggio(classPK); - } else if (USER_CLASS_NAME.equals(className)) { - UserLocalServiceUtil.getUser(classPK); - } else if (USERPERSONALSITE_CLASS_NAME.equals(className)) { - // Nop - } else if (WIKINODE_CLASS_NAME.equals(className)) { - WikiNodeLocalServiceUtil.getWikiNode(classPK); - } else if (WORKFLOWINSTANCE_CLASS_NAME.equals(className)) { - if (Validator.isNull(companyId)) { - _log.info("CompanyId = " + companyId); - ; + if (0 != classPK && Validator.isNotNull(className)) { + try { + if (ALLEGATOMANUALE_CLASS_NAME.equals(className)) { + AllegatoManualeLocalServiceUtil.getAllegatoManuale(classPK); + } else if (ASSETTAG_CLASS_NAME.equals(className)) { + AssetTagLocalServiceUtil.getAssetTag(classPK); + } else if (ASSETVOCABULARY_CLASS_NAME.equals(className)) { + AssetVocabularyLocalServiceUtil.getAssetVocabulary(classPK); + } else if (ASSEVERAZIONE_CLASS_NAME.equals(className)) { + AsseverazioneLocalServiceUtil.getAsseverazione(classPK); + } else if (AVVISO_CLASS_NAME.equals(className)) { + AvvisoLocalServiceUtil.getAvviso(classPK); + } else if (COLLAUDO_CLASS_NAME.equals(className)) { + CollaudoLocalServiceUtil.getCollaudo(classPK); + } else if (COMPANY_CLASS_NAME.equals(className)) { + CompanyLocalServiceUtil.getCompany(classPK); + } else if (CONTROLLOPRATICA_CLASS_NAME.equals(className)) { + ControlloPraticaLocalServiceUtil.getControlloPratica(classPK); + } else if (DOCAGGIUNTIVA_CLASS_NAME.equals(className)) { + DocAggiuntivaLocalServiceUtil.getDocAggiuntiva(classPK); + } else if (DOCPRATICA_CLASS_NAME.equals(className)) { + DocPraticaLocalServiceUtil.getDocPratica(classPK); + } else if (DDMSTRUCTURE_CLASS_NAME.equals(className)) { + DDMStructureLocalServiceUtil.getDDMStructure(classPK); + } else if (DDMTEMPLATE_CLASS_NAME.equals(className)) { + DDMTemplateLocalServiceUtil.getDDMTemplate(classPK); + } else if (DELEGA_CLASS_NAME.equals(className)) { + DelegaLocalServiceUtil.getDelega(classPK); + } else if (DETTPRATICA_CLASS_NAME.equals(className)) { + DettPraticaLocalServiceUtil.getDettPratica(classPK); + } else if (DLFILEENTRY_CLASS_NAME.equals(className)) { + DLAppLocalServiceUtil.getFileEntry(classPK); + } else if (DLFILEENTRYTYPE_CLASS_NAME.equals(className)) { + DLFileEntryTypeLocalServiceUtil.getDLFileEntryType(classPK); + } else if (DLFOLDER_CLASS_NAME.equals(className)) { + DLAppLocalServiceUtil.getFolder(classPK); + } else if (EMAIL_CLASS_NAME.equals(className)) { + EmailLocalServiceUtil.getEmail(classPK); + } else if (EMAILADDRESS_CLASS_NAME.equals(className)) { + EmailAddressLocalServiceUtil.getEmailAddress(classPK); + } else if (EMAILTEMPLATE_CLASS_NAME.equals(className)) { + EmailTemplateLocalServiceUtil.getEmailTemplate(classPK); + } else if (EXPANDOCOLUMN_CLASS_NAME.equals(className)) { + ExpandoColumnLocalServiceUtil.getExpandoColumn(classPK); + } else if (FINELAVORI_CLASS_NAME.equals(className)) { + FineLavoriLocalServiceUtil.getFineLavori(classPK); + } else if (GROUP_CLASS_NAME.equals(className)) { + GroupLocalServiceUtil.getGroup(classPK); + } else if (INTPRATICA_CLASS_NAME.equals(className)) { + IntPraticaLocalServiceUtil.getIntPratica(classPK); + } else if (JOURNALARTICLE_CLASS_NAME.equals(className)) { + JournalArticleLocalServiceUtil.getArticle(classPK); + } else if (JOURNALARTICLERESOURCE_CLASS_NAME.equals(className)) { + JournalArticleResourceLocalServiceUtil.getJournalArticleResource(classPK); + } else if (JOURNALFOLDER_CLASS_NAME.equals(className)) { + JournalFolderLocalServiceUtil.getJournalFolder(classPK); + } else if (LAYOUT_CLASS_NAME.equals(className)) { + LayoutLocalServiceUtil.getLayout(classPK); + } else if (LAYOUTPROTOTYPE_CLASS_NAME.equals(className)) { + LayoutPrototypeLocalServiceUtil.getLayoutPrototype(classPK); + } else if (LAYOUTSETPROTOTYPE_CLASS_NAME.equals(className)) { + LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(classPK); + } else if (MBDISCUSSION_CLASS_NAME.equals(className)) { + MBDiscussionLocalServiceUtil.getMBDiscussion(classPK); + } else if (MBMESSAGE_CLASS_NAME.equals(className)) { + MBMessageLocalServiceUtil.getMBMessage(classPK); + } else if (MBTHREAD_CLASS_NAME.equals(className)) { + MBThreadLocalServiceUtil.getMBThread(classPK); + } else if (ORGANIZATION_CLASS_NAME.equals(className)) { + OrganizationLocalServiceUtil.getOrganization(classPK); + } else if (PAGAMENTO_CLASS_NAME.equals(className)) { + PagamentoLocalServiceUtil.getPagamento(classPK); + } else if (PAREREGEOLOGO_CLASS_NAME.equals(className)) { + ParereGeologoLocalServiceUtil.getParereGeologo(classPK); + } else if (PASSWORDPOLICY_CLASS_NAME.equals(className)) { + PasswordPolicyLocalServiceUtil.getPasswordPolicy(classPK); + } else if (ROLE_CLASS_NAME.equals(className)) { + RoleLocalServiceUtil.getRole(classPK); + } else if (SOGGETTO_CLASS_NAME.equals(className)) { + SoggettoLocalServiceUtil.getSoggetto(classPK); + } else if (SORTEGGIO_CLASS_NAME.equals(className)) { + SorteggioLocalServiceUtil.getSorteggio(classPK); + } else if (USER_CLASS_NAME.equals(className)) { + UserLocalServiceUtil.getUser(classPK); + } else if (USERPERSONALSITE_CLASS_NAME.equals(className)) { + // Nop + } else if (WIKINODE_CLASS_NAME.equals(className)) { + WikiNodeLocalServiceUtil.getWikiNode(classPK); + } else if (WORKFLOWINSTANCE_CLASS_NAME.equals(className)) { + if (Validator.isNull(companyId)) { + _log.info("CompanyId = " + companyId); + ; + } else { + WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, classPK); + } } else { - WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, classPK); - } - } else { - if (className.contains(".")) { - switch (className) { - case "com.liferay.portlet.blogs": - case "com.liferay.portlet.documentlibrary": - case "com.liferay.portlet.journal": - case "com.liferay.portlet.messageboards": - case "com.liferay.portlet.polls": - case "com.liferay.portlet.wiki": - case "it.tref.liferay.portos.bo.intpratiche": - break; - default: - _log.info("Classe non supportata: " + className); + if (className.contains(".")) { + switch (className) { + case "com.liferay.portlet.blogs": + case "com.liferay.portlet.documentlibrary": + case "com.liferay.portlet.journal": + case "com.liferay.portlet.messageboards": + case "com.liferay.portlet.polls": + case "com.liferay.portlet.wiki": + case "it.tref.liferay.portos.bo.intpratiche": + break; + default: + _log.info("Classe non supportata: " + className); + } } } + } catch (PortalException e) { + return false; } - } catch (PortalException e) { - return false; } return true; } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java index fc9aba66..307a12d0 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java @@ -5,7 +5,6 @@ */ package it.mwg.sismica.bo.util; -import flexjson.JSONSerializer; import it.tref.liferay.portos.bo.model.AllegatoManuale; import it.tref.liferay.portos.bo.model.Asseverazione; import it.tref.liferay.portos.bo.model.Avviso; @@ -60,9 +59,12 @@ import javax.portlet.ActionResponse; import com.liferay.counter.service.CounterLocalServiceUtil; import com.liferay.portal.NoSuchResourcePermissionException; +import com.liferay.portal.kernel.dao.orm.DynamicQuery; import com.liferay.portal.kernel.dao.orm.QueryUtil; +import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; @@ -87,8 +89,10 @@ import com.liferay.portal.model.Organization; import com.liferay.portal.model.ResourceAction; import com.liferay.portal.model.ResourceConstants; import com.liferay.portal.model.ResourcePermission; +import com.liferay.portal.model.Role; import com.liferay.portal.model.RoleConstants; import com.liferay.portal.model.User; +import com.liferay.portal.model.WorkflowInstanceLink; import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.security.permission.PermissionChecker; import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil; @@ -98,11 +102,18 @@ import com.liferay.portal.service.ResourcePermissionLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserLocalServiceUtil; +import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil; import com.liferay.portal.theme.ThemeDisplay; +import com.liferay.portal.workflow.kaleo.definition.LogType; +import com.liferay.portal.workflow.kaleo.model.KaleoInstance; import com.liferay.portal.workflow.kaleo.model.KaleoInstanceToken; +import com.liferay.portal.workflow.kaleo.model.KaleoLog; +import com.liferay.portal.workflow.kaleo.model.KaleoNode; import com.liferay.portal.workflow.kaleo.model.KaleoTaskAssignmentInstance; import com.liferay.portal.workflow.kaleo.model.KaleoTaskInstanceToken; +import com.liferay.portal.workflow.kaleo.service.KaleoInstanceLocalServiceUtil; import com.liferay.portal.workflow.kaleo.service.KaleoInstanceTokenLocalServiceUtil; +import com.liferay.portal.workflow.kaleo.service.KaleoLogLocalServiceUtil; import com.liferay.portal.workflow.kaleo.service.KaleoTaskAssignmentInstanceLocalServiceUtil; import com.liferay.portal.workflow.kaleo.service.KaleoTaskInstanceTokenLocalServiceUtil; import com.liferay.portlet.documentlibrary.model.DLFileEntry; @@ -112,10 +123,8 @@ import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil; public class SismicaUtil { private final static Log _log = LogFactoryUtil.getLog(SismicaUtil.class); - private static final SimpleDateFormat dfmt = new SimpleDateFormat( - "dd/MM/yyyy hh:mm:ss"); - private static final SimpleDateFormat sdfGiornoDB = new SimpleDateFormat( - "yyyy-MM-dd"); + private static final SimpleDateFormat dfmt = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + private static final SimpleDateFormat sdfGiornoDB = new SimpleDateFormat("yyyy-MM-dd"); private final static int SLICE = 1000; public static Date[] getWeekInterval(int dow) { @@ -131,8 +140,7 @@ public class SismicaUtil { reference.set(Calendar.SECOND, 0); reference.set(Calendar.MILLISECOND, 0); - reference.add(Calendar.DAY_OF_WEEK, - Calendar.MONDAY - reference.get(Calendar.DAY_OF_WEEK)); + reference.add(Calendar.DAY_OF_WEEK, Calendar.MONDAY - reference.get(Calendar.DAY_OF_WEEK)); reference.add(Calendar.MILLISECOND, -1); Date end = reference.getTime(); @@ -167,26 +175,168 @@ public class SismicaUtil { return null; } - public static Long daysBetween(String start, String end) { - Long diff = null; - try { - diff = daysBetween(sdfGiornoDB.parse(start), sdfGiornoDB.parse(end)); - } catch (ParseException e) { + public static void integrazioniScadute() throws SystemException, PortalException { + final int giorniScadenza = 120; + final long taskId = 21642; + final String taskName = "Esito"; + final long nodeId = 21639; + final String nodeName = "Esito"; + final String validCurrentNodeName = "signal_cittadino"; + final String comment = "Pratica riassegnata automaticamente dal sistema per scadenza dei termini di integrazione"; + + Calendar calendar = Calendar.getInstance(); + Date adesso = calendar.getTime(); + calendar.set(Calendar.HOUR, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.add(Calendar.DAY_OF_YEAR, -giorniScadenza); + Date inizio = calendar.getTime(); + + int scadute = 0; + DynamicQuery dynamicQuery = IntPraticaLocalServiceUtil.dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("statoPratica", StatoPraticaConstants.INTEGRAZIONE)); + List pratiche = IntPraticaLocalServiceUtil.dynamicQuery(dynamicQuery); + for (IntPratica pratica : pratiche) { + Date dtUltimoAvviso = null; + List avvisi = AvvisoLocalServiceUtil.findByIntPraticaId_tipoDocumento( + pratica.getIntPraticaId(), StatoPraticaConstants.INTEGRAZIONE); + for (Avviso avviso : avvisi) { + if (avviso.getTipoAvviso().equalsIgnoreCase(AvvisoUtil.TIPO_AVVISO_FIRMA) + && avviso.getInviato().equalsIgnoreCase(AvvisoUtil.DOCUMENTO_INVIATO) + && !avviso.getAnnullato() && !avviso.getRifiutato() && !avviso.getErrore() + && (Validator.isNull(dtUltimoAvviso) || dtUltimoAvviso.before(avviso.getDtInvio()))) { + dtUltimoAvviso = avviso.getDtInvio(); + } + } + if (Validator.isNotNull(dtUltimoAvviso) && dtUltimoAvviso.before(inizio)) { + scadute++; + List controlli = ControlloPraticaLocalServiceUtil + .findByIntPraticaId_Status(pratica.getIntPraticaId(), + WorkflowConstants.STATUS_TASK_APPROVAZIONE_ESITO_ISTRUTTORIA); + if (1 == controlli.size()) { + ControlloPratica controllo = controlli.get(0); + long companyId = controllo.getCompanyId(); + long groupId = controllo.getGroupId(); + long tecnicoUserId = pratica.getStatusByUserId(); + + WorkflowInstanceLink instanceLink = WorkflowInstanceLinkLocalServiceUtil + .getWorkflowInstanceLink(companyId, groupId, ControlloPratica.class.getName(), + controllo.getPrimaryKey()); + KaleoInstance instance = KaleoInstanceLocalServiceUtil.getKaleoInstance(instanceLink + .getWorkflowInstanceId()); + + KaleoInstanceToken instanceToken = KaleoInstanceTokenLocalServiceUtil + .getKaleoInstanceToken(instance.getRootKaleoInstanceTokenId()); + + if (validCurrentNodeName.equals(instanceToken.getCurrentKaleoNodeName())) { + + Role adminRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR); + User adminUser = UserLocalServiceUtil.getRoleUsers(adminRole.getRoleId(), 0, 1) + .get(0); + ServiceContext scAdmin = new ServiceContext(); + scAdmin.setCompanyId(companyId); + scAdmin.setScopeGroupId(groupId); + scAdmin.setUserId(adminUser.getUserId()); + + ServiceContext scTecnico = new ServiceContext(); + scTecnico.setCompanyId(companyId); + scTecnico.setScopeGroupId(groupId); + scTecnico.setUserId(tecnicoUserId); + + List taskInstanceTokens = KaleoTaskInstanceTokenLocalServiceUtil + .getKaleoTaskInstanceTokens(instance.getKaleoInstanceId(), true, 0, 1, + OrderByComparatorFactoryUtil.create("KaleoTaskInstanceToken", + "kaleoTaskInstanceTokenId", false), scTecnico); + if (taskInstanceTokens.size() > 0) { + @SuppressWarnings("unchecked") + Map workflowContext = (Map) JSONFactoryUtil + .deserialize(taskInstanceTokens.get(0).getWorkflowContext()); + long definitionId = taskInstanceTokens.get(0).getKaleoDefinitionId(); + User tecnicoUser = UserLocalServiceUtil.getUser(tecnicoUserId); + + KaleoTaskInstanceToken taskInstanceToken = KaleoTaskInstanceTokenLocalServiceUtil + .createKaleoTaskInstanceToken(CounterLocalServiceUtil.increment()); + taskInstanceToken.setGroupId(groupId); + taskInstanceToken.setCompanyId(companyId); + taskInstanceToken.setUserId(adminUser.getUserId()); + taskInstanceToken.setUserName(adminUser.getFullName()); + taskInstanceToken.setCreateDate(adesso); + taskInstanceToken.setModifiedDate(adesso); + taskInstanceToken.setKaleoDefinitionId(definitionId); + taskInstanceToken.setKaleoInstanceId(instance.getKaleoInstanceId()); + taskInstanceToken + .setKaleoInstanceTokenId(instanceToken.getKaleoInstanceTokenId()); + taskInstanceToken.setKaleoTaskId(taskId); + taskInstanceToken.setKaleoTaskName(taskName); + taskInstanceToken.setClassName(ControlloPratica.class.getName()); + taskInstanceToken.setClassPK(controllo.getPrimaryKey()); + taskInstanceToken.setWorkflowContext(JSONFactoryUtil.serialize(workflowContext)); + + KaleoTaskAssignmentInstanceLocalServiceUtil.addKaleoTaskAssignmentInstance( + groupId, taskInstanceToken, User.class.getName(), tecnicoUserId, scAdmin); + KaleoTaskInstanceTokenLocalServiceUtil + .updateKaleoTaskInstanceToken(taskInstanceToken); + + KaleoLog log = KaleoLogLocalServiceUtil.createKaleoLog(CounterLocalServiceUtil + .increment()); + log.setUserId(adminUser.getUserId()); + log.setUserName(adminUser.getFullName()); + log.setCompanyId(companyId); + log.setCreateDate(adesso); + log.setModifiedDate(adesso); + log.setKaleoClassName(KaleoNode.class.getName()); + log.setKaleoClassPK(nodeId); + log.setKaleoDefinitionId(definitionId); + log.setKaleoInstanceId(instance.getKaleoInstanceId()); + log.setKaleoInstanceTokenId(instanceToken.getKaleoInstanceTokenId()); + log.setKaleoTaskInstanceTokenId(taskInstanceToken.getKaleoTaskInstanceTokenId()); + log.setKaleoNodeName(nodeName); + log.setCurrentAssigneeClassName(User.class.getName()); + log.setCurrentAssigneeClassPK(tecnicoUserId); + log.setType(LogType.TASK_ASSIGNMENT.name()); + log.setComment(comment); + log.setStartDate(adesso); + log.setWorkflowContext(JSONFactoryUtil.serialize(workflowContext)); + KaleoLogLocalServiceUtil.updateKaleoLog(log); + + instanceToken.setCurrentKaleoNodeId(nodeId); + instanceToken.setCurrentKaleoNodeName(nodeName); + KaleoInstanceTokenLocalServiceUtil.updateKaleoInstanceToken(instanceToken); + + _log.info("Integrazione scaduta da " + + (daysBetween(dtUltimoAvviso, adesso) - giorniScadenza) + + " giorni. Workflow instance " + instance.getKaleoInstanceId() + + " per pratica " + pratica.getNumeroProgetto() + " (" + + pratica.getIntPraticaId() + "), istruttore " + + tecnicoUser.getFullName()); + } else { + _log.info("Errore su integrazione. Pratica " + pratica.getNumeroProgetto() + " (" + + pratica.getIntPraticaId() + "), controllo " + + controllo.getControlloPraticaId() + ", taskInstanceToken = " + + taskInstanceTokens.size()); + } + } + } else { + _log.info("Errore su integrazione. Pratica " + pratica.getNumeroProgetto() + " (" + + pratica.getIntPraticaId() + ") l'integrazione è scaduta da " + + (daysBetween(dtUltimoAvviso, adesso) - giorniScadenza) + ", controlli " + + controlli.size()); + } + } } - return diff; + _log.info("Pratiche con richiesta di integrazione " + pratiche.size() + ", scadute " + scadute); + } + + public static long daysBetween(String start, String end) throws ParseException { + return daysBetween(sdfGiornoDB.parse(start), sdfGiornoDB.parse(end)); } - public static Long daysPast(Date start) { + public static long daysPast(Date start) { return daysBetween(start, new Date()); } - public static Long daysPast(String start) { - Long diff = null; - try { - diff = daysBetween(sdfGiornoDB.parse(start), new Date()); - } catch (ParseException e) { - } - return diff; + public static long daysPast(String start) throws ParseException { + return daysBetween(sdfGiornoDB.parse(start), new Date()); } public static boolean isLong(String s) { @@ -201,13 +351,11 @@ public class SismicaUtil { public static List reIndexFascicoli(long companyId) { List esito = new ArrayList<>(); - int start = 0; int totale = 0; List pratiche = null; do { try { - pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, - start + SLICE); + pratiche = IntPraticaLocalServiceUtil.getIntPraticas(totale, totale + SLICE); } catch (SystemException e) { pratiche = new ArrayList<>(); } @@ -215,42 +363,35 @@ public class SismicaUtil { IntPraticaLocalServiceUtil.reIndexFascicolo(pratica, companyId); } totale += pratiche.size(); - start += SLICE; - _log.info("Reindicizzate " + start + " pratiche"); + _log.info("Reindicizzate " + totale + " pratiche"); } while (pratiche.size() > 0); esito.add("" + totale + " pratiche reindicizzate."); return esito; } - public static void inviaAvviso(ActionRequest actionRequest, - ActionResponse actionResponse) throws SystemException { + public static void inviaAvviso(ActionRequest actionRequest, ActionResponse actionResponse) + throws SystemException { List esito = new ArrayList<>(); - ThemeDisplay td = (ThemeDisplay) actionRequest - .getAttribute(WebKeys.THEME_DISPLAY); + ThemeDisplay td = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long companyId = td.getCompanyId(); String tipoAvviso = ParamUtil.getString(actionRequest, "tipoAvviso"); actionResponse.setRenderParameter("tipoAvviso", tipoAvviso); if (Validator.isNull(tipoAvviso)) { SessionErrors.add(actionRequest, "invia-avviso-tipo-obbligatorio"); } - String numeroProgetto = ParamUtil.getString(actionRequest, - "numeroProgetto"); + String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto"); actionResponse.setRenderParameter("numeroProgetto", numeroProgetto); if (Validator.isNull(numeroProgetto)) { - SessionErrors.add(actionRequest, - "invia-avviso-progetto-obbligatorio"); + SessionErrors.add(actionRequest, "invia-avviso-progetto-obbligatorio"); } - IntPratica intPratica = IntPraticaLocalServiceUtil - .findByNumeroProgetto(numeroProgetto); + IntPratica intPratica = IntPraticaLocalServiceUtil.findByNumeroProgetto(numeroProgetto); if (Validator.isNull(intPratica)) { - SessionErrors.add(actionRequest, - "invia-avviso-progetto-inesistente"); + SessionErrors.add(actionRequest, "invia-avviso-progetto-inesistente"); return; } long intPraticaId = intPratica.getIntPraticaId(); - List controlli = ControlloPraticaLocalServiceUtil - .findByIntPratica(intPraticaId); + List controlli = ControlloPraticaLocalServiceUtil.findByIntPratica(intPraticaId); long controlloPraticaId = 0; for (ControlloPratica controllo : controlli) { controlloPraticaId = controllo.getControlloPraticaId(); @@ -262,12 +403,9 @@ public class SismicaUtil { switch (tipoAvviso) { case StatoPraticaConstants.COLLAUDO: - List collaudi = CollaudoLocalServiceUtil - .findByIntPraticaId_Completata(intPraticaId, true, - QueryUtil.ALL_POS, QueryUtil.ALL_POS, - OrderByComparatorFactoryUtil.create( - CollaudoImpl.TABLE_NAME, "dtProtocollo", - true)); + List collaudi = CollaudoLocalServiceUtil.findByIntPraticaId_Completata(intPraticaId, + true, QueryUtil.ALL_POS, QueryUtil.ALL_POS, + OrderByComparatorFactoryUtil.create(CollaudoImpl.TABLE_NAME, "dtProtocollo", true)); Collaudo collaudo = null; for (Collaudo el : collaudi) { if (Validator.isNotNull(el.getDtProtocollo())) { @@ -275,8 +413,7 @@ public class SismicaUtil { } } if (Validator.isNull(collaudo)) { - SessionErrors.add(actionRequest, - "invia-avviso-collaudo-non-trovato"); + SessionErrors.add(actionRequest, "invia-avviso-collaudo-non-trovato"); return; } tipoDocumento = StatoPraticaConstants.VIDIMATA; @@ -286,12 +423,9 @@ public class SismicaUtil { break; case StatoPraticaConstants.FINE_LAVORI: - List fineLavori = FineLavoriLocalServiceUtil - .findByIntPraticaId_Completata(intPraticaId, true, - QueryUtil.ALL_POS, QueryUtil.ALL_POS, - OrderByComparatorFactoryUtil.create( - FineLavoriImpl.TABLE_NAME, "dtProtocollo", - true)); + List fineLavori = FineLavoriLocalServiceUtil.findByIntPraticaId_Completata( + intPraticaId, true, QueryUtil.ALL_POS, QueryUtil.ALL_POS, + OrderByComparatorFactoryUtil.create(FineLavoriImpl.TABLE_NAME, "dtProtocollo", true)); FineLavori fineLavoro = null; for (FineLavori el : fineLavori) { if (Validator.isNotNull(el.getDtProtocollo())) { @@ -299,8 +433,7 @@ public class SismicaUtil { } } if (Validator.isNull(fineLavoro)) { - SessionErrors.add(actionRequest, - "invia-avviso-finelavori-non-trovato"); + SessionErrors.add(actionRequest, "invia-avviso-finelavori-non-trovato"); return; } tipoDocumento = StatoPraticaConstants.VIDIMATA; @@ -333,23 +466,18 @@ public class SismicaUtil { return; } - String templateName = AvvisoUtil.getAllTipoDocumentoFileTemplateProps() - .get(tipoAvviso); - long template = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong( - companyId, templateName); + String templateName = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(tipoAvviso); + long template = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, templateName); esito.add("template = " + templateName); try { - AvvisoLocalServiceUtil.addAvviso(intPraticaId, StringPool.BLANK, - new Date(), AvvisoUtil.TIPO_AVVISO_DIRETTO, tipoDocumento, - template, classPk, className, controlloPraticaId, - getServiceContextbyIntPratica(intPratica)); + AvvisoLocalServiceUtil.addAvviso(intPraticaId, StringPool.BLANK, new Date(), + AvvisoUtil.TIPO_AVVISO_DIRETTO, tipoDocumento, template, classPk, className, + controlloPraticaId, getServiceContextbyIntPratica(intPratica)); } catch (PortalException e) { SessionErrors.add(actionRequest, "errore-generico"); - esito.add("Errore durante la generazione dell'avviso: " - + e.getMessage()); + esito.add("Errore durante la generazione dell'avviso: " + e.getMessage()); } - actionResponse.setRenderParameter("esito", - esito.toArray(new String[esito.size()])); + actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); } public static List riparaWorkflow(long companyId, long userId) { @@ -367,8 +495,7 @@ public class SismicaUtil { return esito; } - private static List riparaAssegnazioniAlRuolo(long companyId, - long userId) { + private static List riparaAssegnazioniAlRuolo(long companyId, long userId) { List esito = new ArrayList<>(); esito.add("Controllo assegnazioni al ruolo"); @@ -376,19 +503,18 @@ public class SismicaUtil { List tasks = null; do { try { - tasks = WorkflowTaskManagerUtil.getWorkflowTasks(companyId, - false, start, start + SLICE, null); + tasks = WorkflowTaskManagerUtil + .getWorkflowTasks(companyId, false, start, start + SLICE, null); } catch (WorkflowException e) { - esito.add("Errore durante il recupero dei task: " - + e.getMessage()); + esito.add("Errore durante il recupero dei task: " + e.getMessage()); tasks = new ArrayList<>(); } start += SLICE; for (WorkflowTask task : tasks) { WorkflowInstance instance; try { - instance = WorkflowInstanceManagerUtil.getWorkflowInstance( - companyId, task.getWorkflowInstanceId()); + instance = WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, + task.getWorkflowInstanceId()); } catch (WorkflowException e) { esito.add("Errore durante il recupero di WorkflowInstance per WorkflowTask " + task.getWorkflowTaskId() + ": " + e.getMessage()); @@ -398,70 +524,46 @@ public class SismicaUtil { long assigneeId = task.getAssigneeUserId(); boolean nonAssegnato = ((assigneeId == 0) || (assigneeId == -1)); if (nonAssegnato && (instance.getState().equals("Esito"))) { - Map attributes = task - .getOptionalAttributes(); - String taskClass = (String) attributes - .get(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME); + Map attributes = task.getOptionalAttributes(); + String taskClass = (String) attributes.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME); if (taskClass.equals(ControlloPratica.class.getName())) { long classPK = GetterUtil.getLong((String) attributes .get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK)); ControlloPratica controllo; try { - controllo = ControlloPraticaLocalServiceUtil - .getControlloPratica(classPK); + controllo = ControlloPraticaLocalServiceUtil.getControlloPratica(classPK); } catch (PortalException | SystemException e) { - esito.add("Errore durante il recupero del ControlloPratica " - + classPK - + ", WorkflowTask " - + task.getWorkflowTaskId() - + ": " - + e.getMessage()); + esito.add("Errore durante il recupero del ControlloPratica " + classPK + + ", WorkflowTask " + task.getWorkflowTaskId() + ": " + e.getMessage()); return esito; } IntPratica pratica; try { - pratica = IntPraticaLocalServiceUtil - .getIntPratica(controllo.getIntPraticaId()); + pratica = IntPraticaLocalServiceUtil.getIntPratica(controllo.getIntPraticaId()); } catch (PortalException | SystemException e) { esito.add("Errore durante il recupero di IntPratica " - + controllo.getIntPraticaId() - + ", ControlloPratica " - + classPK - + ", WorkflowTask " - + task.getWorkflowTaskId() - + ": " - + e.getMessage()); + + controllo.getIntPraticaId() + ", ControlloPratica " + classPK + + ", WorkflowTask " + task.getWorkflowTaskId() + ": " + e.getMessage()); return esito; } User user = null; try { - user = UserLocalServiceUtil.getUser(pratica - .getStatusByUserId()); + user = UserLocalServiceUtil.getUser(pratica.getStatusByUserId()); } catch (PortalException | SystemException e) { - esito.add("Errore durante il recupero dell'utente " - + pratica.getStatusByUserId()); + esito.add("Errore durante il recupero dell'utente " + pratica.getStatusByUserId()); return esito; } - esito.add("Pratica non assegnabile " - + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() - + ") - Kaleo disallineato WorkflowInstance " - + instance.getWorkflowInstanceId() - + ", riassegno a " + user.getFirstName() + " " - + user.getLastName()); + esito.add("Pratica non assegnabile " + pratica.getNumeroProgetto() + " (" + + pratica.getIntPraticaId() + ") - Kaleo disallineato WorkflowInstance " + + instance.getWorkflowInstanceId() + ", riassegno a " + user.getFirstName() + + " " + user.getLastName()); try { - WorkflowTaskManagerUtil - .assignWorkflowTaskToUser( - companyId, - userId, - task.getWorkflowTaskId(), - pratica.getStatusByUserId(), - "Riassegnazione automatica da sistema per recupero workflow", - task.getDueDate(), - instance.getWorkflowContext()); + WorkflowTaskManagerUtil.assignWorkflowTaskToUser(companyId, userId, + task.getWorkflowTaskId(), pratica.getStatusByUserId(), + "Riassegnazione automatica da sistema per recupero workflow", + task.getDueDate(), instance.getWorkflowContext()); } catch (WorkflowException e) { - esito.add("Errore durante la riassegnazione: " - + e.getMessage()); + esito.add("Errore durante la riassegnazione: " + e.getMessage()); } } else { esito.add("La classe del task è " + taskClass); @@ -479,16 +581,12 @@ public class SismicaUtil { int dow; Date data; try { - dow = Integer.parseInt(ConfigurazioneLocalServiceUtil - .findByC_ChiaveString(companyId, - ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO)); - data = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss") - .parse(ConfigurazioneLocalServiceUtil.findByC_ChiaveString( - companyId, - ConfigurazioneConstants.DATE_ULTIMO_SORTEGGIO)); + dow = Integer.parseInt(ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, + ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO)); + data = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse(ConfigurazioneLocalServiceUtil + .findByC_ChiaveString(companyId, ConfigurazioneConstants.DATE_ULTIMO_SORTEGGIO)); } catch (ParseException | NumberFormatException | SystemException e) { - esito.add("Errore nel recupero della configurazione sorteggio: " - + e.getMessage()); + esito.add("Errore nel recupero della configurazione sorteggio: " + e.getMessage()); return esito; } data = getWeekInterval(dow, data)[1]; @@ -497,73 +595,52 @@ public class SismicaUtil { int start = 0; do { try { - pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, - start + SLICE); + pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, start + SLICE); start += SLICE; for (IntPratica pratica : pratiche) { int numeroAvvisi = 0; - numeroAvvisi = AvvisoLocalServiceUtil - .findByIntPratica_Inviato( - pratica.getIntPraticaId(), "S", - QueryUtil.ALL_POS, QueryUtil.ALL_POS, null) - .size(); - if (pratica.getTipoProcedura().equalsIgnoreCase( - Constants.PROCEDURA_B1) + numeroAvvisi = AvvisoLocalServiceUtil.findByIntPratica_Inviato(pratica.getIntPraticaId(), + "S", QueryUtil.ALL_POS, QueryUtil.ALL_POS, null).size(); + if (pratica.getTipoProcedura().equalsIgnoreCase(Constants.PROCEDURA_B1) && Validator.isNull(pratica.getDtSorteggio()) - && pratica.getStatoPratica().equalsIgnoreCase( - StatoPraticaConstants.VIDIMATA) - && (numeroAvvisi < 2) - && (pratica.getDtPratica().compareTo(data) <= 0)) { - esito.add(" Pratica " + pratica.getNumeroProgetto() - + " (" + pratica.getIntPraticaId() + ") - " - + pratica.getUserName() + ", " + numeroAvvisi - + " avvisi"); + && pratica.getStatoPratica().equalsIgnoreCase(StatoPraticaConstants.VIDIMATA) + && (numeroAvvisi < 2) && (pratica.getDtPratica().compareTo(data) <= 0)) { + esito.add(" Pratica " + pratica.getNumeroProgetto() + " (" + + pratica.getIntPraticaId() + ") - " + pratica.getUserName() + ", " + + numeroAvvisi + " avvisi"); DettPratica dettPratica = DettPraticaLocalServiceUtil - .getLastCompletedByIntPratica(pratica - .getIntPraticaId()); - long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil - .findByC_ChiaveLong(companyId, - "conf.geniocivile.avviso.template.id.deposito.B2"); + .getLastCompletedByIntPratica(pratica.getIntPraticaId()); + long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong( + companyId, "conf.geniocivile.avviso.template.id.deposito.B2"); ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(dettPratica.getCompanyId()); - serviceContext - .setScopeGroupId(dettPratica.getGroupId()); + serviceContext.setScopeGroupId(dettPratica.getGroupId()); serviceContext.setUserId(dettPratica.getUserId()); ControlloPratica controllo = null; try { List controlli = ControlloPraticaLocalServiceUtil - .findByIntPraticaId_Status( - pratica.getIntPraticaId(), + .findByIntPraticaId_Status(pratica.getIntPraticaId(), WorkflowConstants.STATUS_PENDING); controllo = controlli.get(controlli.size() - 1); } catch (Exception e1) { try { - controllo = ControlloPraticaLocalServiceUtil - .addControlloPratica( - dettPratica.getGroupId(), - dettPratica.getUserId(), - pratica.getIntPraticaId(), - dettPratica.getDettPraticaId(), - false, serviceContext); + controllo = ControlloPraticaLocalServiceUtil.addControlloPratica( + dettPratica.getGroupId(), dettPratica.getUserId(), + pratica.getIntPraticaId(), dettPratica.getDettPraticaId(), false, + serviceContext); } catch (PortalException | SystemException e2) { esito.add("Errore durante la creazione di un controllo pratica per progetto " - + pratica.getNumeroProgetto() - + ": " - + e2.getMessage()); + + pratica.getNumeroProgetto() + ": " + e2.getMessage()); } } controllo.setStatus(WorkflowConstants.STATUS_APPROVED); - AvvisoLocalServiceUtil.addAvviso( - pratica.getIntPraticaId(), - "Attestazione di deposito progetto", - new Date(), AvvisoUtil.TIPO_AVVISO_DIRETTO, - StatoPraticaConstants.CONFORME, - fileEntryIdTemplate, - dettPratica.getDettPraticaId(), - DettPratica.class.getName(), - controllo.getControlloPraticaId(), + AvvisoLocalServiceUtil.addAvviso(pratica.getIntPraticaId(), + "Attestazione di deposito progetto", new Date(), + AvvisoUtil.TIPO_AVVISO_DIRETTO, StatoPraticaConstants.CONFORME, + fileEntryIdTemplate, dettPratica.getDettPraticaId(), + DettPratica.class.getName(), controllo.getControlloPraticaId(), serviceContext); pratica.setStatoPratica(StatoPraticaConstants.CONFORME); IntPraticaLocalServiceUtil.updateIntPratica(pratica); @@ -584,8 +661,7 @@ public class SismicaUtil { int start = 0; do { try { - pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, - start + SLICE); + pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, start + SLICE); } catch (SystemException e) { esito.add("Errore caricamento intPratiche: " + e.getMessage()); } @@ -593,85 +669,63 @@ public class SismicaUtil { List avvisi = null; for (IntPratica pratica : pratiche) { String stato = pratica.getStatoPratica(); - if (Validator.isNotNull(stato) - && Validator.isNotNull(pratica.getTipoProcedura()) - && pratica.getTipoPratica().equalsIgnoreCase( - Constants.TIPO_PRATICA_DEPOSITO)) { + if (Validator.isNotNull(stato) && Validator.isNotNull(pratica.getTipoProcedura()) + && pratica.getTipoPratica().equalsIgnoreCase(Constants.TIPO_PRATICA_DEPOSITO)) { try { - avvisi = AvvisoLocalServiceUtil - .findByIntPraticaId_tipoDocumento( - pratica.getIntPraticaId(), - StatoPraticaConstants.CONFORME); + avvisi = AvvisoLocalServiceUtil.findByIntPraticaId_tipoDocumento( + pratica.getIntPraticaId(), StatoPraticaConstants.CONFORME); } catch (SystemException e) { - esito.add("Errore caricamento avvisi: " - + e.getMessage()); + esito.add("Errore caricamento avvisi: " + e.getMessage()); } List totali = null; try { - totali = AvvisoLocalServiceUtil.findByIntPratica( - pratica.getIntPraticaId(), QueryUtil.ALL_POS, - QueryUtil.ALL_POS, null); + totali = AvvisoLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId(), + QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } catch (SystemException e) { totali = new ArrayList<>(); } - if ((avvisi.size() == 0) - && stato.equalsIgnoreCase(StatoPraticaConstants.VIDIMATA)) { + if ((avvisi.size() == 0) && stato.equalsIgnoreCase(StatoPraticaConstants.VIDIMATA)) { List controlli = null; try { - controlli = ControlloPraticaLocalServiceUtil - .findByIntPratica(pratica.getIntPraticaId()); + controlli = ControlloPraticaLocalServiceUtil.findByIntPratica(pratica + .getIntPraticaId()); } catch (SystemException e) { controlli = new ArrayList<>(); } - if (pratica.getStatoPratica().equals( - StatoPraticaConstants.VIDIMATA) + if (pratica.getStatoPratica().equals(StatoPraticaConstants.VIDIMATA) && (controlli.size() == 0)) { - esito.add("Progetto: " - + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() - + "), procedura=" - + pratica.getTipoProcedura() + ", avvisi=" - + totali.size() + ", stato=" - + pratica.getStatoPratica() - + ", controlli=" + controlli.size()); + esito.add("Progetto: " + pratica.getNumeroProgetto() + " (" + + pratica.getIntPraticaId() + "), procedura=" + + pratica.getTipoProcedura() + ", avvisi=" + totali.size() + ", stato=" + + pratica.getStatoPratica() + ", controlli=" + controlli.size()); DettPratica dettPratica; try { dettPratica = DettPraticaLocalServiceUtil - .getLastCompletedByIntPratica(pratica - .getIntPraticaId()); + .getLastCompletedByIntPratica(pratica.getIntPraticaId()); } catch (SystemException e) { dettPratica = null; } if (Validator.isNotNull(dettPratica)) { ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(dettPratica - .getCompanyId()); - serviceContext.setScopeGroupId(dettPratica - .getGroupId()); - serviceContext.setUserId(dettPratica - .getUserId()); + serviceContext.setCompanyId(dettPratica.getCompanyId()); + serviceContext.setScopeGroupId(dettPratica.getGroupId()); + serviceContext.setUserId(dettPratica.getUserId()); ControlloPratica controllo; try { - controllo = ControlloPraticaLocalServiceUtil - .addControlloPratica( - dettPratica.getGroupId(), - dettPratica.getUserId(), - pratica.getIntPraticaId(), - dettPratica - .getDettPraticaId(), - false, serviceContext); + controllo = ControlloPraticaLocalServiceUtil.addControlloPratica( + dettPratica.getGroupId(), dettPratica.getUserId(), + pratica.getIntPraticaId(), dettPratica.getDettPraticaId(), false, + serviceContext); } catch (PortalException | SystemException e) { controllo = null; } if (Validator.isNotNull(controllo)) { - controllo - .setStatus(WorkflowConstants.STATUS_APPROVED); + controllo.setStatus(WorkflowConstants.STATUS_APPROVED); try { - ControlloPraticaLocalServiceUtil - .updateControlloPratica(controllo); + ControlloPraticaLocalServiceUtil.updateControlloPratica(controllo); } catch (SystemException e) { } @@ -684,48 +738,32 @@ public class SismicaUtil { fileEntryIdTemplate = 0; } - if (Validator - .isNotNull(fileEntryIdTemplate)) { + if (Validator.isNotNull(fileEntryIdTemplate)) { try { - if (!pratica - .getTipoProcedura() - .equalsIgnoreCase( - Constants.PROCEDURA_C)) { - AvvisoLocalServiceUtil - .addAvviso( - pratica.getIntPraticaId(), - "Attestazione di deposito progetto", - new Date(), - AvvisoUtil.TIPO_AVVISO_DIRETTO, - StatoPraticaConstants.CONFORME, - fileEntryIdTemplate, - dettPratica - .getDettPraticaId(), - DettPratica.class - .getName(), - controllo - .getControlloPraticaId(), - serviceContext); + if (!pratica.getTipoProcedura().equalsIgnoreCase( + Constants.PROCEDURA_C)) { + AvvisoLocalServiceUtil.addAvviso(pratica.getIntPraticaId(), + "Attestazione di deposito progetto", new Date(), + AvvisoUtil.TIPO_AVVISO_DIRETTO, + StatoPraticaConstants.CONFORME, fileEntryIdTemplate, + dettPratica.getDettPraticaId(), + DettPratica.class.getName(), + controllo.getControlloPraticaId(), serviceContext); } pratica.setStatoPratica(StatoPraticaConstants.CONFORME); - IntPraticaLocalServiceUtil - .updateIntPratica(pratica); - } catch (PortalException - | SystemException e) { + IntPraticaLocalServiceUtil.updateIntPratica(pratica); + } catch (PortalException | SystemException e) { } } } } } - } else if ((totali.size() == 2) - && (avvisi.size() > 0) + } else if ((totali.size() == 2) && (avvisi.size() > 0) && stato.equalsIgnoreCase(StatoPraticaConstants.SOTTOPOSTA_A_PARERE)) { - esito.add("Rendo conforme: " - + pratica.getNumeroProgetto()); + esito.add("Rendo conforme: " + pratica.getNumeroProgetto()); pratica.setStatoPratica(StatoPraticaConstants.CONFORME); try { - IntPraticaLocalServiceUtil - .updateIntPratica(pratica); + IntPraticaLocalServiceUtil.updateIntPratica(pratica); } catch (SystemException e) { } } @@ -743,11 +781,10 @@ public class SismicaUtil { List tasks = null; do { try { - tasks = WorkflowTaskManagerUtil.getWorkflowTasks(companyId, - false, start, start + SLICE, null); + tasks = WorkflowTaskManagerUtil + .getWorkflowTasks(companyId, false, start, start + SLICE, null); } catch (WorkflowException e) { - esito.add("Errore durante il recupero dei task: " - + e.getMessage()); + esito.add("Errore durante il recupero dei task: " + e.getMessage()); tasks = new ArrayList<>(); } start += SLICE; @@ -758,27 +795,19 @@ public class SismicaUtil { return esito; } - private static List checkWorkflow(long companyId, - WorkflowTask workflowTask) { + private static List checkWorkflow(long companyId, WorkflowTask workflowTask) { List esito = new ArrayList<>(); try { - WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil - .getWorkflowInstance(companyId, - workflowTask.getWorkflowInstanceId()); - Map workflowContext = workflowInstance - .getWorkflowContext(); - String className = (String) workflowContext - .get(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME); + WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, + workflowTask.getWorkflowInstanceId()); + Map workflowContext = workflowInstance.getWorkflowContext(); + String className = (String) workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME); if (Validator.isNull(className)) { - esito.add("WorkflowInstance " - + workflowInstance.getWorkflowInstanceId() - + ", WorkflowTask " + workflowTask.getWorkflowTaskId() - + " non ha la classe"); - Map attributes = workflowTask - .getOptionalAttributes(); - String taskClass = (String) attributes - .get(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME); + esito.add("WorkflowInstance " + workflowInstance.getWorkflowInstanceId() + ", WorkflowTask " + + workflowTask.getWorkflowTaskId() + " non ha la classe"); + Map attributes = workflowTask.getOptionalAttributes(); + String taskClass = (String) attributes.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME); if (taskClass.equals(ControlloPratica.class.getName())) { long classPK = GetterUtil.getLong((String) attributes .get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK)); @@ -786,36 +815,29 @@ public class SismicaUtil { ControlloPratica controllo = ControlloPraticaLocalServiceUtil .getControlloPratica(classPK); try { - IntPratica pratica = IntPraticaLocalServiceUtil - .getIntPratica(controllo.getIntPraticaId()); - esito.add("La pratica numero " - + pratica.getNumeroProgetto() + IntPratica pratica = IntPraticaLocalServiceUtil.getIntPratica(controllo + .getIntPraticaId()); + esito.add("La pratica numero " + pratica.getNumeroProgetto() + " non è lavorabile"); try { - WorkflowInstanceManagerUtil - .updateWorkflowContext( - companyId, - workflowInstance - .getWorkflowInstanceId(), - attributes); + WorkflowInstanceManagerUtil.updateWorkflowContext(companyId, + workflowInstance.getWorkflowInstanceId(), attributes); esito.add("> Riparazione riuscita"); } catch (WorkflowException e) { esito.add("> Errore durante riparazione."); } } catch (PortalException | SystemException e) { - esito.add("Errore di caricamento IntPratica " - + controllo.getIntPraticaId() + " (" - + e.getMessage() + ")"); + esito.add("Errore di caricamento IntPratica " + controllo.getIntPraticaId() + + " (" + e.getMessage() + ")"); } } catch (PortalException | SystemException e) { - esito.add("Errore di caricamento ControlloPratica " - + classPK + " (" + e.getMessage() + ")"); + esito.add("Errore di caricamento ControlloPratica " + classPK + " (" + e.getMessage() + + ")"); } } } } catch (WorkflowException e) { - esito.add("WorkflowInstance non caricato: " - + workflowTask.getWorkflowInstanceId() + " (" + esito.add("WorkflowInstance non caricato: " + workflowTask.getWorkflowInstanceId() + " (" + e.getMessage() + ")"); } return esito; @@ -828,10 +850,8 @@ public class SismicaUtil { List tokens = new ArrayList<>(); try { for (KaleoTaskInstanceToken token : KaleoTaskInstanceTokenLocalServiceUtil - .getKaleoTaskInstanceTokens(QueryUtil.ALL_POS, - QueryUtil.ALL_POS)) { - if (token.getClassName().equals( - ControlloPratica.class.getName())) + .getKaleoTaskInstanceTokens(QueryUtil.ALL_POS, QueryUtil.ALL_POS)) { + if (token.getClassName().equals(ControlloPratica.class.getName())) tokens.add(token.getClassPK()); } } catch (SystemException e) { @@ -841,21 +861,19 @@ public class SismicaUtil { List pratiche = null; do { try { - pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, - start + SLICE); + pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, start + SLICE); } catch (SystemException e) { pratiche = new ArrayList<>(); } start += SLICE; for (IntPratica pratica : pratiche) { if (Validator.isNotNull(pratica.getNumeroProgetto()) - && pratica.getStatoPratica().equals( - StatoPraticaConstants.SOTTOPOSTA_A_PARERE) + && pratica.getStatoPratica().equals(StatoPraticaConstants.SOTTOPOSTA_A_PARERE) && (pratica.getStatus() == WorkflowConstants.STATUS_PENDING)) { List controlli = null; try { - controlli = ControlloPraticaLocalServiceUtil - .findByIntPratica(pratica.getIntPraticaId()); + controlli = ControlloPraticaLocalServiceUtil.findByIntPratica(pratica + .getIntPraticaId()); } catch (SystemException e) { controlli = new ArrayList<>(); } @@ -874,15 +892,12 @@ public class SismicaUtil { Map workflowContext = new HashMap(); - esito.add("id: " + pratica.getIntPraticaId() - + ", numero: " + pratica.getNumeroProgetto()); + esito.add("id: " + pratica.getIntPraticaId() + ", numero: " + + pratica.getNumeroProgetto()); try { - WorkflowHandlerRegistryUtil.startWorkflowInstance( - last.getCompanyId(), last.getGroupId(), - last.getUserId(), - ControlloPratica.class.getName(), - last.getPrimaryKey(), last, serviceContext, - workflowContext); + WorkflowHandlerRegistryUtil.startWorkflowInstance(last.getCompanyId(), + last.getGroupId(), last.getUserId(), ControlloPratica.class.getName(), + last.getPrimaryKey(), last, serviceContext, workflowContext); } catch (PortalException | SystemException e) { esito.add("Errore " + e.getMessage()); } @@ -894,75 +909,12 @@ public class SismicaUtil { return esito; } - public static List testInterno(ServiceContext serviceContext) - throws PortalException, SystemException { - List esito = new ArrayList<>(); - long intPraticaId = 124101; - String descLong = "Richiesta di integrazione"; - Date dtAvviso = new Date(); - String tipoAvviso = AvvisoUtil.TIPO_AVVISO_DIRETTO; - String tipoDocumento = StatoPraticaConstants.INTEGRAZIONE; - long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil - .findByC_ChiaveLong(serviceContext.getCompanyId(), - "conf.geniocivile.avviso.template.id.integrazione"); - long classPk = DettPraticaLocalServiceUtil - .getLastCompletedByIntPratica(intPraticaId).getPrimaryKey(); - String className = DettPratica.class.getName(); - String userCodiceFiscalePrimaFirma = StringPool.BLANK; - Map parameters = new HashMap<>(); - parameters - .put("testo_del_documento", - "Dall'esame del progetto per i lavori di riparazione o intervento locale (8.4.1 D.M. " - + "17/01/2018) dei danni causati dal sisma del 6 ottobre 2018 nella Chiesa Madre " - + "di Maria SS. Assunta,piazza Umberto n. 62,Comune di Adrano,è emerso che lo " - + "stesso è carente e pertanto necessita di integrazioni. Più precisamente,si è " - + "riscontrato che:\r\n1)\tManca la copia del documento di riconoscimento di " - + "tutti i soggetti interessati al progetto;\r\n2)\tManca la dichiarazione del " - + "Tecnico Progettista - Direttore dei Lavori (Legge 64/74 art. 17),scaricabile " - + "dal sito del Genio Civile – Catania;\r\n3)\tNella Tav. 2 “Rilievo – Piante – " - + "Localizzazione dei danni e delle criticità”: \r\nZONA D – Cartiglio " - + "nell’arco trionfale: non risulta verificato il permanere delle condizioni di " - + "stabilità del cartiglio in stucco e la solidità degli agganci con la " - + "muratura portante; \r\nZONA G – Aree esterna: non risulta verificata la " - + "stabilità di alcune porzioni del prospetto,in particolare di alcune sfere " - + "lapidee poste in cima a delle cuspidi,nonché degli elementi di laterizio " - + "costituenti la parte sommitale delle cornici della fabbrica incompleta del " - + "campanile di Sada;\r\n4)\t Nella Tav. A.1 “Relazione tecnica” non è definito " - + "il Livello di Conoscenza raggiunto (C.8.5.4 Circolare 21 gennaio 2019 n. 7); " - + "Per la modifica di aperture,accompagnata da opportuni rinforzi,deve " - + "dimostrarsi che l’insieme degli interventi non modifichino significativamente " - + "rigidezza,resistenza nei confronti delle azioni orizzontali e capacità di " - + "deformazione della struttura. Inoltre nel caso di rafforzamento locale " - + "finalizzato al miglioramento del funzionamento di elementi strutturali o alla " - + "limitazione di meccanismi di collasso,è richiesta la valutazione della " - + "variazione del livello locale di sicurezza (C8.4.1. Circolare 21 gennaio 2019 " - + "n. 7);\r\n5)\tNon esiste una Scheda Tecnica,con chiara identificazione " - + "prestazionale e di qualificazione (C11 Circolare 21 gennaio 2019 n. 7); della " - + "fibra in carbonio e dei materiali da utilizzare per i rinforzi;\r\n" - + "6)\tOccorre ritrasmettere,tramite il portale “PORTOS” tutti gli elaborati di " - + "progetto,avendo cura di apporre digitalmente,in ogni singolo allegato,la " - + "firma da parte dei tecnici interessati alla progettazione.\r\nIl Funzionario " - + "direttivo\t\t\t\t\t\tIl Dirigente Capo U.O.7\r\nArch. Pianif. Rosario Di " - + "Mauro\t\t\t\tArch. Giovanni Patti\r\nFirmata digitalmente\t\t\t\t\t\tFirmata " - + "digitalmente"); - JSONSerializer jsonSerializer = new JSONSerializer(); - String jsonParameters = jsonSerializer.serialize(parameters); - long controlloPraticaId = 0; - - AvvisoLocalServiceUtil.addAvviso(intPraticaId, descLong, dtAvviso, - tipoAvviso, tipoDocumento, fileEntryIdTemplate, classPk, - className, userCodiceFiscalePrimaFirma, jsonParameters, - controlloPraticaId, serviceContext); - return esito; - } - private static Map templateByKey; private static Map templateById; private static Map templateIdByKey; private static final Date inizio = stringToDate("2019-12-31"); - private static List riparaDocumenti(long companyId) - throws SystemException, PortalException { + private static List riparaDocumenti(long companyId) throws SystemException, PortalException { List esito = new ArrayList(); esito.add("Riparazione generazione documenti"); @@ -971,8 +923,7 @@ public class SismicaUtil { int index = 0; do { try { - intPratiche = IntPraticaLocalServiceUtil.getIntPraticas(index, - index + SLICE); + intPratiche = IntPraticaLocalServiceUtil.getIntPraticas(index, index + SLICE); } catch (SystemException e) { esito.add("Errore caricamento intPratiche: " + e.getMessage()); } @@ -984,19 +935,16 @@ public class SismicaUtil { return esito; } - private static void initTemplate(long companyId) throws SystemException, - PortalException { + private static void initTemplate(long companyId) throws SystemException, PortalException { templateById = new LinkedHashMap<>(); templateByKey = new LinkedHashMap<>(); templateIdByKey = new LinkedHashMap<>(); - Map elenco = AvvisoUtil - .getAllTipoDocumentoFileTemplateProps(); + Map elenco = AvvisoUtil.getAllTipoDocumentoFileTemplateProps(); for (Entry template : elenco.entrySet()) { - long fileEntryId = ConfigurazioneLocalServiceUtil - .findByC_ChiaveLong(companyId, template.getValue()); + long fileEntryId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, + template.getValue()); if (fileEntryId != 0) { - FileEntry fileEntry = DLAppServiceUtil - .getFileEntry(fileEntryId); + FileEntry fileEntry = DLAppServiceUtil.getFileEntry(fileEntryId); templateById.put(fileEntryId, fileEntry.getTitle()); templateByKey.put(template.getKey(), fileEntry.getTitle()); templateIdByKey.put(template.getKey(), fileEntryId); @@ -1007,14 +955,12 @@ public class SismicaUtil { private static List verificaAvvisi(IntPratica intPratica) { List esito = new ArrayList(); if (Validator.isNotNull(intPratica.getStatoPratica()) - && !intPratica.getStatoPratica().equalsIgnoreCase( - StatoPraticaConstants.ANNULLATA)) { + && !intPratica.getStatoPratica().equalsIgnoreCase(StatoPraticaConstants.ANNULLATA)) { long intPraticaId = intPratica.getIntPraticaId(); List controlli = null; try { - controlli = ControlloPraticaLocalServiceUtil - .findByIntPratica(intPraticaId); + controlli = ControlloPraticaLocalServiceUtil.findByIntPratica(intPraticaId); } catch (SystemException e) { controlli = new ArrayList(); } @@ -1031,9 +977,8 @@ public class SismicaUtil { serviceContext = new ServiceContext(); serviceContext.setCompanyId(intPratica.getCompanyId()); try { - serviceContext.setScopeGroupId(TerritorioLocalServiceUtil - .getTerritorio(intPratica.getTerritorioId()) - .getGroupId()); + serviceContext.setScopeGroupId(TerritorioLocalServiceUtil.getTerritorio( + intPratica.getTerritorioId()).getGroupId()); } catch (PortalException | SystemException e) { } serviceContext.setUserId(intPratica.getUserId()); @@ -1045,39 +990,29 @@ public class SismicaUtil { Date ultimaData = null; for (Avviso avviso : avvisi) { - if ((ultimaData == null) - || avviso.getModifiedDate().after(ultimaData)) + if ((ultimaData == null) || avviso.getModifiedDate().after(ultimaData)) ultimaData = avviso.getModifiedDate(); if (!avviso.getAnnullato()) { - String template = templateById.get(avviso - .getFileEntryIdTemplate()); - if (avviso.getDtAvviso().after(inizio) - && !avviso.getAnnullato() - && (avviso.getInviato() - .equalsIgnoreCase(AvvisoUtil.DOCUMENTO_NON_INVIATO))) { + String template = templateById.get(avviso.getFileEntryIdTemplate()); + if (avviso.getDtAvviso().after(inizio) && !avviso.getAnnullato() + && (avviso.getInviato().equalsIgnoreCase(AvvisoUtil.DOCUMENTO_NON_INVIATO))) { avvisiFermi.add(avviso); if (template == null) - template = templateByKey.get(avviso - .getTipoDocumento()); - } else if (avviso.getInviato().equalsIgnoreCase( - AvvisoUtil.DOCUMENTO_INVIATO)) { + template = templateByKey.get(avviso.getTipoDocumento()); + } else if (avviso.getInviato().equalsIgnoreCase(AvvisoUtil.DOCUMENTO_INVIATO)) { avvisiInviati.add(template); } } } - if ((ultimaData != null) - && (new Date().getTime() - ultimaData.getTime() > 7200000)) { + if ((ultimaData != null) && (new Date().getTime() - ultimaData.getTime() > 7200000)) { for (Avviso avviso : avvisiFermi) { long templateId = avviso.getFileEntryIdTemplate(); String template = templateById.get(templateId); - if (Validator.isNull(template) - && templateByKey.containsKey(avviso - .getTipoDocumento())) { + if (Validator.isNull(template) && templateByKey.containsKey(avviso.getTipoDocumento())) { template = templateByKey.get(avviso.getTipoDocumento()); - templateId = templateIdByKey.get(avviso - .getTipoDocumento()); + templateId = templateIdByKey.get(avviso.getTipoDocumento()); } if (!avvisiInviati.contains(template)) { switch (avviso.getTipoDocumento()) { @@ -1088,44 +1023,30 @@ public class SismicaUtil { case StatoPraticaConstants.AUTORIZZATA: case StatoPraticaConstants.CONFORME: case StatoPraticaConstants.VIDIMATA: - if (avviso.getTipoAvviso().equals( - AvvisoUtil.TIPO_AVVISO_DIRETTO)) { - esito.addAll(addStoricoAvvisi(intPratica, - avvisi)); - esito.add("Invio " + template + " (" - + controlli.size() + " controlli)"); + if (avviso.getTipoAvviso().equals(AvvisoUtil.TIPO_AVVISO_DIRETTO)) { + esito.addAll(addStoricoAvvisi(intPratica, avvisi)); + esito.add("Invio " + template + " (" + controlli.size() + " controlli)"); try { if (Validator.isNull(controllo)) { controllo = aggiungiControlloPratica(intPratica); - esito.add(intPratica - .getNumeroProgetto() + esito.add(intPratica.getNumeroProgetto() + " aggiunto ControlloPratica " - + controllo - .getControlloPraticaId()); + + controllo.getControlloPraticaId()); } - AvvisoLocalServiceUtil.addAvviso( - intPraticaId, "", - avviso.getDtAvviso(), - AvvisoUtil.TIPO_AVVISO_DIRETTO, - avviso.getTipoDocumento(), - templateId, - controllo.getDettPraticaId(), - DettPratica.class.getName(), - controllo.getControlloPraticaId(), + AvvisoLocalServiceUtil.addAvviso(intPraticaId, "", avviso.getDtAvviso(), + AvvisoUtil.TIPO_AVVISO_DIRETTO, avviso.getTipoDocumento(), + templateId, controllo.getDettPraticaId(), + DettPratica.class.getName(), controllo.getControlloPraticaId(), serviceContext); } catch (Exception e) { - esito.add("Errore durante l'invio: " - + e.getMessage()); + esito.add("Errore durante l'invio: " + e.getMessage()); } } break; default: - if (avviso.getTipoAvviso().equals( - AvvisoUtil.TIPO_AVVISO_DIRETTO)) { - esito.addAll(addStoricoAvvisi(intPratica, - avvisi)); - esito.add("Procederei all'invio di avviso " - + template); + if (avviso.getTipoAvviso().equals(AvvisoUtil.TIPO_AVVISO_DIRETTO)) { + esito.addAll(addStoricoAvvisi(intPratica, avvisi)); + esito.add("Procederei all'invio di avviso " + template); } break; } @@ -1136,30 +1057,31 @@ public class SismicaUtil { return esito; } - private static ControlloPratica aggiungiControlloPratica( - IntPratica intPratica) throws PortalException, SystemException { - DettPratica dettPratica = DettPraticaLocalServiceUtil - .getLastCompletedByIntPratica(intPratica.getIntPraticaId()); + private static ControlloPratica aggiungiControlloPratica(IntPratica intPratica) throws PortalException, + SystemException { + DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica + .getIntPraticaId()); ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(dettPratica.getCompanyId()); serviceContext.setScopeGroupId(dettPratica.getGroupId()); serviceContext.setUserId(dettPratica.getUserId()); - ControlloPratica controllo = ControlloPraticaLocalServiceUtil - .addControlloPratica(intPratica.getGroupId(), - intPratica.getUserId(), intPratica.getIntPraticaId(), - dettPratica.getDettPraticaId(), false, serviceContext); + ControlloPratica controllo = ControlloPraticaLocalServiceUtil.addControlloPratica( + intPratica.getGroupId(), intPratica.getUserId(), intPratica.getIntPraticaId(), + dettPratica.getDettPraticaId(), false, serviceContext); return controllo; } private static List getAvvisiPratica(long intPraticaId) { List avvisi = null; try { - avvisi = AvvisoLocalServiceUtil.findByIntPratica(intPraticaId, - QueryUtil.ALL_POS, QueryUtil.ALL_POS, - OrderByComparatorFactoryUtil.getOrderByComparatorFactory() - .create("portos_bo_Avviso", "dtAvviso", true)); + avvisi = AvvisoLocalServiceUtil.findByIntPratica( + intPraticaId, + QueryUtil.ALL_POS, + QueryUtil.ALL_POS, + OrderByComparatorFactoryUtil.getOrderByComparatorFactory().create("portos_bo_Avviso", + "dtAvviso", true)); } catch (SystemException e) { _log.error("Errore recupero avvisi" + e.getMessage()); avvisi = new ArrayList(); @@ -1167,142 +1089,112 @@ public class SismicaUtil { return avvisi; } - private static List addStoricoAvvisi(IntPratica intPratica, - List avvisi) { + private static List addStoricoAvvisi(IntPratica intPratica, List avvisi) { List esito = new ArrayList(); String tipoPratica = LanguageUtil.get(LocaleUtil.ITALIAN, "tipo-pratica-" + intPratica.getTipoPratica()); - esito.add("* intPraticaId=" + intPratica.getIntPraticaId() - + ", numeroProgetto=" + intPratica.getNumeroProgetto() - + ", procedura=" + intPratica.getTipoProcedura() + ", stato=" - + intPratica.getStatoPratica() + ", tipo=" + tipoPratica - + ", data=" + dfmt.format(intPratica.getCreateDate()) - + ", modificata=" + dfmt.format(intPratica.getModifiedDate())); + esito.add("* intPraticaId=" + intPratica.getIntPraticaId() + ", numeroProgetto=" + + intPratica.getNumeroProgetto() + ", procedura=" + intPratica.getTipoProcedura() + + ", stato=" + intPratica.getStatoPratica() + ", tipo=" + tipoPratica + ", data=" + + dfmt.format(intPratica.getCreateDate()) + ", modificata=" + + dfmt.format(intPratica.getModifiedDate())); for (Avviso avviso : avvisi) { String template = templateById.get(avviso.getFileEntryIdTemplate()); if (template == null) template = templateByKey.get(avviso.getTipoDocumento()); ; - boolean inviato = avviso.getInviato().equalsIgnoreCase( - AvvisoUtil.DOCUMENTO_INVIATO); - esito.add(dfmt.format(avviso.getDtAvviso()) - + " Avviso " - + template - + (inviato ? "inviato " + dfmt.format(avviso.getDtInvio()) - : "non inviato") + " - tipo avviso " - + avviso.getTipoAvviso() + " - tipo documento " + boolean inviato = avviso.getInviato().equalsIgnoreCase(AvvisoUtil.DOCUMENTO_INVIATO); + esito.add(dfmt.format(avviso.getDtAvviso()) + " Avviso " + template + + (inviato ? "inviato " + dfmt.format(avviso.getDtInvio()) : "non inviato") + + " - tipo avviso " + avviso.getTipoAvviso() + " - tipo documento " + avviso.getTipoDocumento()); } return esito; } - public static List resetFirme(long companyId, String numeroProgetto) - throws SystemException, PortalException { + public static List resetFirme(long companyId, String numeroProgetto) throws SystemException, + PortalException { List esito = new ArrayList<>(); if (Validator.isNull(numeroProgetto)) { esito.addAll(firmeBloccate(companyId)); } else { - IntPratica pratica = IntPraticaLocalServiceUtil - .findByNumeroProgetto(numeroProgetto); - ControlloPratica controllo = getLastControlloPratica(pratica - .getIntPraticaId()); - KaleoInstanceToken instanceToken = findInstanceToken(controllo - .getControlloPraticaId()); + IntPratica pratica = IntPraticaLocalServiceUtil.findByNumeroProgetto(numeroProgetto); + ControlloPratica controllo = getLastControlloPratica(pratica.getIntPraticaId()); + KaleoInstanceToken instanceToken = findInstanceToken(controllo.getControlloPraticaId()); if (Validator.isNotNull(instanceToken)) { - esito.add("Trovato KaleoInstanceToken " - + instanceToken.getKaleoInstanceTokenId() - + ", currentKaleoNodeName = \"" - + instanceToken.getCurrentKaleoNodeName() + "\""); - if (instanceToken.getCurrentKaleoNodeName().equalsIgnoreCase( - "signal_ff")) { + esito.add("Trovato KaleoInstanceToken " + instanceToken.getKaleoInstanceTokenId() + + ", currentKaleoNodeName = \"" + instanceToken.getCurrentKaleoNodeName() + "\""); + if (instanceToken.getCurrentKaleoNodeName().equalsIgnoreCase("signal_ff")) { List taskInstanceTokens = findTaskInstanceTokens(instanceToken .getKaleoInstanceTokenId()); - esito.add("Trovati " + taskInstanceTokens.size() - + " KaleoTaskInstanceToken"); + esito.add("Trovati " + taskInstanceTokens.size() + " KaleoTaskInstanceToken"); List taskAssignmentInstances = findTaskAssignmentInstances(instanceToken .getKaleoInstanceId()); - esito.add("Trovati " + taskAssignmentInstances.size() - + " KaleoTaskAssignmentInstance"); + esito.add("Trovati " + taskAssignmentInstances.size() + " KaleoTaskAssignmentInstance"); - KaleoTaskInstanceToken taskInstanceToken = taskInstanceTokens - .get(taskInstanceTokens.size() - 1); + KaleoTaskInstanceToken taskInstanceToken = taskInstanceTokens.get(taskInstanceTokens + .size() - 1); KaleoTaskAssignmentInstance taskAssignmentInstance = taskAssignmentInstances .get(taskAssignmentInstances.size() - 1); esito.add("Cancello KaleoTaskInstanceToken " + taskInstanceToken.getKaleoTaskInstanceTokenId()); - KaleoTaskInstanceTokenLocalServiceUtil - .deleteKaleoTaskInstanceToken(taskInstanceToken); + KaleoTaskInstanceTokenLocalServiceUtil.deleteKaleoTaskInstanceToken(taskInstanceToken); esito.add("Cancello KaleoTaskAssignmentInstance " - + taskAssignmentInstance - .getKaleoTaskAssignmentInstanceId()); + + taskAssignmentInstance.getKaleoTaskAssignmentInstanceId()); KaleoTaskAssignmentInstanceLocalServiceUtil .deleteKaleoTaskAssignmentInstance(taskAssignmentInstance); - taskInstanceToken = taskInstanceTokens - .get(taskInstanceTokens.size() - 2); + taskInstanceToken = taskInstanceTokens.get(taskInstanceTokens.size() - 2); esito.add("Aggiorno KaleoTaskInstanceToken " + taskInstanceToken.getKaleoTaskInstanceTokenId()); taskInstanceToken.setCompleted(false); taskInstanceToken.setCompletionUserId(0); taskInstanceToken.setCompletionDate(null); - KaleoTaskInstanceTokenLocalServiceUtil - .updateKaleoTaskInstanceToken(taskInstanceToken); + KaleoTaskInstanceTokenLocalServiceUtil.updateKaleoTaskInstanceToken(taskInstanceToken); - esito.add("Aggiorno KaleoInstanceToken " - + instanceToken.getKaleoInstanceTokenId()); + esito.add("Aggiorno KaleoInstanceToken " + instanceToken.getKaleoInstanceTokenId()); instanceToken.setCurrentKaleoNodeId(21639); instanceToken.setCurrentKaleoNodeName("Esito"); - KaleoInstanceTokenLocalServiceUtil - .updateKaleoInstanceToken(instanceToken); + KaleoInstanceTokenLocalServiceUtil.updateKaleoInstanceToken(instanceToken); } } } return esito; } - private static List firmeBloccate(long companyId) - throws SystemException, PortalException { + private static List firmeBloccate(long companyId) throws SystemException, PortalException { List esito = new ArrayList<>(); int start = 0; int totali = 0; List instanceTokens = null; do { - instanceTokens = KaleoInstanceTokenLocalServiceUtil - .getKaleoInstanceTokens(start, start + SLICE); + instanceTokens = KaleoInstanceTokenLocalServiceUtil.getKaleoInstanceTokens(start, start + SLICE); for (KaleoInstanceToken instanceToken : instanceTokens) { if (!instanceToken.getCompleted() - && instanceToken - .getCurrentKaleoNodeName() - .equalsIgnoreCase( - WorkflowConstants.WORKFLOW_SIGNAL_INVIO)) { - if (ControlloPratica.class.getName().equals( - instanceToken.getClassName())) { + && instanceToken.getCurrentKaleoNodeName().equalsIgnoreCase( + WorkflowConstants.WORKFLOW_SIGNAL_INVIO)) { + if (ControlloPratica.class.getName().equals(instanceToken.getClassName())) { ControlloPratica controllo = ControlloPraticaLocalServiceUtil .getControlloPratica(instanceToken.getClassPK()); boolean firmaInviata = false; - for (Avviso avviso : AvvisoLocalServiceUtil - .findByIntPratica(controllo.getIntPraticaId(), - QueryUtil.ALL_POS, QueryUtil.ALL_POS, - null)) { - if (avviso.getInviato().equalsIgnoreCase( - AvvisoUtil.DOCUMENTO_NON_INVIATO) - && avviso.getTipoAvviso().equalsIgnoreCase( - AvvisoUtil.TIPO_AVVISO_FIRMA) + for (Avviso avviso : AvvisoLocalServiceUtil.findByIntPratica( + controllo.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { + if (avviso.getInviato().equalsIgnoreCase(AvvisoUtil.DOCUMENTO_NON_INVIATO) + && avviso.getTipoAvviso().equalsIgnoreCase(AvvisoUtil.TIPO_AVVISO_FIRMA) && !avviso.getRifiutato()) { firmaInviata = true; } } - IntPratica pratica = IntPraticaLocalServiceUtil - .getIntPratica(controllo.getIntPraticaId()); + IntPratica pratica = IntPraticaLocalServiceUtil.getIntPratica(controllo + .getIntPraticaId()); if (!firmaInviata) { - esito.add(" fermo " + pratica.getNumeroProgetto() - + " (" + pratica.getIntPraticaId() + ")"); + esito.add(" fermo " + pratica.getNumeroProgetto() + " (" + + pratica.getIntPraticaId() + ")"); } } else { - esito.add("Classe non gestita " - + instanceToken.getClassName() + ", id " + esito.add("Classe non gestita " + instanceToken.getClassName() + ", id " + instanceToken.getKaleoInstanceTokenId()); } } @@ -1316,43 +1208,36 @@ public class SismicaUtil { return esito; } - private static KaleoInstanceToken findInstanceToken(long controlloPraticaId) - throws SystemException { - for (KaleoInstanceToken instanceToken : KaleoInstanceTokenLocalServiceUtil - .getKaleoInstanceTokens(QueryUtil.ALL_POS, QueryUtil.ALL_POS)) { + private static KaleoInstanceToken findInstanceToken(long controlloPraticaId) throws SystemException { + for (KaleoInstanceToken instanceToken : KaleoInstanceTokenLocalServiceUtil.getKaleoInstanceTokens( + QueryUtil.ALL_POS, QueryUtil.ALL_POS)) { if ((instanceToken.getClassPK() == controlloPraticaId) - && instanceToken.getClassName().equals( - ControlloPratica.class.getName())) { + && instanceToken.getClassName().equals(ControlloPratica.class.getName())) { return instanceToken; } } return null; } - private static List findTaskInstanceTokens( - long instanceTokenId) throws SystemException { + private static List findTaskInstanceTokens(long instanceTokenId) + throws SystemException { Map sorted = new TreeMap<>(); for (KaleoTaskInstanceToken taskInstanceToken : KaleoTaskInstanceTokenLocalServiceUtil - .getKaleoTaskInstanceTokens(QueryUtil.ALL_POS, - QueryUtil.ALL_POS)) { + .getKaleoTaskInstanceTokens(QueryUtil.ALL_POS, QueryUtil.ALL_POS)) { if (taskInstanceToken.getKaleoInstanceTokenId() == instanceTokenId) { - sorted.put(taskInstanceToken.getKaleoTaskInstanceTokenId(), - taskInstanceToken); + sorted.put(taskInstanceToken.getKaleoTaskInstanceTokenId(), taskInstanceToken); } } return new ArrayList<>(sorted.values()); } - private static List findTaskAssignmentInstances( - long instanceId) throws SystemException { + private static List findTaskAssignmentInstances(long instanceId) + throws SystemException { Map sorted = new TreeMap<>(); for (KaleoTaskAssignmentInstance taskAssignmentInstance : KaleoTaskAssignmentInstanceLocalServiceUtil - .getKaleoTaskAssignmentInstances(QueryUtil.ALL_POS, - QueryUtil.ALL_POS)) { + .getKaleoTaskAssignmentInstances(QueryUtil.ALL_POS, QueryUtil.ALL_POS)) { if (taskAssignmentInstance.getKaleoInstanceId() == instanceId) { - sorted.put(taskAssignmentInstance - .getKaleoTaskAssignmentInstanceId(), - taskAssignmentInstance); + sorted.put(taskAssignmentInstance.getKaleoTaskAssignmentInstanceId(), taskAssignmentInstance); } } return new ArrayList<>(sorted.values()); @@ -1363,16 +1248,14 @@ public class SismicaUtil { private static ResourceAction raFileEntry; private static ResourceAction raFolder; - public static List generaDocumenti(long companyId) - throws PortalException, SystemException { + public static List generaDocumenti(long companyId) throws PortalException, SystemException { List esito = new ArrayList<>(); orgPc = new HashMap<>(); - for (Organization org : OrganizationLocalServiceUtil.getOrganizations( - QueryUtil.ALL_POS, QueryUtil.ALL_POS)) { + for (Organization org : OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, + QueryUtil.ALL_POS)) { if (0 == org.getSuborganizationsSize()) { - List users = UserLocalServiceUtil - .getOrganizationUsers(org.getOrganizationId()); + List users = UserLocalServiceUtil.getOrganizationUsers(org.getOrganizationId()); User user = users.get(users.size() * 2 / 3); PermissionChecker pc = null; try { @@ -1384,12 +1267,11 @@ public class SismicaUtil { } } - userRoleId = RoleLocalServiceUtil - .getRole(companyId, RoleConstants.USER).getRoleId(); - raFileEntry = ResourceActionLocalServiceUtil.getResourceAction( - DLFileEntry.class.getName(), ActionKeys.VIEW); - raFolder = ResourceActionLocalServiceUtil.getResourceAction( - DLFolder.class.getName(), ActionKeys.VIEW); + userRoleId = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER).getRoleId(); + raFileEntry = ResourceActionLocalServiceUtil.getResourceAction(DLFileEntry.class.getName(), + ActionKeys.VIEW); + raFolder = ResourceActionLocalServiceUtil + .getResourceAction(DLFolder.class.getName(), ActionKeys.VIEW); esito.addAll(riparaPermessiAllegatiManuali(companyId)); esito.addAll(riparaPermessiAsseverazioni(companyId)); @@ -1401,8 +1283,8 @@ public class SismicaUtil { return esito; } - public static List riparaPermessiAllegatiManuali(long companyId) - throws SystemException, PortalException { + public static List riparaPermessiAllegatiManuali(long companyId) throws SystemException, + PortalException { List esito = new ArrayList<>(); int inizio = 0; @@ -1411,37 +1293,28 @@ public class SismicaUtil { List documenti = null; String tipoDocumento = null; do { - documenti = AllegatoManualeLocalServiceUtil.getAllegatoManuales( - inizio, inizio + SLICE); + documenti = AllegatoManualeLocalServiceUtil.getAllegatoManuales(inizio, inizio + SLICE); for (AllegatoManuale documento : documenti) { if (Validator.isNull(tipoDocumento)) { tipoDocumento = documento.getClass().getSimpleName(); } IntPratica pratica = null; try { - pratica = IntPraticaLocalServiceUtil - .getIntPratica(documento.getIntPraticaId()); + pratica = IntPraticaLocalServiceUtil.getIntPratica(documento.getIntPraticaId()); } catch (PortalException e) { } - if (Validator.isNotNull(pratica) - && (documento.getFileEntryId() != 0)) { - Territorio territorio = TerritorioLocalServiceUtil - .getTerritorio(pratica.getTerritorioId()); + if (Validator.isNotNull(pratica) && (documento.getFileEntryId() != 0)) { + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica + .getTerritorioId()); FileEntry fileEntry = null; try { - fileEntry = DLAppServiceUtil.getFileEntry(documento - .getFileEntryId()); + fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryId()); } catch (Exception e) { // _log.info(e.getClass() + ": " + e.getMessage()); } - corretti += riparaPermessiFileEntry( - companyId, - territorio.getGroupId(), - fileEntry, - "Pratica " + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() + "), " - + tipoDocumento + " " - + documento.getPrimaryKey()); + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, + "Pratica " + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + + "), " + tipoDocumento + " " + documento.getPrimaryKey()); } } inizio += SLICE; @@ -1454,8 +1327,8 @@ public class SismicaUtil { return esito; } - public static List riparaPermessiAsseverazioni(long companyId) - throws SystemException, PortalException { + public static List riparaPermessiAsseverazioni(long companyId) throws SystemException, + PortalException { List esito = new ArrayList<>(); int inizio = 0; @@ -1464,37 +1337,28 @@ public class SismicaUtil { List documenti = null; String tipoDocumento = null; do { - documenti = AsseverazioneLocalServiceUtil.getAsseveraziones(inizio, - inizio + SLICE); + documenti = AsseverazioneLocalServiceUtil.getAsseveraziones(inizio, inizio + SLICE); for (Asseverazione documento : documenti) { if (Validator.isNull(tipoDocumento)) { tipoDocumento = documento.getClass().getSimpleName(); } IntPratica pratica = null; try { - pratica = IntPraticaLocalServiceUtil - .getIntPratica(documento.getIntPraticaId()); + pratica = IntPraticaLocalServiceUtil.getIntPratica(documento.getIntPraticaId()); } catch (PortalException e) { } - if (Validator.isNotNull(pratica) - && (documento.getFileEntryId() != 0)) { - Territorio territorio = TerritorioLocalServiceUtil - .getTerritorio(pratica.getTerritorioId()); + if (Validator.isNotNull(pratica) && (documento.getFileEntryId() != 0)) { + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica + .getTerritorioId()); FileEntry fileEntry = null; try { - fileEntry = DLAppServiceUtil.getFileEntry(documento - .getFileEntryId()); + fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryId()); } catch (Exception e) { // _log.info(e.getClass() + ": " + e.getMessage()); } - corretti += riparaPermessiFileEntry( - companyId, - territorio.getGroupId(), - fileEntry, - "Pratica " + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() + "), " - + tipoDocumento + " " - + documento.getPrimaryKey()); + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, + "Pratica " + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + + "), " + tipoDocumento + " " + documento.getPrimaryKey()); } } inizio += SLICE; @@ -1507,8 +1371,7 @@ public class SismicaUtil { return esito; } - public static List riparaPermessiAvvisi(long companyId) - throws SystemException, PortalException { + public static List riparaPermessiAvvisi(long companyId) throws SystemException, PortalException { List esito = new ArrayList<>(); int inizio = 0; @@ -1517,78 +1380,55 @@ public class SismicaUtil { List documenti = null; String tipoDocumento = null; do { - documenti = AvvisoLocalServiceUtil.getAvvisos(inizio, inizio - + SLICE); + documenti = AvvisoLocalServiceUtil.getAvvisos(inizio, inizio + SLICE); for (Avviso documento : documenti) { if (Validator.isNull(tipoDocumento)) { tipoDocumento = documento.getClass().getSimpleName(); } IntPratica pratica = null; try { - pratica = IntPraticaLocalServiceUtil - .getIntPratica(documento.getIntPraticaId()); + pratica = IntPraticaLocalServiceUtil.getIntPratica(documento.getIntPraticaId()); } catch (PortalException e) { } - if (Validator.isNotNull(pratica) - && (documento.getFileEntryIdBase() != 0)) { - Territorio territorio = TerritorioLocalServiceUtil - .getTerritorio(pratica.getTerritorioId()); + if (Validator.isNotNull(pratica) && (documento.getFileEntryIdBase() != 0)) { + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica + .getTerritorioId()); FileEntry fileEntry = null; try { - fileEntry = DLAppServiceUtil.getFileEntry(documento - .getFileEntryIdBase()); + fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryIdBase()); } catch (Exception e) { // _log.info(e.getClass() + ": " + e.getMessage()); } - corretti += riparaPermessiFileEntry( - companyId, - territorio.getGroupId(), - fileEntry, - "Pratica " + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() + "), " - + tipoDocumento + " " - + documento.getPrimaryKey()); + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, + "Pratica " + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + + "), " + tipoDocumento + " " + documento.getPrimaryKey()); } - if (Validator.isNotNull(pratica) - && (documento.getFileEntryIdInvio() != 0)) { - Territorio territorio = TerritorioLocalServiceUtil - .getTerritorio(pratica.getTerritorioId()); + if (Validator.isNotNull(pratica) && (documento.getFileEntryIdInvio() != 0)) { + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica + .getTerritorioId()); FileEntry fileEntry = null; try { - fileEntry = DLAppServiceUtil.getFileEntry(documento - .getFileEntryIdInvio()); + fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryIdInvio()); } catch (Exception e) { // _log.info(e.getClass() + ": " + e.getMessage()); } - corretti += riparaPermessiFileEntry( - companyId, - territorio.getGroupId(), - fileEntry, - "Pratica " + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() + "), " - + tipoDocumento + " " - + documento.getPrimaryKey()); + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, + "Pratica " + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + + "), " + tipoDocumento + " " + documento.getPrimaryKey()); } - if (Validator.isNotNull(pratica) - && (documento.getFileEntryIdProtocollo() != 0)) { - Territorio territorio = TerritorioLocalServiceUtil - .getTerritorio(pratica.getTerritorioId()); + if (Validator.isNotNull(pratica) && (documento.getFileEntryIdProtocollo() != 0)) { + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica + .getTerritorioId()); FileEntry fileEntry = null; try { - fileEntry = DLAppServiceUtil.getFileEntry(documento - .getFileEntryIdProtocollo()); + fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryIdProtocollo()); } catch (Exception e) { // _log.info(e.getClass() + ": " + e.getMessage()); } - corretti += riparaPermessiFileEntry( - companyId, - territorio.getGroupId(), - fileEntry, - "Pratica " + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() + "), " - + tipoDocumento + " " - + documento.getPrimaryKey()); + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, + "Pratica " + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + + "), " + tipoDocumento + " " + documento.getPrimaryKey()); } } inizio += SLICE; @@ -1601,8 +1441,8 @@ public class SismicaUtil { return esito; } - public static List riparaPermessiDocAggiuntive(long companyId) - throws SystemException, PortalException { + public static List riparaPermessiDocAggiuntive(long companyId) throws SystemException, + PortalException { List esito = new ArrayList<>(); int inizio = 0; @@ -1611,37 +1451,28 @@ public class SismicaUtil { List documenti = null; String tipoDocumento = null; do { - documenti = DocAggiuntivaLocalServiceUtil.getDocAggiuntivas(inizio, - inizio + SLICE); + documenti = DocAggiuntivaLocalServiceUtil.getDocAggiuntivas(inizio, inizio + SLICE); for (DocAggiuntiva documento : documenti) { if (Validator.isNull(tipoDocumento)) { tipoDocumento = documento.getClass().getSimpleName(); } IntPratica pratica = null; try { - pratica = IntPraticaLocalServiceUtil - .getIntPratica(documento.getIntPraticaId()); + pratica = IntPraticaLocalServiceUtil.getIntPratica(documento.getIntPraticaId()); } catch (PortalException e) { } - if (Validator.isNotNull(pratica) - && (documento.getFileEntryId() != 0)) { - Territorio territorio = TerritorioLocalServiceUtil - .getTerritorio(pratica.getTerritorioId()); + if (Validator.isNotNull(pratica) && (documento.getFileEntryId() != 0)) { + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica + .getTerritorioId()); FileEntry fileEntry = null; try { - fileEntry = DLAppServiceUtil.getFileEntry(documento - .getFileEntryId()); + fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryId()); } catch (Exception e) { // _log.info(e.getClass() + ": " + e.getMessage()); } - corretti += riparaPermessiFileEntry( - companyId, - territorio.getGroupId(), - fileEntry, - "Pratica " + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() + "), " - + tipoDocumento + " " - + documento.getPrimaryKey()); + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, + "Pratica " + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + + "), " + tipoDocumento + " " + documento.getPrimaryKey()); } } inizio += SLICE; @@ -1654,8 +1485,8 @@ public class SismicaUtil { return esito; } - public static List riparaPermessiDocPratica(long companyId) - throws SystemException, PortalException { + public static List riparaPermessiDocPratica(long companyId) throws SystemException, + PortalException { List esito = new ArrayList<>(); int inizio = 0; @@ -1664,37 +1495,28 @@ public class SismicaUtil { List documenti = null; String tipoDocumento = null; do { - documenti = DocPraticaLocalServiceUtil.getDocPraticas(inizio, - inizio + SLICE); + documenti = DocPraticaLocalServiceUtil.getDocPraticas(inizio, inizio + SLICE); for (DocPratica documento : documenti) { if (Validator.isNull(tipoDocumento)) { tipoDocumento = documento.getClass().getSimpleName(); } IntPratica pratica = null; try { - pratica = IntPraticaLocalServiceUtil - .getIntPratica(documento.getIntPraticaId()); + pratica = IntPraticaLocalServiceUtil.getIntPratica(documento.getIntPraticaId()); } catch (PortalException e) { } - if (Validator.isNotNull(pratica) - && (documento.getDlFileEntryId() != 0)) { - Territorio territorio = TerritorioLocalServiceUtil - .getTerritorio(pratica.getTerritorioId()); + if (Validator.isNotNull(pratica) && (documento.getDlFileEntryId() != 0)) { + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica + .getTerritorioId()); FileEntry fileEntry = null; try { - fileEntry = DLAppServiceUtil.getFileEntry(documento - .getDlFileEntryId()); + fileEntry = DLAppServiceUtil.getFileEntry(documento.getDlFileEntryId()); } catch (Exception e) { // _log.info(e.getClass() + ": " + e.getMessage()); } - corretti += riparaPermessiFileEntry( - companyId, - territorio.getGroupId(), - fileEntry, - "Pratica " + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() + "), " - + tipoDocumento + " " - + documento.getPrimaryKey()); + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, + "Pratica " + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + + "), " + tipoDocumento + " " + documento.getPrimaryKey()); } } inizio += SLICE; @@ -1707,8 +1529,8 @@ public class SismicaUtil { return esito; } - public static List riparaPermessiPagamenti(long companyId) - throws SystemException, PortalException { + public static List riparaPermessiPagamenti(long companyId) throws SystemException, + PortalException { List esito = new ArrayList<>(); int inizio = 0; @@ -1717,37 +1539,28 @@ public class SismicaUtil { List documenti = null; String tipoDocumento = null; do { - documenti = PagamentoLocalServiceUtil.getPagamentos(inizio, inizio - + SLICE); + documenti = PagamentoLocalServiceUtil.getPagamentos(inizio, inizio + SLICE); for (Pagamento documento : documenti) { if (Validator.isNull(tipoDocumento)) { tipoDocumento = documento.getClass().getSimpleName(); } IntPratica pratica = null; try { - pratica = IntPraticaLocalServiceUtil - .getIntPratica(documento.getIntPraticaId()); + pratica = IntPraticaLocalServiceUtil.getIntPratica(documento.getIntPraticaId()); } catch (PortalException e) { } - if (Validator.isNotNull(pratica) - && (documento.getFileEntryId() != 0)) { - Territorio territorio = TerritorioLocalServiceUtil - .getTerritorio(pratica.getTerritorioId()); + if (Validator.isNotNull(pratica) && (documento.getFileEntryId() != 0)) { + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica + .getTerritorioId()); FileEntry fileEntry = null; try { - fileEntry = DLAppServiceUtil.getFileEntry(documento - .getFileEntryId()); + fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryId()); } catch (Exception e) { // _log.info(e.getClass() + ": " + e.getMessage()); } - corretti += riparaPermessiFileEntry( - companyId, - territorio.getGroupId(), - fileEntry, - "Pratica " + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() + "), " - + tipoDocumento + " " - + documento.getPrimaryKey()); + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, + "Pratica " + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + + "), " + tipoDocumento + " " + documento.getPrimaryKey()); } } inizio += SLICE; @@ -1760,8 +1573,8 @@ public class SismicaUtil { return esito; } - public static List riparaPermessiPareriGeologi(long companyId) - throws SystemException, PortalException { + public static List riparaPermessiPareriGeologi(long companyId) throws SystemException, + PortalException { List esito = new ArrayList<>(); int inizio = 0; @@ -1770,37 +1583,28 @@ public class SismicaUtil { List documenti = null; String tipoDocumento = null; do { - documenti = ParereGeologoLocalServiceUtil.getParereGeologos(inizio, - inizio + SLICE); + documenti = ParereGeologoLocalServiceUtil.getParereGeologos(inizio, inizio + SLICE); for (ParereGeologo documento : documenti) { if (Validator.isNull(tipoDocumento)) { tipoDocumento = documento.getClass().getSimpleName(); } IntPratica pratica = null; try { - pratica = IntPraticaLocalServiceUtil - .getIntPratica(documento.getIntPraticaId()); + pratica = IntPraticaLocalServiceUtil.getIntPratica(documento.getIntPraticaId()); } catch (PortalException e) { } - if (Validator.isNotNull(pratica) - && (documento.getFileEntryId() != 0)) { - Territorio territorio = TerritorioLocalServiceUtil - .getTerritorio(pratica.getTerritorioId()); + if (Validator.isNotNull(pratica) && (documento.getFileEntryId() != 0)) { + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica + .getTerritorioId()); FileEntry fileEntry = null; try { - fileEntry = DLAppServiceUtil.getFileEntry(documento - .getFileEntryId()); + fileEntry = DLAppServiceUtil.getFileEntry(documento.getFileEntryId()); } catch (Exception e) { // _log.info(e.getClass() + ": " + e.getMessage()); } - corretti += riparaPermessiFileEntry( - companyId, - territorio.getGroupId(), - fileEntry, - "Pratica " + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() + "), " - + tipoDocumento + " " - + documento.getPrimaryKey()); + corretti += riparaPermessiFileEntry(companyId, territorio.getGroupId(), fileEntry, + "Pratica " + pratica.getNumeroProgetto() + " (" + pratica.getIntPraticaId() + + "), " + tipoDocumento + " " + documento.getPrimaryKey()); } } inizio += SLICE; @@ -1813,9 +1617,8 @@ public class SismicaUtil { return esito; } - private static int riparaPermessiFileEntry(long companyId, long groupId, - FileEntry fileEntry, String datiDocumento) throws PortalException, - SystemException { + private static int riparaPermessiFileEntry(long companyId, long groupId, FileEntry fileEntry, + String datiDocumento) throws PortalException, SystemException { int corretti = 0; if (Validator.isNotNull(fileEntry)) { PermissionChecker pc = orgPc.get(groupId); @@ -1823,65 +1626,44 @@ public class SismicaUtil { // _log.info(datiDocumento + " non ha i permessi"); ResourcePermission resourcePermission = null; try { - resourcePermission = ResourcePermissionLocalServiceUtil - .getResourcePermission(companyId, - DLFileEntry.class.getName(), - ResourceConstants.SCOPE_INDIVIDUAL, - String.valueOf(fileEntry.getPrimaryKey()), - userRoleId); + resourcePermission = ResourcePermissionLocalServiceUtil.getResourcePermission(companyId, + DLFileEntry.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, + String.valueOf(fileEntry.getPrimaryKey()), userRoleId); } catch (NoSuchResourcePermissionException e) { resourcePermission = ResourcePermissionLocalServiceUtil - .createResourcePermission(CounterLocalServiceUtil - .increment()); + .createResourcePermission(CounterLocalServiceUtil.increment()); resourcePermission.setCompanyId(companyId); resourcePermission.setName(DLFileEntry.class.getName()); - resourcePermission - .setScope(ResourceConstants.SCOPE_INDIVIDUAL); - resourcePermission.setPrimKey(String.valueOf(fileEntry - .getPrimaryKey())); + resourcePermission.setScope(ResourceConstants.SCOPE_INDIVIDUAL); + resourcePermission.setPrimKey(String.valueOf(fileEntry.getPrimaryKey())); resourcePermission.setRoleId(userRoleId); - resourcePermission.setActionIds(raFileEntry - .getBitwiseValue()); - ResourcePermissionLocalServiceUtil - .addResourcePermission(resourcePermission); + resourcePermission.setActionIds(raFileEntry.getBitwiseValue()); + ResourcePermissionLocalServiceUtil.addResourcePermission(resourcePermission); } resourcePermission.setActionIds(raFileEntry.getBitwiseValue()); - ResourcePermissionLocalServiceUtil - .updateResourcePermission(resourcePermission); + ResourcePermissionLocalServiceUtil.updateResourcePermission(resourcePermission); Folder folder = fileEntry.getFolder(); while (Validator.isNotNull(folder)) { if (!folder.containsPermission(pc, ActionKeys.VIEW)) { // _log.info("folder " + folder.getName() + // " non ha i permessi"); try { - resourcePermission = ResourcePermissionLocalServiceUtil - .getResourcePermission(companyId, - DLFolder.class.getName(), - ResourceConstants.SCOPE_INDIVIDUAL, - String.valueOf(folder - .getPrimaryKey()), - userRoleId); + resourcePermission = ResourcePermissionLocalServiceUtil.getResourcePermission( + companyId, DLFolder.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, + String.valueOf(folder.getPrimaryKey()), userRoleId); } catch (NoSuchResourcePermissionException e) { resourcePermission = ResourcePermissionLocalServiceUtil - .createResourcePermission(CounterLocalServiceUtil - .increment()); + .createResourcePermission(CounterLocalServiceUtil.increment()); resourcePermission.setCompanyId(companyId); - resourcePermission - .setName(DLFolder.class.getName()); - resourcePermission - .setScope(ResourceConstants.SCOPE_INDIVIDUAL); - resourcePermission.setPrimKey(String.valueOf(folder - .getPrimaryKey())); + resourcePermission.setName(DLFolder.class.getName()); + resourcePermission.setScope(ResourceConstants.SCOPE_INDIVIDUAL); + resourcePermission.setPrimKey(String.valueOf(folder.getPrimaryKey())); resourcePermission.setRoleId(userRoleId); - resourcePermission.setActionIds(raFolder - .getBitwiseValue()); - ResourcePermissionLocalServiceUtil - .addResourcePermission(resourcePermission); + resourcePermission.setActionIds(raFolder.getBitwiseValue()); + ResourcePermissionLocalServiceUtil.addResourcePermission(resourcePermission); } - resourcePermission.setActionIds(raFolder - .getBitwiseValue()); - ResourcePermissionLocalServiceUtil - .updateResourcePermission(resourcePermission); + resourcePermission.setActionIds(raFolder.getBitwiseValue()); + ResourcePermissionLocalServiceUtil.updateResourcePermission(resourcePermission); } folder = folder.getParentFolder(); } @@ -1908,8 +1690,7 @@ public class SismicaUtil { return result; } - private static ServiceContext getServiceContextbyIntPratica( - IntPratica intPratica) { + private static ServiceContext getServiceContextbyIntPratica(IntPratica intPratica) { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(intPratica.getCompanyId()); serviceContext.setScopeGroupId(intPratica.getGroupId()); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/SismicaAdministrationPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/SismicaAdministrationPortlet.java index 1f06cfcf..46f39ea6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/SismicaAdministrationPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/SismicaAdministrationPortlet.java @@ -3,7 +3,7 @@ package it.tref.liferay.portos.bo.portlet; import it.mwg.sismica.bo.util.AllegatiUtil; import it.mwg.sismica.bo.util.SismicaUtil; import it.mwg.sismica.bo.util.SorteggioPraticaUtil; -import it.mwg.sismica.bo.util.SvuotaDatabase; +import it.mwg.sismica.bo.util.ManutenzioneDatabase; import it.tref.liferay.portos.bo.service.ConfigurazioneServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; @@ -116,11 +116,11 @@ public class SismicaAdministrationPortlet extends MVCPortlet { actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); } - public void testInterno(ActionRequest actionRequest, ActionResponse actionResponse) + public void manutenzioneDatabase(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, SystemException { String mode = ParamUtil.getString(actionRequest, "mode"); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); - List esito = SvuotaDatabase.pulisci(serviceContext, mode); + List esito = ManutenzioneDatabase.pulisci(serviceContext, mode); actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerInvioDocumento.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerInvioDocumento.java index 5cee6adc..cedad8d6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerInvioDocumento.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerInvioDocumento.java @@ -40,8 +40,10 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -371,16 +373,16 @@ public class SchedulerInvioDocumento implements MessageListener { dettPratica.getCodiceFiscalePrincipaleCommittente(), TipoSoggettoUtil.COMMITTENTE); if (null == committentePrincipale) { - _log.error("inviaMailNotifica: il committente principale non esiste, intPraticaId = " - + intPraticaId); + _log.error("Il committente principale non esiste, intPraticaId = " + intPraticaId); } else { soggetti.remove(committentePrincipale); } - String[] to = new String[soggetti.size()]; - for (int i = 0; i < to.length; i++) { - to[i] = soggetti.get(i).getEmail(); + Set sTo = new HashSet<>(); + for (Soggetto soggetto : soggetti) { + sTo.add(soggetto.getEmail()); } + String[] to = sTo.toArray(new String[sTo.size()]); String[] cc = new String[0]; String[] ccn = new String[0]; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java index ddc5101e..23954c94 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java @@ -206,7 +206,7 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase } boolean agAlto = (dettPratica.getTcAdeguamentoSismico() || dettPratica.getTcMiglioramentoSismico()) - && (territorio.getZona().equals("1") || (territorio.getZona().equals("2") && (ag >= 0.2) && (ag <= 0.25))); + && (territorio.getZona().equals("1") || (territorio.getZona().equals("2") && (ag >= 0.2))); boolean complesse = dettPratica.getTcNuovaCostruzioneComplessa(); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java index fa00d6df..dcd14437 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java @@ -242,7 +242,7 @@ public class IntPraticaLocalServiceImpl extends IntPraticaLocalServiceBaseImpl { } return ret; } - + public IntPratica addIntPratica(long territorioId, String tipoProcedura, ServiceContext serviceContext) throws SystemException, PortalException { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/advanced_search.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/advanced_search.jsp index ec8e7716..d29a4cb5 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/advanced_search.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/advanced_search.jsp @@ -45,11 +45,6 @@
Stato Pratica - -<%-- --%> -<%-- --%> -<%-- --%> - diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/view.jsp index 689971a5..10ab0c34 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/view.jsp @@ -219,7 +219,7 @@ String dtSorteggioNullo = "2020-03-05 11:12:18.006"; Le pratiche sottoposte a parere sono quelle che hanno statoPratica == 'SP', non quelle in status di workflow = pending --> - "> + SP diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp index 342a8313..697a0dce 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp @@ -96,12 +96,12 @@ String dataProssimoSorteggio =
- +
Manutenzione database
- +
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 9e64b9e2..1d83004a 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,5 +2,6 @@ + diff --git a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/lib/firma-application-shared-0.0.1.jar b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/lib/firma-application-shared-0.0.1.jar deleted file mode 100644 index dfbfe2cfd21b4b9921a0a898472ed4d91aee9934..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5440 zcmbtY2{_c-`^VUgUDjmZ#u81Ytl4XfLAEI&)1W4diLr!8F?Nm07AYc2!o5St7R}8* zwzMHjvLsu$itryvy2-uI^ZOsqck#^o`JD58&wJj@90s6errH?ewm9Q&FW+xWlqcNK zN>>qTYP8?{yBH(Y7)1;z)Ns(9^7B>7#q+ZmT-Ow8WN2xn1UH(8x3-wT6qPzzVTvGf zYdg_G`8jy-y(g%xRj$)Jzr`^)XNr4XnpFGugrOrAfX7h@fus1><$|~AihR%Acd!KBX5oCWwH=f zF9U#QQg7CKp)*x33;{lyKhpqQIUa-d3>aHT_o^kYG)xLzzBKYK;!N8!f1otP>UBx6 zGcvUfxT-Ov;smnS9>H7-a4!?2?{XD6z_0k48`vo^(KMSZW}(mn)tdK!!fmo-3h9?v zIiLIKw>g7?ZY+J!Bz(~1jV+c~0ft2Z`;|Eq%cQObO#iK+$x$|~rkMN1TAQbYjEOFW z)Hm_Mh?hUEIf)~_YTX@IU{-ti%4YpRG-6e^gXf;U=VM|47gq!-oto)HF?U3rOXE7A zg>Xx$7K1Yc8-x_98o$&!$}TmbbbmlP`HilsZVpQqTDXhMl6)g2z{mjc?)WL*To*_4 z{*1@4XIfe2&%}8$A>vTxT(j;G+2`41%P#6>5t=4fGHo?KyFg?{rJNc@QEevOWVSjJ zm0?>gvGzRE6Z_z?+*UbjmWt#yT9u$Hc4XR<>8xkI(pHF>t+Eqd@jDp?*c_qWvbW8h zj4$ddI7CZDb&qmnBzD_L3uiCf#%^xzt@Sm z+k6cohwi(N>6aXlLBo(!{aL5d>{~S0Xd=OOYEKiuy5e%~Qc9wsgu@pu3k3swL;b)G z8f1UrlR-rAyvy6MOJi+c{~qWTp|-o6afWstgb^2cs*I5UJ6y1=`E?o@ek)GMH184WO`q**mR`UD_Q9}% zwKpaKhc8sDxG)msd@2wxmUhcFr&F!rZfDIE=Tw%`+nFcrd!oImatu-?Zi*~c*D0-a zcnX;EDWt!*_L8r3w)R~pSTQfUW#sc3S8bnpX0}t0{a!(D+kUM^@_l=No=}}Im^Ci;0vZpe2yFqEA`{o2pzSxtDR?pnK zN3&Gvu3tS;`UVtGG$|AjfAsA+9Wy#!y;iLS0aLniM$s@xex)qt9nAj1`JU@C(5eff zVsEP7!> zq%n@=IuHOyUr#F$V`rAlI%f01HbQEQ(4!owg6~ARMv=6EwI>3d5)UUN?)@|EV^kIX zMb08f_*{3i;uS8^VH*05hJFd2qD?K7ZkRuyt-wd0XgCOwjfD3- zv%ghww01>yIK%{99ygWElYPo_Uy+4H(Qz}w&!D5`3vmQ8tX7aHr1d`%#=~ z=SpRJ`mH{A+kN6~_cJ!^5>QWg3O0YA3v=~jIYH{x4UBxl5i;;3m0FbZNaNWMQIGgD z-(JT`Mx)t8GY=aMwuD5HzKWivzhcK^BRR_OCF(_BKebbzrIR{`!Q$0GZpH)Lz|3Xc znrzhoVI65r!UNpJH@fvf1ep*~BJLfH4(0XExwdv;9g>DPO*A;y|5l$IOL|^iM8m(bnEb>!O!GW z+{8mdVRG5#PgHVwhaVcmbMWO^JkNyWGkc^yhaWP2*X%?1%%>f~K*%Nd4FW#Pk_x77 z*%^l^%2ljqZLQg?Bi5Ym1+o$gQ8I}2DV})qC!e}enbZq}!y#7ZykU{eW;lk_G z3UE>D=`_LfO>+CoC)1F@`lDVTcca14Kt%UVluIBlfO4L(&%y{Ly;?>NJpZU&O5S5aiO6H@@r2 z!UF?c28FjqjVJow4hbE7P%bp(8vG+U+6-2uMt?r$q!>*O<&xhuSbaAd{SC{(;Lw}K zW8a}`aaEazesIZ{#l6(_p>+UNnadCpKfQVk5Gm_Dbf4QbAIGuxZu+wu<+D`#j02lM z@8V|K&8{ci87T6gD!&>AK(N_Kyiyq`_zI-f4~;}5z~!6&*5zS9d)qHXcD!5ST?H^& ze(=|1tADTVO(Zmcj)ro+pKQGbK24_;Dn`e78voc)?C^+a%z~!~(!}IBTl$0R)b*`q zmg&nvhoIudB4`i$M|oBGY>PJZ7sWV7(Qm5|IK!f@rB;unVSUlQ5k*(m3RGoP5O=}F zJ*9yz>n#UE@`-vk_s1NWdjBXJa86Gh&B#)G*Gw>1;EA*bzGt~{HaXDgbF!vNpq{p> zrqmq)ZJBo9>2bdF$(fcT|4aj#E|n*)Q?#lmxbBief zi52Nbf`ixSXSoUiLT1d3@A6`W8D0-H6vk=^tpF`APDdGgZ%eWZYGMb^sWp{iQP`#3 z@YO$=QyRMWVR*^11`NmhGv{ndnVWyRZ7XgV&fD{kzj4JBWZG?wR75GXC z&;F4d%#484t!G%^a@^sWSUvAosumpy+C)fAIQ$Ka;g2reI6hhdwh!9KQ+~=^YALKv zqt|aUErgYyh0(BvuVaTZ;}e=@{0w?fmhS6-E#ui)lCV>Z=SSt`PRac-KT3z4!ooX+ z(Kw}zaz^RD3KhtILBA0wBC%LEGzy7BdtelIR5Cr3aI1B&&wqR-Hel+F{rl9K!_7U;Fx(E5Zg_+>kaeOom1j zlLIq=O$94;BHc=~r#uUhq>vE0*J9wp_Z~^$U>CKP?gWLiMbirh;couo(}Xd)bcg-z&%Y>w`%ND4nzS5;JB^TzFv(rVkXvo(P5(!p9$=Gd}CXDhMKe*2{k z)s+2}tYfxtAPFNK`zZftLsf-(q;;JG?ZBf)UetEcNU$$4_s$XEtC?dbf^-&Hw`^k5 zRm+p=Eqo~Y45nNL|1Z5_Jw33_o;b9#mvFQ$bGwVb#Qc( z7VMBTX}D5$sC;EcE68`KRj;|Ouhu2wHdwFhX5XXaI)RynA?4+JYVBpu)o?~(JiYlmA6uf*l*)1JprLJPLhVG}3xqASw{##~axX`aIgFZy2e5mef%0*b z!9g{pyYc*C``fVJ_Z>EbH%3;74CVd<_EQ&Pn_=h40er)5+%_hDMtOc~6zsmzjaI?t z*Z_=CUMYa@jf34$8?A%Qv4LWx1c)uv*7@8WyU|M6#;WbW{y2_X6u)mRY>{Mzxa~&q zYolRXalfx|w<#eMJ^u5HzOU+^74NTvzb3ESgoO;d5&k2U{gv?7#AciD9i=Y+{R)4Z z=KM75Hyr)u;GkMx_h - + diff --git a/liferay-plugins-sdk-6.2/shared/portos-firma-shared/.classpath b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/.classpath new file mode 100644 index 00000000..b079ea96 --- /dev/null +++ b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/liferay-plugins-sdk-6.2/shared/portos-firma-shared/.gitignore b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/.gitignore new file mode 100644 index 00000000..840e7d31 --- /dev/null +++ b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/.gitignore @@ -0,0 +1 @@ +/classes/ diff --git a/liferay-plugins-sdk-6.2/shared/portos-firma-shared/.project b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/.project new file mode 100644 index 00000000..1b9b333c --- /dev/null +++ b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/.project @@ -0,0 +1,17 @@ + + + portos-firma-shared + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/liferay-plugins-sdk-6.2/shared/portos-firma-shared/build.xml b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/build.xml new file mode 100644 index 00000000..9c2b94ef --- /dev/null +++ b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/build.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/RestFile.java b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/RestFile.java new file mode 100644 index 00000000..d09f4f45 --- /dev/null +++ b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/RestFile.java @@ -0,0 +1,92 @@ +package it.tref.firma.shared; + +import java.io.Serializable; +import java.util.Date; + +public class RestFile implements Serializable { + private static final long serialVersionUID = 560778228734037313L; + + private Integer idFile; + private String nomeFile; + private Date dataInvio; + private String documentiType; + private String tipoPratica; + private String file; + + public RestFile() { + this.idFile = Integer.valueOf(-1); + this.dataInvio = new Date(); + this.nomeFile = ""; + this.documentiType = ""; + this.tipoPratica = ""; + setFile(""); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + if (this.idFile != null) { + sb.append("Id = "); + sb.append(this.idFile); + sb.append(" "); + } + if (this.documentiType != null) { + sb.append("Documenti type = "); + sb.append(this.documentiType); + sb.append(" "); + } + if (this.tipoPratica != null) { + sb.append("Tipo pratica= "); + sb.append(this.tipoPratica); + sb.append(" "); + } + return sb.toString(); + } + + public String getNomeFile() { + return nomeFile; + } + + public void setNomeFile(String nomeFile) { + this.nomeFile = nomeFile; + } + + public Date getDataInvio() { + return dataInvio; + } + + public void setDataInvio(Date dataInvio) { + this.dataInvio = dataInvio; + } + + public String getDocumentiType() { + return documentiType; + } + + public void setDocumentiType(String documentiType) { + this.documentiType = documentiType; + } + + public String getTipoPratica() { + return tipoPratica; + } + + public void setTipoPratica(String tipoPratica) { + this.tipoPratica = tipoPratica; + } + + public Integer getIdFile() { + return idFile; + } + + public void setIdFile(Integer idFile) { + this.idFile = idFile; + } + + public String getFile() { + return file; + } + + public void setFile(String file) { + this.file = file; + } +} diff --git a/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/Risposta.java b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/Risposta.java new file mode 100644 index 00000000..4d396140 --- /dev/null +++ b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/Risposta.java @@ -0,0 +1,23 @@ +package it.tref.firma.shared; + +public class Risposta { + private int risposta = -100; + + private T obj = null; + + public int getRisposta() { + return risposta; + } + + public void setRisposta(int risposta) { + this.risposta = risposta; + } + + public T getObj() { + return obj; + } + + public void setObj(T obj) { + this.obj = obj; + } +} diff --git a/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/RispostaCostanti.java b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/RispostaCostanti.java new file mode 100644 index 00000000..743d6a8a --- /dev/null +++ b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/RispostaCostanti.java @@ -0,0 +1,13 @@ +package it.tref.firma.shared; + +public interface RispostaCostanti { + public static final int NO_SET = -100; + + public static final int OK = 0; + public static final int NO_CONFIGURATION = 1; + public static final int NO_UTENTE = 2; + public static final int NO_LOGIN = 3; + public static final int NO_FILE = 4; + public static final int NO_PRATICA = 5; + public static final int ERRORE_APPLICAZIONE = 6; +} diff --git a/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/Stile.java b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/Stile.java new file mode 100644 index 00000000..489209ad --- /dev/null +++ b/liferay-plugins-sdk-6.2/shared/portos-firma-shared/src/it/tref/firma/shared/Stile.java @@ -0,0 +1,26 @@ +package it.tref.firma.shared; + +import java.util.ArrayList; +import java.util.List; + +public class Stile { + private String logo = null; + + private List listNumrodlfProperty = new ArrayList<>(); + + public String getLogo() { + return logo; + } + + public void setLogo(String logo) { + this.logo = logo; + } + + public List getListNumrodlfProperty() { + return listNumrodlfProperty; + } + + public void setListNumrodlfProperty(List listNumrodlfProperty) { + this.listNumrodlfProperty = listNumrodlfProperty; + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/.classpath b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/.classpath index 18005a46..70c5584d 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/.classpath +++ b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/.classpath @@ -1,7 +1,7 @@ - + diff --git a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/dto/MailTemplateMessage.java b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/dto/MailTemplateMessage.java index 4552f85b..7c6b62fc 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/dto/MailTemplateMessage.java +++ b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/dto/MailTemplateMessage.java @@ -6,42 +6,42 @@ import java.io.Serializable; import java.util.List; public class MailTemplateMessage implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private long templateId; - private String templateName; - private String templateParam; - private List fileAttachments; + private long templateId; + private String templateName; + private String templateParam; + private List fileAttachments; - public long getTemplateId() { - return templateId; - } + public long getTemplateId() { + return templateId; + } - public void setTemplateId(long templateId) { - this.templateId = templateId; - } + public void setTemplateId(long templateId) { + this.templateId = templateId; + } - public String getTemplateParam() { - return templateParam; - } + public String getTemplateParam() { + return templateParam; + } - public void setTemplateParam(String templateParam) { - this.templateParam = templateParam; - } + public void setTemplateParam(String templateParam) { + this.templateParam = templateParam; + } - public List getFileAttachments() { - return fileAttachments; - } + public List getFileAttachments() { + return fileAttachments; + } - public void setFileAttachments(List fileAttachments) { - this.fileAttachments = fileAttachments; - } + public void setFileAttachments(List fileAttachments) { + this.fileAttachments = fileAttachments; + } - public String getTemplateName() { - return templateName; - } + public String getTemplateName() { + return templateName; + } - public void setTemplateName(String templateName) { - this.templateName = templateName; - } + public void setTemplateName(String templateName) { + this.templateName = templateName; + } } diff --git a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/dto/TemplateMessage.java b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/dto/TemplateMessage.java index 293fa983..2cdcd969 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/dto/TemplateMessage.java +++ b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/dto/TemplateMessage.java @@ -3,89 +3,88 @@ package it.tref.liferay.portos.mailmanager.shared.messaging.dto; import java.io.Serializable; public class TemplateMessage implements Serializable { - private static final long serialVersionUID = 1L; - - private long templateId; - private String templateName; - private String from; - private String[] to; - private String[] cc; - private String[] ccn; - private String subject; - private String body; - private boolean attachmentPermitted; - - - public long getTemplateId() { - return templateId; - } - - public void setTemplateId(long templateId) { - this.templateId = templateId; - } - - public String getTemplateName() { - return templateName; - } - - public void setTemplateName(String templateName) { - this.templateName = templateName; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String[] getTo() { - return to; - } - - public void setTo(String[] to) { - this.to = to; - } - - public String[] getCc() { - return cc; - } - - public void setCc(String[] cc) { - this.cc = cc; - } - - public String[] getCcn() { - return ccn; - } - - public void setCcn(String[] ccn) { - this.ccn = ccn; - } - - public String getBody() { - return body; - } - - public void setBody(String body) { - this.body = body; - } - - public String getSubject() { - return subject; - } - - public void setSubject(String subject) { - this.subject = subject; - } - - public boolean isAttachmentPermitted() { - return attachmentPermitted; - } - - public void setAttachmentPermitted(boolean attachmentPermitted) { - this.attachmentPermitted = attachmentPermitted; - } + private static final long serialVersionUID = 1L; + + private long templateId; + private String templateName; + private String from; + private String[] to; + private String[] cc; + private String[] ccn; + private String subject; + private String body; + private boolean attachmentPermitted; + + public long getTemplateId() { + return templateId; + } + + public void setTemplateId(long templateId) { + this.templateId = templateId; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public String getFrom() { + return from; + } + + public void setFrom(String from) { + this.from = from; + } + + public String[] getTo() { + return to; + } + + public void setTo(String[] to) { + this.to = to; + } + + public String[] getCc() { + return cc; + } + + public void setCc(String[] cc) { + this.cc = cc; + } + + public String[] getCcn() { + return ccn; + } + + public void setCcn(String[] ccn) { + this.ccn = ccn; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public boolean isAttachmentPermitted() { + return attachmentPermitted; + } + + public void setAttachmentPermitted(boolean attachmentPermitted) { + this.attachmentPermitted = attachmentPermitted; + } } diff --git a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/util/DestinationNames.java b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/util/DestinationNames.java index 9c9401ae..32c98502 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/util/DestinationNames.java +++ b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/util/DestinationNames.java @@ -2,12 +2,12 @@ package it.tref.liferay.portos.mailmanager.shared.messaging.util; public class DestinationNames { - public static final String SEND_MAIL = "liferay/mail_manager/add_email"; - public static final String SEND_TEMPLATE_MAIL = "liferay/mail_manager/add_email_by_template"; + public static final String SEND_MAIL = "liferay/mail_manager/add_email"; + public static final String SEND_TEMPLATE_MAIL = "liferay/mail_manager/add_email_by_template"; - public static final String SEND_MAIL_SYNC = "liferay/mail_manager/add_email_sync"; - public static final String SEND_TEMPLATE_MAIL_SYNC = "liferay/mail_manager/add_email_by_template_sync"; + public static final String SEND_MAIL_SYNC = "liferay/mail_manager/add_email_sync"; + public static final String SEND_TEMPLATE_MAIL_SYNC = "liferay/mail_manager/add_email_by_template_sync"; - public static final String EDIT_EMAIL_TEMPLATE = "liferay/mail_manager/edit_email_template"; + public static final String EDIT_EMAIL_TEMPLATE = "liferay/mail_manager/edit_email_template"; } diff --git a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/util/MailManagerUtil.java b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/util/MailManagerUtil.java index bddabc13..9e835c37 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/util/MailManagerUtil.java +++ b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/messaging/util/MailManagerUtil.java @@ -28,13 +28,13 @@ import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; public class MailManagerUtil { - + private final static Log _log = LogFactoryUtil.getLog(MailManagerUtil.class); public static boolean sendMail(String messageId, String inReplyTo, String from, String[] to, String[] cc, String[] bcc, String subject, String body, boolean htmlFormat, boolean async, boolean checkPermission, ServiceContext serviceContext) throws AddressException, SystemException { - + InternetAddress fromInternetAddress = new InternetAddress(from, true); InternetAddress[] toInternetAddress = MailUtil.fromStringAddress(to); @@ -114,7 +114,7 @@ public class MailManagerUtil { String templateName, String[] to, String[] cc, String[] ccn, JSONObject templateVariables, List fileAttachments, boolean async, boolean checkPermission, ServiceContext serviceContext) throws SystemException { - + JSONObject templateParam = JSONFactoryUtil.createJSONObject(); templateParam.put(MailManagerConstants.TEMPLATE_PARAMETER_VARIABLES_KEY, templateVariables); diff --git a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/model/FileAttachment.java b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/model/FileAttachment.java index 43c558ce..9fcb4adf 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/model/FileAttachment.java +++ b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/model/FileAttachment.java @@ -12,90 +12,87 @@ import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; import java.io.File; import java.io.InputStream; - public class FileAttachment extends com.liferay.mail.model.FileAttachment { - public static final Log _log = LogFactoryUtil.getLog(FileAttachment.class); - - private long fileEntryId; - private byte[] bytes; - private String tipologia; - private String fileName; - - public FileAttachment() { - super(); - } - - public FileAttachment(File file, String fileName, String tipologia, long fileEntryId, byte[] bytes) { - super(file, fileName); - this.setTipologia(tipologia); - this.fileEntryId = fileEntryId; - this.setBytes(bytes); - } - - - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - super.setFileName(fileName); - } - - - public long getFileEntryId() { - return fileEntryId; - } - - public void setFileEntryId(long fileEntryId) { - this.fileEntryId = fileEntryId; - } - - public byte[] getBytes() { - return bytes; - } - - public void setBytes(byte[] bytes) { - this.bytes = bytes; - } - - public String getTipologia() { - return tipologia; - } - - public void setTipologia(String tipologia) { - this.tipologia = tipologia; - } - - public File generateFile() { - - File result = null; - - try { - - if (Validator.isNotNull(super.getFile())) { - result = super.getFile(); - } else if (Validator.isNotNull(fileEntryId)) { - FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId); - setFileName(fileEntry.getTitle() - + (Validator.isNotNull(fileEntry.getExtension()) ? "." + fileEntry.getExtension() : StringPool.BLANK)); - InputStream is = - DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), fileEntry.getVersion(), false); - result = FileUtil.createTempFile(is); - is.close(); - result.deleteOnExit(); - } else if (Validator.isNotNull(bytes)) { - result = FileUtil.createTempFile(bytes); - result.deleteOnExit(); - } - - } catch (Exception e) { - _log.error("Error during getFile()", e); - } - setFile(result); - return result; - } - + public static final Log _log = LogFactoryUtil.getLog(FileAttachment.class); + + private long fileEntryId; + private byte[] bytes; + private String tipologia; + private String fileName; + + public FileAttachment() { + super(); + } + + public FileAttachment(File file, String fileName, String tipologia, long fileEntryId, byte[] bytes) { + super(file, fileName); + this.setTipologia(tipologia); + this.fileEntryId = fileEntryId; + this.setBytes(bytes); + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + super.setFileName(fileName); + } + + public long getFileEntryId() { + return fileEntryId; + } + + public void setFileEntryId(long fileEntryId) { + this.fileEntryId = fileEntryId; + } + + public byte[] getBytes() { + return bytes; + } + + public void setBytes(byte[] bytes) { + this.bytes = bytes; + } + + public String getTipologia() { + return tipologia; + } + + public void setTipologia(String tipologia) { + this.tipologia = tipologia; + } + + public File generateFile() { + + File result = null; + + try { + + if (Validator.isNotNull(super.getFile())) { + result = super.getFile(); + } else if (Validator.isNotNull(fileEntryId)) { + FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId); + setFileName(fileEntry.getTitle() + + (Validator.isNotNull(fileEntry.getExtension()) ? "." + fileEntry.getExtension() + : StringPool.BLANK)); + InputStream is = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), + fileEntry.getVersion(), false); + result = FileUtil.createTempFile(is); + is.close(); + result.deleteOnExit(); + } else if (Validator.isNotNull(bytes)) { + result = FileUtil.createTempFile(bytes); + result.deleteOnExit(); + } + + } catch (Exception e) { + _log.error("Error during getFile()", e); + } + setFile(result); + return result; + } } diff --git a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/MailManagerConstants.java b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/MailManagerConstants.java index 6812e53f..a296e245 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/MailManagerConstants.java +++ b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/MailManagerConstants.java @@ -1,38 +1,37 @@ package it.tref.liferay.portos.mailmanager.shared.util; - public class MailManagerConstants { - public enum SendTemplateMode { + public enum SendTemplateMode { - REVIEW("R"), EDIT("E"); + REVIEW("R"), EDIT("E"); - private SendTemplateMode(String id) { - this.id = id; - } + private SendTemplateMode(String id) { + this.id = id; + } - private String id; + private String id; - public static SendTemplateMode parse(String id) { - for (SendTemplateMode item : values()) { - if (item.id.equals(id)) { - return item; - } - } - throw new IllegalArgumentException("Invalid SendTemplateMode value: " + id); - } + public static SendTemplateMode parse(String id) { + for (SendTemplateMode item : values()) { + if (item.id.equals(id)) { + return item; + } + } + throw new IllegalArgumentException("Invalid SendTemplateMode value: " + id); + } - public String getId() { - return id; - } - } + public String getId() { + return id; + } + } - public static final String TEMPLATE_PARAMETER_VARIABLES_KEY = "variables"; - public static final String TEMPLATE_PARAMETER_TO_KEY = "to"; - public static final String TEMPLATE_PARAMETER_CC_KEY = "cc"; - public static final String TEMPLATE_PARAMETER_CCN_KEY = "ccn"; + public static final String TEMPLATE_PARAMETER_VARIABLES_KEY = "variables"; + public static final String TEMPLATE_PARAMETER_TO_KEY = "to"; + public static final String TEMPLATE_PARAMETER_CC_KEY = "cc"; + public static final String TEMPLATE_PARAMETER_CCN_KEY = "ccn"; - public static final String MESSAGING_SEND_MODE_SYNC = "sync"; - public static final String MESSAGING_SEND_MODE_ASYNC = "async"; + public static final String MESSAGING_SEND_MODE_SYNC = "sync"; + public static final String MESSAGING_SEND_MODE_ASYNC = "async"; } diff --git a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/MailUtil.java b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/MailUtil.java index 0870629b..ca3ccd79 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/MailUtil.java +++ b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/MailUtil.java @@ -16,117 +16,118 @@ import javax.mail.internet.InternetAddress; public class MailUtil { - public static String fromInternetAddress(InternetAddress internetAddress) { - if (Validator.isNotNull(internetAddress)) { - return internetAddress.getAddress(); - } - return null; - } + public static String fromInternetAddress(InternetAddress internetAddress) { + if (Validator.isNotNull(internetAddress)) { + return internetAddress.getAddress(); + } + return null; + } - public static String[] fromInternetAddresses(InternetAddress[] internetAddresses) { - if (internetAddresses != null && internetAddresses.length > 0) { - String[] addresses = new String[internetAddresses.length]; - for (int i = 0; i < internetAddresses.length; i++) { - addresses[i] = internetAddresses[i].getAddress(); - } - return addresses; - } - return null; - } + public static String[] fromInternetAddresses(InternetAddress[] internetAddresses) { + if (internetAddresses != null && internetAddresses.length > 0) { + String[] addresses = new String[internetAddresses.length]; + for (int i = 0; i < internetAddresses.length; i++) { + addresses[i] = internetAddresses[i].getAddress(); + } + return addresses; + } + return null; + } - public static InternetAddress[] fromStringAddress(String[] address) throws AddressException { + public static InternetAddress[] fromStringAddress(String[] address) throws AddressException { - InternetAddress[] result = null; - if (address != null && address.length > 0) { - result = new InternetAddress[address.length]; - for (int i = 0; i < address.length; i++) { - result[i] = new InternetAddress(address[i], true); - } - } - return result; - } + InternetAddress[] result = null; + if (address != null && address.length > 0) { + result = new InternetAddress[address.length]; + for (int i = 0; i < address.length; i++) { + result[i] = new InternetAddress(address[i], true); + } + } + return result; + } - public static List getFileAttachments(UploadPortletRequest uploadPortletRequest) { - return getFileAttachments(uploadPortletRequest, Collections.emptyList()); - } + public static List getFileAttachments(UploadPortletRequest uploadPortletRequest) { + return getFileAttachments(uploadPortletRequest, Collections. emptyList()); + } - public static List getFileAttachments(UploadPortletRequest uploadPortletRequest, - List defaultFileAttachments) { + public static List getFileAttachments(UploadPortletRequest uploadPortletRequest, + List defaultFileAttachments) { - String allegatiIndexesString = uploadPortletRequest.getParameter("allegatiIndexes"); + String allegatiIndexesString = uploadPortletRequest.getParameter("allegatiIndexes"); - if (allegatiIndexesString == null) { - return defaultFileAttachments; - } + if (allegatiIndexesString == null) { + return defaultFileAttachments; + } - List fileAttachments = new ArrayList(); + List fileAttachments = new ArrayList(); - int[] allegatiIndexes = StringUtil.split(allegatiIndexesString, 0); + int[] allegatiIndexes = StringUtil.split(allegatiIndexesString, 0); - for (int allegatiIndex : allegatiIndexes) { - long fileEntryId = ParamUtil.getLong(uploadPortletRequest, "fileEntryId" + allegatiIndex); + for (int allegatiIndex : allegatiIndexes) { + long fileEntryId = ParamUtil.getLong(uploadPortletRequest, "fileEntryId" + allegatiIndex); - String fileName = uploadPortletRequest.getFileName("file" + allegatiIndex); - File file = uploadPortletRequest.getFile("file" + allegatiIndex); + String fileName = uploadPortletRequest.getFileName("file" + allegatiIndex); + File file = uploadPortletRequest.getFile("file" + allegatiIndex); - if (Validator.isNull(fileEntryId)) { - if (Validator.isNull(fileName)) { - continue; - } - } + if (Validator.isNull(fileEntryId)) { + if (Validator.isNull(fileName)) { + continue; + } + } - String tipologia = ParamUtil.getString(uploadPortletRequest, "tipologia" + allegatiIndex); + String tipologia = ParamUtil.getString(uploadPortletRequest, "tipologia" + allegatiIndex); - FileAttachment fileAttachment = new FileAttachment(); + FileAttachment fileAttachment = new FileAttachment(); - fileAttachment.setFileEntryId(fileEntryId); - fileAttachment.setTipologia(tipologia); - fileAttachment.setFileName(fileName); - fileAttachment.setFile(file); + fileAttachment.setFileEntryId(fileEntryId); + fileAttachment.setTipologia(tipologia); + fileAttachment.setFileName(fileName); + fileAttachment.setFile(file); - fileAttachments.add(fileAttachment); - } + fileAttachments.add(fileAttachment); + } - return fileAttachments; - } + return fileAttachments; + } - public static List getEmailFileAttachments( - UploadPortletRequest uploadPortletRequest) { - return getEmailFileAttachments(uploadPortletRequest, Collections.emptyList()); - } + public static List getEmailFileAttachments( + UploadPortletRequest uploadPortletRequest) { + return getEmailFileAttachments(uploadPortletRequest, + Collections. emptyList()); + } - public static List getEmailFileAttachments( - UploadPortletRequest uploadPortletRequest, List defaultFileAttachments) { + public static List getEmailFileAttachments( + UploadPortletRequest uploadPortletRequest, + List defaultFileAttachments) { - String allegatiIndexesString = uploadPortletRequest.getParameter("allegatiIndexes"); + String allegatiIndexesString = uploadPortletRequest.getParameter("allegatiIndexes"); - if (allegatiIndexesString == null) { - return defaultFileAttachments; - } + if (allegatiIndexesString == null) { + return defaultFileAttachments; + } - List fileAttachments = - new ArrayList(); + List fileAttachments = new ArrayList(); - int[] allegatiIndexes = StringUtil.split(allegatiIndexesString, 0); + int[] allegatiIndexes = StringUtil.split(allegatiIndexesString, 0); - for (int allegatiIndex : allegatiIndexes) { + for (int allegatiIndex : allegatiIndexes) { - String fileName = uploadPortletRequest.getFileName("file" + allegatiIndex); - File file = uploadPortletRequest.getFile("file" + allegatiIndex); + String fileName = uploadPortletRequest.getFileName("file" + allegatiIndex); + File file = uploadPortletRequest.getFile("file" + allegatiIndex); - if (Validator.isNull(fileName)) { - continue; - } + if (Validator.isNull(fileName)) { + continue; + } - com.liferay.mail.model.FileAttachment fileAttachment = new com.liferay.mail.model.FileAttachment(); + com.liferay.mail.model.FileAttachment fileAttachment = new com.liferay.mail.model.FileAttachment(); - fileAttachment.setFileName(fileName); - fileAttachment.setFile(file); + fileAttachment.setFileName(fileName); + fileAttachment.setFile(file); - fileAttachments.add(fileAttachment); - } + fileAttachments.add(fileAttachment); + } - return fileAttachments; - } + return fileAttachments; + } } diff --git a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/StringUtil.java b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/StringUtil.java index 2bb47066..a462ca05 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/StringUtil.java +++ b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/src/it/tref/liferay/portos/mailmanager/shared/util/StringUtil.java @@ -1,14 +1,13 @@ package it.tref.liferay.portos.mailmanager.shared.util; - public class StringUtil extends com.liferay.portal.kernel.util.StringUtil { - public static String[] splitAndTrim(String s) { - String[] array = StringUtil.split(s); - for (int i = 0; i < array.length; i++) { - array[i] = StringUtil.trim(array[i]); - } - return array; - } + public static String[] splitAndTrim(String s) { + String[] array = StringUtil.split(s); + for (int i = 0; i < array.length; i++) { + array[i] = StringUtil.trim(array[i]); + } + return array; + } }