diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-portlet.xml b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-portlet.xml index 7a8e39fb..2ac06f44 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-portlet.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-portlet.xml @@ -39,12 +39,12 @@ - it.tref.liferay.portos.bo.scheduler.SchedulerSorteggio + Sorteggio Pratiche + it.mwg.sismica.bo.scheduler.SchedulerSorteggio - - 1 - minute - + + 0 3 * * * ? + diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalService.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalService.java index 54f0be7e..4776b552 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalService.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalService.java @@ -438,9 +438,6 @@ public interface SorteggioLocalService extends BaseLocalService, public long findTipoPraticaIdSorteggioPraticaEsterna(long praticaEsternaId) throws com.liferay.portal.kernel.exception.SystemException; - public java.util.List sorteggio(long companyId, - java.util.Date dtSorteggio) throws java.lang.Exception; - @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public java.util.List search( java.lang.Long groupId, java.lang.String anno, java.lang.String mese, diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceClp.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceClp.java index a64be732..d76319f9 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceClp.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceClp.java @@ -267,22 +267,18 @@ public class SorteggioLocalServiceClp implements SorteggioLocalService { _methodParameterTypes46 = new String[] { "long" }; - _methodName47 = "sorteggio"; + _methodName47 = "search"; - _methodParameterTypes47 = new String[] { "long", "java.util.Date" }; - - _methodName48 = "search"; - - _methodParameterTypes48 = new String[] { + _methodParameterTypes47 = new String[] { "java.lang.Long", "java.lang.String", "java.lang.String", "int", "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.Long", "java.lang.String", "int", "int" }; - _methodName49 = "count"; + _methodName48 = "count"; - _methodParameterTypes49 = new String[] { + _methodParameterTypes48 = new String[] { "java.lang.Long", "java.lang.String", "java.lang.String", "int", "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.Long", "java.lang.String" @@ -1891,39 +1887,6 @@ public class SorteggioLocalServiceClp implements SorteggioLocalService { return ((Long)returnObj).longValue(); } - @Override - public java.util.List sorteggio(long companyId, - java.util.Date dtSorteggio) throws java.lang.Exception { - Object returnObj = null; - - try { - returnObj = _invokableLocalService.invokeMethod(_methodName47, - _methodParameterTypes47, - new Object[] { - companyId, - - ClpSerializer.translateInput(dtSorteggio) - }); - } - catch (Throwable t) { - t = ClpSerializer.translateThrowable(t); - - if (t instanceof java.lang.Exception) { - throw (java.lang.Exception)t; - } - - if (t instanceof RuntimeException) { - throw (RuntimeException)t; - } - else { - throw new RuntimeException(t.getClass().getName() + - " is not a valid exception"); - } - } - - return (java.util.List)ClpSerializer.translateOutput(returnObj); - } - @Override public java.util.List search( java.lang.Long groupId, java.lang.String anno, java.lang.String mese, @@ -1934,8 +1897,8 @@ public class SorteggioLocalServiceClp implements SorteggioLocalService { Object returnObj = null; try { - returnObj = _invokableLocalService.invokeMethod(_methodName48, - _methodParameterTypes48, + returnObj = _invokableLocalService.invokeMethod(_methodName47, + _methodParameterTypes47, new Object[] { ClpSerializer.translateInput(groupId), @@ -1991,8 +1954,8 @@ public class SorteggioLocalServiceClp implements SorteggioLocalService { Object returnObj = null; try { - returnObj = _invokableLocalService.invokeMethod(_methodName49, - _methodParameterTypes49, + returnObj = _invokableLocalService.invokeMethod(_methodName48, + _methodParameterTypes48, new Object[] { ClpSerializer.translateInput(groupId), @@ -2131,6 +2094,4 @@ public class SorteggioLocalServiceClp implements SorteggioLocalService { private String[] _methodParameterTypes47; private String _methodName48; private String[] _methodParameterTypes48; - private String _methodName49; - private String[] _methodParameterTypes49; } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceUtil.java index 3d92a060..5f064551 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceUtil.java @@ -529,11 +529,6 @@ public class SorteggioLocalServiceUtil { .findTipoPraticaIdSorteggioPraticaEsterna(praticaEsternaId); } - public static java.util.List sorteggio(long companyId, - java.util.Date dtSorteggio) throws java.lang.Exception { - return getService().sorteggio(companyId, dtSorteggio); - } - public static java.util.List search( java.lang.Long groupId, java.lang.String anno, java.lang.String mese, int settimana, java.lang.String committente, java.lang.String tecnico, diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceWrapper.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceWrapper.java index f6541a82..9af4c63e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceWrapper.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/SorteggioLocalServiceWrapper.java @@ -567,12 +567,6 @@ public class SorteggioLocalServiceWrapper implements SorteggioLocalService, return _sorteggioLocalService.findTipoPraticaIdSorteggioPraticaEsterna(praticaEsternaId); } - @Override - public java.util.List sorteggio(long companyId, - java.util.Date dtSorteggio) throws java.lang.Exception { - return _sorteggioLocalService.sorteggio(companyId, dtSorteggio); - } - @Override public java.util.List search( java.lang.Long groupId, java.lang.String anno, java.lang.String mese, diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AvvisoUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AvvisoUtil.java index 4cd2ffcf..d5eef0e8 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AvvisoUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/AvvisoUtil.java @@ -177,8 +177,9 @@ public class AvvisoUtil { allTipoDocumentoFileTemplateProps.put("DPA", "conf.geniocivile.avviso.template.id.deposito.A"); allTipoDocumentoFileTemplateProps.put("DPB", "conf.geniocivile.avviso.template.id.deposito.B"); allTipoDocumentoFileTemplateProps.put("DPB1", "conf.geniocivile.avviso.template.id.deposito.B1"); - allTipoDocumentoFileTemplateProps.put("DPC", "conf.geniocivile.avviso.template.id.deposito.C"); allTipoDocumentoFileTemplateProps.put("DPB2", "conf.geniocivile.avviso.template.id.deposito.B2"); + allTipoDocumentoFileTemplateProps.put("DPC", "conf.geniocivile.avviso.template.id.deposito.C"); + allTipoDocumentoFileTemplateProps.put("DPPS", "conf.geniocivile.avviso.template.id.deposito.PS"); allTipoDocumentoFileTemplateProps.put("DPS", "conf.geniocivile.avviso.template.id.deposito.S"); /* * allTipoDocumentoFileTemplateProps.put(StatoPraticaConstants. diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/content/Language.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/content/Language.properties index 63b4f50d..2d2f532c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/content/Language.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/content/Language.properties @@ -180,6 +180,8 @@ conf.geniocivile.avviso.template.id.deposito.B = Template ricevuta deposito mod. conf.geniocivile.avviso.template.id.deposito.B1 = Template ricevuta deposito mod. B1 conf.geniocivile.avviso.template.id.deposito.C = Template ricevuta deposito mod. C conf.geniocivile.avviso.template.id.deposito.B2 = Template ricevuta deposito mod. B2 +conf.geniocivile.avviso.template.id.deposito.PS = Template Avvisio Avvio di procedimento dopo sorteggio +conf.geniocivile.avviso.template.id.deposito.S = Template avviso di sorteggio #Configurazione Allegati conf.geniocivile.attachment.folder.id = Folder Allegati diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/scheduler/SchedulerSorteggio.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/scheduler/SchedulerSorteggio.java new file mode 100644 index 00000000..2381ce19 --- /dev/null +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/scheduler/SchedulerSorteggio.java @@ -0,0 +1,84 @@ +package it.mwg.sismica.bo.scheduler; + +import it.mwg.sismica.bo.util.SorteggioPraticaUtil; +import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; +import it.tref.liferay.portos.bo.service.ConfigurazioneServiceUtil; +import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.messaging.Message; +import com.liferay.portal.kernel.messaging.MessageListener; +import com.liferay.portal.kernel.messaging.MessageListenerException; +import com.liferay.portal.model.Company; +import com.liferay.portal.model.Role; +import com.liferay.portal.model.RoleConstants; +import com.liferay.portal.model.User; +import com.liferay.portal.service.CompanyLocalServiceUtil; +import com.liferay.portal.service.RoleLocalServiceUtil; +import com.liferay.portal.service.ServiceContext; +import com.liferay.portal.service.UserLocalServiceUtil; + +public class SchedulerSorteggio implements MessageListener { + + private static final Log _log = LogFactoryUtil.getLog(SchedulerSorteggio.class); + + private static final Lock lock = new ReentrantLock(); + + @Override + public void receive(Message message) throws MessageListenerException { + if (lock.tryLock()) { + Date dt = new Date(); + try { + for (Company company : CompanyLocalServiceUtil.getCompanies()) { + long companyId = company.getCompanyId(); + if (isGiornoSorteggio(companyId, dt)) { + _log.info("Sorteggio da scheduler"); + SorteggioPraticaUtil.sorteggio(companyId, dt); + + Role role = RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR); + User user = UserLocalServiceUtil.getRoleUsers(role.getRoleId(), 0, 1).get(0); + + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setCompanyId(companyId); + serviceContext.setScopeGroupId(company.getGroupId()); + serviceContext.setUserId(user.getUserId()); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(dt); + calendar.add(Calendar.DAY_OF_MONTH, 7); + + ConfigurazioneServiceUtil.storeConfig( + "conf.geniocivile.sorteggio.data.prossimo.sorteggio", new SimpleDateFormat( + "dd/MM/yyyy").format(calendar.getTime()), serviceContext); + } + } + } catch (SystemException | ParseException | PortalException e) { + _log.error("error", e); + } + lock.unlock(); + } + } + + private static boolean isGiornoSorteggio(long companyId, Date dt) throws SystemException, ParseException { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(dt); + int dowOggi = calendar.get(Calendar.DAY_OF_WEEK); + int oraOggi = calendar.get(Calendar.HOUR_OF_DAY); + int dowSorteggio = Integer.parseInt(ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, + ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO)); + int oraSorteggio = Integer.parseInt(ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, + ConfigurazioneConstants.HOUR_OF_DAY_SORTEGGIO)); + + return (dowOggi == dowSorteggio) && (oraOggi == oraSorteggio); + } +} diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/scheduler/SchedulerWorkflow.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/scheduler/SchedulerWorkflow.java index 40d96d5c..7e55e4ce 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/scheduler/SchedulerWorkflow.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/scheduler/SchedulerWorkflow.java @@ -30,6 +30,7 @@ public class SchedulerWorkflow implements MessageListener { private static final Log _log = LogFactoryUtil.getLog(SchedulerWorkflow.class); private static final Lock lock = new ReentrantLock(); + @Override public void receive(Message message) throws MessageListenerException { if (lock.tryLock()) { _log.info("Inizio elaborazione"); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SorteggioPraticaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SorteggioPraticaUtil.java new file mode 100644 index 00000000..4e5399ff --- /dev/null +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SorteggioPraticaUtil.java @@ -0,0 +1,334 @@ +package it.mwg.sismica.bo.util; + +import it.tref.liferay.portos.bo.model.Comune; +import it.tref.liferay.portos.bo.model.ControlloPratica; +import it.tref.liferay.portos.bo.model.DettPratica; +import it.tref.liferay.portos.bo.model.IntPratica; +import it.tref.liferay.portos.bo.model.Provincia; +import it.tref.liferay.portos.bo.model.Soggetto; +import it.tref.liferay.portos.bo.model.Territorio; +import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; +import it.tref.liferay.portos.bo.service.ComuneLocalServiceUtil; +import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; +import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; +import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; +import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; +import it.tref.liferay.portos.bo.service.ProvinciaLocalServiceUtil; +import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil; +import it.tref.liferay.portos.bo.service.SorteggioLocalServiceUtil; +import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; +import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; +import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; +import it.tref.liferay.portos.bo.shared.util.TipoSoggettoUtil; +import it.tref.liferay.portos.bo.util.AvvisoUtil; +import it.tref.liferay.portos.report.shared.constants.ReportConstants; +import it.tref.liferay.portos.report.shared.dto.ReportDto; +import it.tref.liferay.portos.report.shared.util.ReportUtil; + +import java.security.SecureRandom; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import org.apache.commons.lang.time.DateUtils; + +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.repository.model.FileEntry; +import com.liferay.portal.kernel.repository.model.Folder; +import com.liferay.portal.kernel.util.Validator; +import com.liferay.portal.model.Company; +import com.liferay.portal.model.Role; +import com.liferay.portal.model.RoleConstants; +import com.liferay.portal.service.CompanyLocalServiceUtil; +import com.liferay.portal.service.RoleLocalServiceUtil; +import com.liferay.portal.service.ServiceContext; +import com.liferay.portal.service.UserLocalServiceUtil; +import com.liferay.portlet.documentlibrary.model.DLFolderConstants; +import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; + +public class SorteggioPraticaUtil { + + private static final Lock lock = new ReentrantLock(); + + public static final String DATE_TIME_FORMAT = "dd/MM/yyyy HH:mm:ss"; + + public final static String APERTO = "APERTO"; + public final static String CHIUSO = "CHIUSO"; + + private static final String FOLDER_SORTEGGIO = "Report_Sorteggio"; + + private static final String FILE_ENTRY_TEMPLATE_SORTEGGIO = "Sorteggio"; + + /** + * + * Implementazione della procedura di sorteggio secondo i requisiti della + * Regione Siciliana. + * + * @author Manifattura Web Group per Regione Siciliana + * @param companyId + * @param dtSorteggio + * @throws PortalException + * @throws SystemException + */ + public static List sorteggio(long companyId, Date dtSorteggio) throws PortalException, + SystemException { + + List esito = new ArrayList<>(); + if (lock.tryLock()) { + SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_FORMAT); + esito.add("Sorteggio iniziato in data " + sdf.format(dtSorteggio) + ".

"); + + Map> sorteggiabili = IntPraticaLocalServiceUtil.findSorteggiabiliNew( + companyId, dtSorteggio); + + int numeroSorteggiabili = 0; + for (Map.Entry> s : sorteggiabili.entrySet()) { + numeroSorteggiabili += s.getValue().size(); + } + esito.add("

" + numeroSorteggiabili + " pratiche sottoposte a sorteggio.

"); + + SecureRandom rnd = new SecureRandom(); + List sorteggiate = new ArrayList<>(); + for (Map.Entry> s : sorteggiabili.entrySet()) { + String codiceProvincia = s.getKey(); + List elenco = s.getValue(); + + Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(companyId, codiceProvincia); + long numeroSorteggiate = (long) Math.ceil(0.1 * elenco.size()); + String testoSorteggio; + if (numeroSorteggiate > 1) { + testoSorteggio = "saranno estratte " + numeroSorteggiate + " pratiche"; + } else { + testoSorteggio = "sarà estratta 1 pratica"; + } + esito.add("

(" + sdf.format(new Date()) + ") Provincia di " + + provincia.getProvincia() + " " + elenco.size() + " pratiche, " + testoSorteggio + + ".

    "); + + Map ordinate = new HashMap<>(); + + int chiave; + for (IntPratica pratica : elenco) { + do { + chiave = rnd.nextInt(); + } while (ordinate.containsKey(chiave)); + ordinate.put(chiave, pratica); + } + TreeMap mescolate = new TreeMap(ordinate); + + long contatore = 0; + for (Map.Entry m : mescolate.entrySet()) { + IntPratica pratica = m.getValue(); + long intPraticaId = pratica.getIntPraticaId(); + DettPratica dettPratica = DettPraticaLocalServiceUtil + .getLastCompletedByIntPratica(intPraticaId); + + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setCompanyId(dettPratica.getCompanyId()); + serviceContext.setScopeGroupId(dettPratica.getGroupId()); + serviceContext.setUserId(dettPratica.getUserId()); + + if (contatore++ < numeroSorteggiate) { + sorteggiate.add(pratica); + esito.add("
  1. Sorteggiata: " + pratica.getNumeroProgetto() + " (id " + intPraticaId + + ") del " + sdf.format(pratica.getDtPratica()) + " (" + m.getKey() + + ")
  2. "); + } else { + pratica.setDtSorteggio(dtSorteggio); + IntPraticaLocalServiceUtil.updateIntPratica(pratica); + + esito.add("
  3. Non sorteggiata: " + pratica.getNumeroProgetto() + " (id " + + intPraticaId + ") del " + sdf.format(pratica.getDtPratica()) + " (" + + m.getKey() + ")
  4. "); + } + } + esito.add("
"); + } + if (sorteggiate.size() > 0) { + saveSorteggio(companyId, sorteggiate, dtSorteggio); + } + esito.add("Sorteggio terminato in data " + sdf.format(new Date()) + ".

"); + + creaReportSorteggio(companyId, dtSorteggio, esito); + + // Salvataggio data ultimo sorteggio + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setCompanyId(companyId); + serviceContext.setScopeGroupId(-1L); + serviceContext.setUserId(UserLocalServiceUtil.getDefaultUserId(companyId)); + ConfigurazioneLocalServiceUtil.storeConfig(ConfigurazioneConstants.DATE_ULTIMO_SORTEGGIO, + sdf.format(dtSorteggio), serviceContext); + + lock.unlock(); + } + + return esito; + } + + private static FileEntry creaReportSorteggio(long companyId, Date dtSorteggio, List contenuto) + throws PortalException, SystemException { + + Role role = RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR); + long userId = UserLocalServiceUtil.getRoleUsers(role.getRoleId(), 0, 1).get(0).getUserId(); + + Company company = CompanyLocalServiceUtil.getCompany(companyId); + Folder folderTemplate = DLAppLocalServiceUtil.getFolder(company.getGroupId(), + DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, "Template"); + FileEntry fileEntryTemplate = DLAppLocalServiceUtil.getFileEntry(folderTemplate.getGroupId(), + folderTemplate.getFolderId(), FILE_ENTRY_TEMPLATE_SORTEGGIO); + + Folder folderReport = DLAppLocalServiceUtil.getFolder(company.getGroupId(), + DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, FOLDER_SORTEGGIO); + + StringBuilder sb = new StringBuilder(contenuto.size()); + for (String riga : contenuto) { + sb.append(riga); + } + Map parameters = new HashMap(); + parameters.put("html", sb.toString()); + + ReportDto reportDto = new ReportDto(); + reportDto.setFileEntryIds(new long[] { fileEntryTemplate.getFileEntryId() }); + reportDto.setFolderId(folderReport.getFolderId()); + reportDto.setFileName(reportFileName(companyId, dtSorteggio)); + + reportDto.setHeader(""); + reportDto.setHeaderHeight(1); + reportDto.setFooter(""); + reportDto.setFooterHeight(40); + + reportDto.setParameters(parameters); + reportDto.setShowNumberOfPage(true); + reportDto.setType(ReportConstants.ReportType.VELOCITY_TO_PDF.toString()); + + String resourcePath = SorteggioPraticaUtil.class.getName().replaceAll("\\w+\\.", "../") + .replace(SorteggioPraticaUtil.class.getSimpleName(), "resource/asseverazioni"); + reportDto.setPortalURL(SorteggioPraticaUtil.class.getResource(resourcePath).getPath()); + + ReportUtil.generateReport(companyId, userId, reportDto, null); + + return null; + } + + private static String reportFileName(long companyId, Date dtSorteggio) { + Calendar calSorteggio = DateUtils.toCalendar(dtSorteggio); + String anno = String.valueOf(calSorteggio.get(Calendar.YEAR)); + int settimana = calSorteggio.get(Calendar.WEEK_OF_YEAR); + return reportFileName(companyId, anno, settimana); + } + + private static String reportFileName(long companyId, String anno, int settimana) { + return "Sorteggio_" + settimana + "_" + anno + "_" + companyId; + } + + /** + * @author Manifattura Web Group per Regione Siciliana + * + * @param companyId + * @param pratiche + * Lista di pratiche sorteggiate + * @param dtSorteggio + * Data del sorteggio + * @throws PortalException + * @throws SystemException + */ + private static void saveSorteggio(long companyId, List pratiche, Date dtSorteggio) + throws PortalException, SystemException { + + long numeroEstrazione = 1; + for (IntPratica pratica : pratiche) { + + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica.getTerritorioId()); + Comune comune = ComuneLocalServiceUtil.getComune(territorio.getComuneId()); + Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), + comune.getCodiceProvincia()); + + DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica + .getIntPraticaId()); + + String committente = ""; + List soggetti = SoggettoLocalServiceUtil + .findByIntPratica_TipologiaSoggetto_Aggiuntivo_Rimosso(pratica.getIntPraticaId(), + TipoSoggettoUtil.COMMITTENTE, false, false); + if (soggetti.size() > 0) { + Soggetto soggetto = soggetti.get(0); + + // Bug 32771 + if (Validator.isNotNull(soggetto.getNome()) && Validator.isNotNull(soggetto.getCognome())) + committente = soggetto.getNome() + " " + soggetto.getCognome(); + else if (Validator.isNotNull(soggetto.getDenominazione())) + committente = soggetto.getDenominazione(); + else + committente = soggetto.getLegaleRap(); + } + + // anno, mese, settimana della data sorteggio + Calendar calSorteggio = Calendar.getInstance(); + calSorteggio.setTime(dtSorteggio); + + String anno = String.valueOf(calSorteggio.get(Calendar.YEAR)); + String mese = String.format("%02d", calSorteggio.get(Calendar.MONTH) + 1); + int settimana = calSorteggio.get(Calendar.WEEK_OF_YEAR); + + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setCompanyId(dettPratica.getCompanyId()); + serviceContext.setScopeGroupId(dettPratica.getGroupId()); + serviceContext.setUserId(dettPratica.getUserId()); + + SorteggioLocalServiceUtil.addSorteggio(pratica.getIntPraticaId(), dettPratica.getDettPraticaId(), + anno, mese, settimana, dtSorteggio, "", APERTO, "", numeroEstrazione++, + pratica.getNumeroProgetto(), committente, comune.getDenominazione(), + provincia.getProvincia(), false, pratica.getIntPraticaId(), false, serviceContext); + + ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.addControlloPratica( + pratica.getGroupId(), pratica.getUserId(), pratica.getIntPraticaId(), + dettPratica.getDettPraticaId(), true, serviceContext); + + long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong( + serviceContext.getCompanyId(), "conf.geniocivile.avviso.template.id.deposito.S"); + + AvvisoLocalServiceUtil.addAvviso(pratica.getIntPraticaId(), "Avviso di sorteggio", dtSorteggio, + AvvisoUtil.TIPO_AVVISO_DIRETTO, StatoPraticaConstants.SOTTOPOSTA_A_PARERE, + fileEntryIdTemplate, dettPratica.getDettPraticaId(), DettPratica.class.getName(), + controlloPratica.getControlloPraticaId(), serviceContext); + + IntPraticaLocalServiceUtil.updateIntPraticaSorteggio(pratica.getIntPraticaId(), dtSorteggio, + StatoPraticaConstants.SOTTOPOSTA_A_PARERE); + + } + } + + public static FileEntry getFileEntrySorteggio(long companyId, long groupId, Date dtSorteggio) + throws PortalException, SystemException { + + Company company = CompanyLocalServiceUtil.getCompany(companyId); + + Folder folder = DLAppLocalServiceUtil.getFolder(company.getGroupId(), + DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, FOLDER_SORTEGGIO); + String fileName = reportFileName(companyId, dtSorteggio); + + FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(groupId, folder.getFolderId(), fileName); + + return fileEntry; + } + + public static FileEntry getFileEntrySorteggio(long companyId, long groupId, int settimana, String anno) + throws PortalException, SystemException { + + Company company = CompanyLocalServiceUtil.getCompany(companyId); + + Folder folder = DLAppLocalServiceUtil.getFolder(company.getGroupId(), + DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, FOLDER_SORTEGGIO); + String fileName = reportFileName(companyId, anno, settimana); + + return DLAppLocalServiceUtil.getFileEntry(groupId, folder.getFolderId(), fileName); + } +} diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/PortosAdministrationPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/PortosAdministrationPortlet.java index 85873368..ce88b456 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/PortosAdministrationPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/PortosAdministrationPortlet.java @@ -2,13 +2,12 @@ package it.tref.liferay.portos.bo.portlet; import it.mwg.sismica.bo.util.PuliziaDatabase; import it.mwg.sismica.bo.util.SismicaUtil; +import it.mwg.sismica.bo.util.SorteggioPraticaUtil; import it.tref.liferay.portos.bo.model.ControlloPratica; import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.model.Sorteggio; import it.tref.liferay.portos.bo.model.Territorio; -import it.tref.liferay.portos.bo.service.AsseverazioneLocalServiceUtil; -import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; import it.tref.liferay.portos.bo.service.ConfigurazioneServiceUtil; import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; @@ -33,10 +32,8 @@ import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.WebKeys; -import com.liferay.portal.model.User; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContextFactory; -import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.theme.ThemeDisplay; import com.liferay.util.bridges.mvc.MVCPortlet; @@ -114,21 +111,17 @@ public class PortosAdministrationPortlet extends MVCPortlet { } public void lanciaSorteggio(ActionRequest actionRequest, ActionResponse actionResponse) { - ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); - List esito = null; + _log.info("Sorteggio lanciato manualmente"); try { - Date now = new Date(); - _log.info("Sorteggio lanciato manualmente"); - esito = SorteggioLocalServiceUtil.sorteggio(themeDisplay.getCompanyId(), now); - - } catch (Exception e) { + esito = SorteggioPraticaUtil.sorteggio(themeDisplay.getCompanyId(), new Date()); + } catch (PortalException | SystemException e) { _log.error("error", e); } + if (esito != null) actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); - // avvioWorkflowSorteggiate(); } public void testInterno(ActionRequest actionRequest, ActionResponse actionResponse) { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java index 035a8614..d9835fca 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java @@ -1,4 +1,3 @@ - package it.tref.liferay.portos.bo.scheduler; import it.tref.liferay.portos.bo.model.Collaudo; @@ -49,482 +48,510 @@ import com.liferay.portal.service.UserLocalServiceUtil; public class SchedulerPratiche implements MessageListener { - private static final Log _log = LogFactoryUtil.getLog(SchedulerPratiche.class); - - private static final Lock lock = new ReentrantLock(); - - private final int SIZE = 10; - - @Override - public void receive(Message message) throws MessageListenerException { - - if (lock.tryLock()) { - try { - - /* - * Fascicoli Senza progetto - */ - - int count = IntPraticaLocalServiceUtil.countFascicoliNotProgetto(); - - if (count > 0) { - - for (int cursor = 0; cursor <= count; cursor += SIZE) { + private static final Log _log = LogFactoryUtil.getLog(SchedulerPratiche.class); - List intPratiche = IntPraticaLocalServiceUtil.findFascicoliNotProgetto(cursor, cursor + SIZE); + private static final Lock lock = new ReentrantLock(); - for (IntPratica intPratica : intPratiche) { + private final int SIZE = 10; - try { + @Override + public void receive(Message message) throws MessageListenerException { - User user = UserLocalServiceUtil.getUser(intPratica.getUserId()); - PrincipalThreadLocal.setName(user.getUserId()); - PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user); - PermissionThreadLocal.setPermissionChecker(permissionChecker); + if (lock.tryLock()) { + try { - assegnaNumeroProgetto(intPratica); + /* + * Fascicoli Senza progetto + */ - } catch (Exception e) { - _log.error("Error", e); - } finally { - PermissionThreadLocal.setPermissionChecker(null); - PrincipalThreadLocal.setName(null); - } - } - } - } + int count = IntPraticaLocalServiceUtil.countFascicoliNotProgetto(); - /* - * Pratiche gestite ma senza protocollo - */ + if (count > 0) { - count = DettPraticaLocalServiceUtil.countPraticheCompleteNotProtocollo(); + for (int cursor = 0; cursor <= count; cursor += SIZE) { - if (count > 0) { + List intPratiche = IntPraticaLocalServiceUtil.findFascicoliNotProgetto( + cursor, cursor + SIZE); - for (int cursor = 0; cursor <= count; cursor += SIZE) { + for (IntPratica intPratica : intPratiche) { - List dettPratiche = - DettPraticaLocalServiceUtil.findPraticheCompleteNotProtocollo(cursor, cursor + SIZE); + try { - for (DettPratica dettPratica : dettPratiche) { + User user = UserLocalServiceUtil.getUser(intPratica.getUserId()); + PrincipalThreadLocal.setName(user.getUserId()); + PermissionChecker permissionChecker = PermissionCheckerFactoryUtil + .create(user); + PermissionThreadLocal.setPermissionChecker(permissionChecker); - try { + assegnaNumeroProgetto(intPratica); - User user = UserLocalServiceUtil.getUser(dettPratica.getUserId()); - PrincipalThreadLocal.setName(user.getUserId()); - PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user); - PermissionThreadLocal.setPermissionChecker(permissionChecker); + } catch (Exception e) { + _log.error("Error", e); + } finally { + PermissionThreadLocal.setPermissionChecker(null); + PrincipalThreadLocal.setName(null); + } + } + } + } - protocollazione(dettPratica.getCompanyId(), dettPratica.getGroupId(), dettPratica); + /* + * Pratiche gestite ma senza protocollo + */ - } catch (Exception e) { - _log.error("Error DettPraticaId=" + dettPratica.getDettPraticaId(), e); - } finally { - PermissionThreadLocal.setPermissionChecker(null); - PrincipalThreadLocal.setName(null); - } - } - } - } + count = DettPraticaLocalServiceUtil.countPraticheCompleteNotProtocollo(); - /* - * Fine Lavori complete ma senza protocollo - */ + if (count > 0) { - count = FineLavoriLocalServiceUtil.countFineLavoriCompleteNotProtocollo(); + for (int cursor = 0; cursor <= count; cursor += SIZE) { - if (count > 0) { + List dettPratiche = DettPraticaLocalServiceUtil + .findPraticheCompleteNotProtocollo(cursor, cursor + SIZE); - for (int cursor = 0; cursor <= count; cursor += SIZE) { + for (DettPratica dettPratica : dettPratiche) { - List fineLavoris = - FineLavoriLocalServiceUtil.findFineLavoriCompleteNotProtocollo(cursor, cursor + SIZE); + try { - for (FineLavori fineLavori : fineLavoris) { + User user = UserLocalServiceUtil.getUser(dettPratica.getUserId()); + PrincipalThreadLocal.setName(user.getUserId()); + PermissionChecker permissionChecker = PermissionCheckerFactoryUtil + .create(user); + PermissionThreadLocal.setPermissionChecker(permissionChecker); - try { + protocollazione(dettPratica.getCompanyId(), dettPratica.getGroupId(), + dettPratica); - User user = UserLocalServiceUtil.getUser(fineLavori.getUserId()); - PrincipalThreadLocal.setName(user.getUserId()); - PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user); - PermissionThreadLocal.setPermissionChecker(permissionChecker); + } catch (Exception e) { + _log.error("Error DettPraticaId=" + dettPratica.getDettPraticaId(), e); + } finally { + PermissionThreadLocal.setPermissionChecker(null); + PrincipalThreadLocal.setName(null); + } + } + } + } - protocollazione(fineLavori.getCompanyId(), fineLavori.getGroupId(), fineLavori); + /* + * Fine Lavori complete ma senza protocollo + */ - } catch (Exception e) { - _log.error("Error fineLavoriId="+fineLavori.getFineLavoriId(), e); - } finally { - PermissionThreadLocal.setPermissionChecker(null); - PrincipalThreadLocal.setName(null); - } - } - } - } + count = FineLavoriLocalServiceUtil.countFineLavoriCompleteNotProtocollo(); - /* - * Fine Lavori complete con protocollo non gestite - */ + if (count > 0) { - count = FineLavoriLocalServiceUtil.countFineLavoriCompleteNotGestite(); + for (int cursor = 0; cursor <= count; cursor += SIZE) { - if (count > 0) { + List fineLavoris = FineLavoriLocalServiceUtil + .findFineLavoriCompleteNotProtocollo(cursor, cursor + SIZE); - for (int cursor = 0; cursor <= count; cursor += SIZE) { + for (FineLavori fineLavori : fineLavoris) { - List fineLavoris = - FineLavoriLocalServiceUtil.findFineLavoriCompleteNotGestite(cursor, cursor + SIZE); + try { - for (FineLavori fineLavori : fineLavoris) { + User user = UserLocalServiceUtil.getUser(fineLavori.getUserId()); + PrincipalThreadLocal.setName(user.getUserId()); + PermissionChecker permissionChecker = PermissionCheckerFactoryUtil + .create(user); + PermissionThreadLocal.setPermissionChecker(permissionChecker); - try { + protocollazione(fineLavori.getCompanyId(), fineLavori.getGroupId(), + fineLavori); - User user = UserLocalServiceUtil.getUser(fineLavori.getUserId()); - PrincipalThreadLocal.setName(user.getUserId()); - PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user); - PermissionThreadLocal.setPermissionChecker(permissionChecker); - creaAvvisoVidimazione(fineLavori.getCompanyId(), fineLavori.getGroupId(), fineLavori.getUserId(), - fineLavori.getIntPraticaId(), fineLavori.getFineLavoriId(), FineLavori.class.getName()); + } catch (Exception e) { + _log.error("Error fineLavoriId=" + fineLavori.getFineLavoriId(), e); + } finally { + PermissionThreadLocal.setPermissionChecker(null); + PrincipalThreadLocal.setName(null); + } + } + } + } - fineLavori.setGestita(true); - FineLavoriLocalServiceUtil.updateFineLavori(fineLavori); + /* + * Fine Lavori complete con protocollo non gestite + */ - } catch (Exception e) { - _log.error("Error", e); - } finally { - PermissionThreadLocal.setPermissionChecker(null); - PrincipalThreadLocal.setName(null); - } - } - } - } - /* - * Collaudi complete ma senza protocollo - */ + count = FineLavoriLocalServiceUtil.countFineLavoriCompleteNotGestite(); - count = CollaudoLocalServiceUtil.countCollaudiCompletiNotProtocollo(); + if (count > 0) { - if (count > 0) { + for (int cursor = 0; cursor <= count; cursor += SIZE) { - for (int cursor = 0; cursor <= count; cursor += SIZE) { + List fineLavoris = FineLavoriLocalServiceUtil + .findFineLavoriCompleteNotGestite(cursor, cursor + SIZE); - List collaudi = CollaudoLocalServiceUtil.findCollaudiCompletiNotProtocollo(cursor, cursor + SIZE); + for (FineLavori fineLavori : fineLavoris) { - for (Collaudo collaudo : collaudi) { + try { - try { + User user = UserLocalServiceUtil.getUser(fineLavori.getUserId()); + PrincipalThreadLocal.setName(user.getUserId()); + PermissionChecker permissionChecker = PermissionCheckerFactoryUtil + .create(user); + PermissionThreadLocal.setPermissionChecker(permissionChecker); + creaAvvisoVidimazione(fineLavori.getCompanyId(), fineLavori.getGroupId(), + fineLavori.getUserId(), fineLavori.getIntPraticaId(), + fineLavori.getFineLavoriId(), FineLavori.class.getName()); - User user = UserLocalServiceUtil.getUser(collaudo.getUserId()); - PrincipalThreadLocal.setName(user.getUserId()); - PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user); - PermissionThreadLocal.setPermissionChecker(permissionChecker); + fineLavori.setGestita(true); + FineLavoriLocalServiceUtil.updateFineLavori(fineLavori); - protocollazione(collaudo.getCompanyId(), collaudo.getGroupId(), collaudo); + } catch (Exception e) { + _log.error("Error", e); + } finally { + PermissionThreadLocal.setPermissionChecker(null); + PrincipalThreadLocal.setName(null); + } + } + } + } + /* + * Collaudi complete ma senza protocollo + */ - } catch (Exception e) { - _log.error("Error collaudoId=" + collaudo.getCollaudoId(), e); - } finally { - PermissionThreadLocal.setPermissionChecker(null); - PrincipalThreadLocal.setName(null); - } - } - } - } - /* - * Collaudi complete con protocollo non gestiti - */ + count = CollaudoLocalServiceUtil.countCollaudiCompletiNotProtocollo(); - count = CollaudoLocalServiceUtil.countCollaudiCompletiNotGestiti(); + if (count > 0) { - if (count > 0) { + for (int cursor = 0; cursor <= count; cursor += SIZE) { - for (int cursor = 0; cursor <= count; cursor += SIZE) { + List collaudi = CollaudoLocalServiceUtil.findCollaudiCompletiNotProtocollo( + cursor, cursor + SIZE); - List collaudi = CollaudoLocalServiceUtil.findCollaudiCompletiNotGestiti(cursor, cursor + SIZE); + for (Collaudo collaudo : collaudi) { - for (Collaudo collaudo : collaudi) { + try { - try { + User user = UserLocalServiceUtil.getUser(collaudo.getUserId()); + PrincipalThreadLocal.setName(user.getUserId()); + PermissionChecker permissionChecker = PermissionCheckerFactoryUtil + .create(user); + PermissionThreadLocal.setPermissionChecker(permissionChecker); - User user = UserLocalServiceUtil.getUser(collaudo.getUserId()); - PrincipalThreadLocal.setName(user.getUserId()); - PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user); - PermissionThreadLocal.setPermissionChecker(permissionChecker); - creaAvvisoVidimazione(collaudo.getCompanyId(), collaudo.getGroupId(), collaudo.getUserId(), - collaudo.getIntPraticaId(), collaudo.getCollaudoId(), Collaudo.class.getName()); + protocollazione(collaudo.getCompanyId(), collaudo.getGroupId(), collaudo); - collaudo.setGestita(true); - CollaudoLocalServiceUtil.updateCollaudo(collaudo); + } catch (Exception e) { + _log.error("Error collaudoId=" + collaudo.getCollaudoId(), e); + } finally { + PermissionThreadLocal.setPermissionChecker(null); + PrincipalThreadLocal.setName(null); + } + } + } + } + /* + * Collaudi complete con protocollo non gestiti + */ - } catch (Exception e) { - _log.error("Error", e); - } finally { - PermissionThreadLocal.setPermissionChecker(null); - PrincipalThreadLocal.setName(null); - } - } - } - } + count = CollaudoLocalServiceUtil.countCollaudiCompletiNotGestiti(); - // generazioni documenti e avvio workflow - count = DettPraticaLocalServiceUtil.countPraticheCompleteNotGestite(); + if (count > 0) { - if (count > 0) { - - for (int cursor = 0; cursor <= count; cursor += SIZE) { - - List dettPratiche = - DettPraticaLocalServiceUtil.findPraticheCompleteNotGestite(cursor, cursor + SIZE); - - for (DettPratica dettPratica : dettPratiche) { - - try { - - User user = UserLocalServiceUtil.getUser(dettPratica.getUserId()); - PrincipalThreadLocal.setName(user.getUserId()); - PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user); - PermissionThreadLocal.setPermissionChecker(permissionChecker); + for (int cursor = 0; cursor <= count; cursor += SIZE) { - gestionePratica(dettPratica); - - } catch (Exception e) { - _log.error("Error", e); - } finally { - PermissionThreadLocal.setPermissionChecker(null); - PrincipalThreadLocal.setName(null); - } - } - } - } + List collaudi = CollaudoLocalServiceUtil.findCollaudiCompletiNotGestiti( + cursor, cursor + SIZE); + for (Collaudo collaudo : collaudi) { - // versionamento - count = DettPraticaLocalServiceUtil.countPraticheCompletateNonversionate(); + try { - if (count > 0) { + User user = UserLocalServiceUtil.getUser(collaudo.getUserId()); + PrincipalThreadLocal.setName(user.getUserId()); + PermissionChecker permissionChecker = PermissionCheckerFactoryUtil + .create(user); + PermissionThreadLocal.setPermissionChecker(permissionChecker); + creaAvvisoVidimazione(collaudo.getCompanyId(), collaudo.getGroupId(), + collaudo.getUserId(), collaudo.getIntPraticaId(), + collaudo.getCollaudoId(), Collaudo.class.getName()); - for (Company company : CompanyLocalServiceUtil.getCompanies()) { - String condition = - ConfigurazioneLocalServiceUtil.findByC_ChiaveString(company.getCompanyId(), - ConfigurazioneConstants.SCHEDULER_VERSIONING); - if (Boolean.parseBoolean(condition)) { + collaudo.setGestita(true); + CollaudoLocalServiceUtil.updateCollaudo(collaudo); + + } catch (Exception e) { + _log.error("Error", e); + } finally { + PermissionThreadLocal.setPermissionChecker(null); + PrincipalThreadLocal.setName(null); + } + } + } + } + + // generazioni documenti e avvio workflow + count = DettPraticaLocalServiceUtil.countPraticheCompleteNotGestite(); + + if (count > 0) { + + for (int cursor = 0; cursor <= count; cursor += SIZE) { + + List dettPratiche = DettPraticaLocalServiceUtil + .findPraticheCompleteNotGestite(cursor, cursor + SIZE); + + for (DettPratica dettPratica : dettPratiche) { + + try { + + User user = UserLocalServiceUtil.getUser(dettPratica.getUserId()); + PrincipalThreadLocal.setName(user.getUserId()); + PermissionChecker permissionChecker = PermissionCheckerFactoryUtil + .create(user); + PermissionThreadLocal.setPermissionChecker(permissionChecker); + + gestionePratica(dettPratica); + + } catch (Exception e) { + _log.error("Error", e); + } finally { + PermissionThreadLocal.setPermissionChecker(null); + PrincipalThreadLocal.setName(null); + } + } + } + } - for (int cursor = 0; cursor <= count; cursor += SIZE) { - - List dettPratiche = - DettPraticaLocalServiceUtil.findPraticheCompletateNonVersionate(cursor, cursor + SIZE); - - for (DettPratica dettPratica : dettPratiche) { - - try { - - DettPraticaServiceUtil.sendToVersioning(dettPratica.getDettPraticaId(), dettPratica.getCompanyId()); - - } catch (Exception e) { - _log.error("Error", e); - } finally { - PermissionThreadLocal.setPermissionChecker(null); - PrincipalThreadLocal.setName(null); - } - } - } - - } - } - - } - - } catch (SystemException e) { - _log.error("Error", e); - } finally { - lock.unlock(); - } - } - } - - private void creaAvvisoVidimazione(long companyId, long groupId, long userId, long intPraticaId, long classPk, - String className) throws SystemException, PortalException { - String descLong = StringPool.BLANK; - Date dtAvviso = new Date(); - String tipoAvviso = AvvisoUtil.TIPO_AVVISO_DIRETTO; - String tipoDocumento = StatoPraticaConstants.VIDIMATA; - String propertiesTemplateType = StatoPraticaConstants.VIDIMATA; - if(FineLavori.class.getName().equals(className)){ - propertiesTemplateType = StatoPraticaConstants.FINE_LAVORI; - } else if(Collaudo.class.getName().equals(className)){ - propertiesTemplateType = StatoPraticaConstants.COLLAUDO; - } else if(DettPratica.class.getName().equals(className)){ - DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(classPk); - if(TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO.equals(dettPratica.getTipoIntegrazione())){ - propertiesTemplateType = StatoPraticaConstants.VARIAZIONE_SOGGETTI; - } - } - String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(propertiesTemplateType); - long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, propertiesTemplate); - - long controlloPraticaId = 0l; - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(companyId); - serviceContext.setScopeGroupId(groupId); - serviceContext.setUserId(userId); - - AvvisoLocalServiceUtil.addAvviso(intPraticaId, descLong, dtAvviso, tipoAvviso, tipoDocumento, fileEntryIdTemplate, - classPk, className, controlloPraticaId, serviceContext); - } - - private IntPratica assegnaNumeroProgetto(IntPratica intPratica) throws PortalException, SystemException { - // in caso di errore successivo alla protocollazione salto questa operazione - if (Validator.isNull(intPratica.getNumeroProgetto())) { - - intPratica = IntPraticaLocalServiceUtil.addNumeroProgetto(intPratica.getIntPraticaId()); - } - return intPratica; - } - - public void gestionePratica(DettPratica dettPratica) throws Exception { - - ServiceContext serviceContext = getServiceContext(dettPratica); - - // protocollazione da servizio remoto - protocollazione(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), dettPratica); - - IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(dettPratica.getIntPraticaId()); - - intPratica = assegnaNumeroProgetto(intPratica); - - String tipoIntegrazione = dettPratica.getTipoIntegrazione(); - - // 1o Avviso di ricezione corretta o in errore della pratica - int count = AvvisoLocalServiceUtil.countAvvisoByClassPk_ClassName(dettPratica.getDettPraticaId(), DettPratica.class.getName()); - // in caso di errore non genere un nuovo avviso - if (count == 0) { - // tutte le integrazioni eccetto annulla valida - - if (Validator.isNotNull(tipoIntegrazione)) { - - if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equals(tipoIntegrazione)) { - // avviso pilotato per integrazioni - String stato = StatoPraticaConstants.INTEGRAZIONE_ACCETTATA; - AvvisoLocalServiceUtil.createStandardAvvisoPratica(dettPratica.getIntPraticaId(), stato, - dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext, - AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0l); - } else if (TipoIntegrazioneUtil.VARIANTE.equals(tipoIntegrazione)) { - // avviso pilotato per varianti - String stato = StatoPraticaConstants.VIDIMATA; - AvvisoLocalServiceUtil.createStandardAvvisoPratica(dettPratica.getIntPraticaId(), stato, - dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext, - AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0l); - } else if (TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO.equals(tipoIntegrazione)) { - - String propertiesTemplateType = StatoPraticaConstants.VARIAZIONE_SOGGETTI; - String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(propertiesTemplateType); - long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(serviceContext.getCompanyId(), propertiesTemplate); - - AvvisoLocalServiceUtil.addAvviso(dettPratica.getIntPraticaId(), StringPool.BLANK, new Date(), AvvisoUtil.TIPO_AVVISO_DIRETTO, StatoPraticaConstants.VIDIMATA, fileEntryIdTemplate, - dettPratica.getDettPraticaId(), DettPratica.class.getName(), 0l, serviceContext); - } - - } else { - // avviso standard da stato pratica - AvvisoLocalServiceUtil.createStandardAvvisoPratica(intPratica, dettPratica.getDettPraticaId(), - DettPratica.class.getName(), serviceContext, AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0l); - } - } - - // Avvio Workflow - if(!dettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO)){ - //ADT: bug id=7 gestione workflow - ControlloPratica cp=avvioWorkflow(dettPratica, dettPratica.getUserId(), serviceContext); - if (cp!=null) - ControlloPraticaLocalServiceUtil.gestioneWFVarianti(cp); - } - - - dettPratica = DettPraticaLocalServiceUtil.updateDettPraticaGestita(dettPratica.getDettPraticaId(), true); - DettPraticaLocalServiceUtil.updateAsset(dettPratica, null, true); - } - - private DettPratica protocollazione(long companyId, long groupId, DettPratica dettPratica) throws Exception { - - // in caso di errore successivo alla protocollazione salto questa operazione - if (Validator.isNull(dettPratica.getProtocollo())) { - - String protocollo = null; - - String title = dettPratica.getDettPraticaId() + "_" + System.currentTimeMillis(); - protocollo = ProtocollazioneUtil.protocollaArrivo(dettPratica, title); - if (Validator.isNull(protocollo)) { - throw new Exception("errore nella protocollazione pratica"); - } - - dettPratica = DettPraticaLocalServiceUtil.updateDettPraticaProtocollo(dettPratica.getDettPraticaId(), protocollo); - } - - return dettPratica; - } - - private FineLavori protocollazione(long companyId, long groupId, FineLavori fineLavori) throws Exception { - - // in caso di errore successivo alla protocollazione salto questa operazione - if (Validator.isNull(fineLavori.getProtocollo())) { - - - String protocollo = null; - - String title = fineLavori.getFineLavoriId() + "_" + System.currentTimeMillis(); - protocollo = ProtocollazioneUtil.protocollaArrivo(fineLavori, title); - if (Validator.isNull(protocollo)) { - throw new Exception("errore nella protocollazione fine lavori"); - } - - fineLavori = FineLavoriLocalServiceUtil.updateFineLavoriProtocollo(fineLavori.getFineLavoriId(), protocollo); - } - - return fineLavori; - } - - private Collaudo protocollazione(long companyId, long groupId, Collaudo collaudo) throws Exception { - - // in caso di errore successivo alla protocollazione salto questa operazione - if (Validator.isNull(collaudo.getProtocollo())) { - - - String protocollo = null; - - String title = collaudo.getCollaudoId() + "_" + System.currentTimeMillis(); - protocollo = ProtocollazioneUtil.protocollaArrivo(collaudo, title); - if (Validator.isNull(protocollo)) { - throw new Exception("errore nella protocollazione collaudo"); - } - - collaudo = CollaudoLocalServiceUtil.updateCollaudoProtocollo(collaudo.getCollaudoId(), protocollo); - } - - return collaudo; - } - - private ControlloPratica avvioWorkflow(DettPratica dettPratica, long userId, ServiceContext serviceContext) throws Exception { - if (dettPratica.isCompleta() && !dettPratica.isGestita()) { - IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(dettPratica.getIntPraticaId()); - Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); - if (WorkflowUtil.needToStartWorkflow(dettPratica)) { - boolean updateFlagControlloObbligatorio = true; - //ADT: bug id=7 gestione workflow - ControlloPratica cp=ControlloPraticaLocalServiceUtil.addControlloPratica(territorio.getGroupId(), userId, - intPratica.getIntPraticaId(), dettPratica.getDettPraticaId(), updateFlagControlloObbligatorio, - serviceContext); - return cp; - } - } - return null; - } - - private ServiceContext getServiceContext(DettPratica dettPratica) { - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(dettPratica.getCompanyId()); - serviceContext.setScopeGroupId(dettPratica.getGroupId()); - serviceContext.setUserId(dettPratica.getUserId()); - return serviceContext; - } + // versionamento + count = DettPraticaLocalServiceUtil.countPraticheCompletateNonversionate(); + + if (count > 0) { + + for (Company company : CompanyLocalServiceUtil.getCompanies()) { + String condition = ConfigurazioneLocalServiceUtil.findByC_ChiaveString( + company.getCompanyId(), ConfigurazioneConstants.SCHEDULER_VERSIONING); + if (Boolean.parseBoolean(condition)) { + + for (int cursor = 0; cursor <= count; cursor += SIZE) { + + List dettPratiche = DettPraticaLocalServiceUtil + .findPraticheCompletateNonVersionate(cursor, cursor + SIZE); + + for (DettPratica dettPratica : dettPratiche) { + + try { + + DettPraticaServiceUtil.sendToVersioning( + dettPratica.getDettPraticaId(), dettPratica.getCompanyId()); + + } catch (Exception e) { + _log.error("Error", e); + } finally { + PermissionThreadLocal.setPermissionChecker(null); + PrincipalThreadLocal.setName(null); + } + } + } + + } + } + + } + + } catch (SystemException e) { + _log.error("Error", e); + } finally { + lock.unlock(); + } + } + } + + private void creaAvvisoVidimazione(long companyId, long groupId, long userId, long intPraticaId, + long classPk, String className) throws SystemException, PortalException { + String descLong = StringPool.BLANK; + Date dtAvviso = new Date(); + String tipoAvviso = AvvisoUtil.TIPO_AVVISO_DIRETTO; + String tipoDocumento = StatoPraticaConstants.VIDIMATA; + String propertiesTemplateType = StatoPraticaConstants.VIDIMATA; + if (FineLavori.class.getName().equals(className)) { + propertiesTemplateType = StatoPraticaConstants.FINE_LAVORI; + } else if (Collaudo.class.getName().equals(className)) { + propertiesTemplateType = StatoPraticaConstants.COLLAUDO; + } else if (DettPratica.class.getName().equals(className)) { + DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(classPk); + if (TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO.equals(dettPratica.getTipoIntegrazione())) { + propertiesTemplateType = StatoPraticaConstants.VARIAZIONE_SOGGETTI; + } + } + String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get( + propertiesTemplateType); + long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, + propertiesTemplate); + + long controlloPraticaId = 0l; + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setCompanyId(companyId); + serviceContext.setScopeGroupId(groupId); + serviceContext.setUserId(userId); + + AvvisoLocalServiceUtil.addAvviso(intPraticaId, descLong, dtAvviso, tipoAvviso, tipoDocumento, + fileEntryIdTemplate, classPk, className, controlloPraticaId, serviceContext); + } + + private IntPratica assegnaNumeroProgetto(IntPratica intPratica) throws PortalException, SystemException { + // in caso di errore successivo alla protocollazione salto questa + // operazione + if (Validator.isNull(intPratica.getNumeroProgetto())) { + + intPratica = IntPraticaLocalServiceUtil.addNumeroProgetto(intPratica.getIntPraticaId()); + } + return intPratica; + } + + public void gestionePratica(DettPratica dettPratica) throws Exception { + + ServiceContext serviceContext = getServiceContext(dettPratica); + + // protocollazione da servizio remoto + protocollazione(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), dettPratica); + + IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(dettPratica.getIntPraticaId()); + + intPratica = assegnaNumeroProgetto(intPratica); + + String tipoIntegrazione = dettPratica.getTipoIntegrazione(); + + // 1o Avviso di ricezione corretta o in errore della pratica + int count = AvvisoLocalServiceUtil.countAvvisoByClassPk_ClassName(dettPratica.getDettPraticaId(), + DettPratica.class.getName()); + // in caso di errore non genere un nuovo avviso + if (count == 0) { + // tutte le integrazioni eccetto annulla valida + + if (Validator.isNotNull(tipoIntegrazione)) { + + if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equals(tipoIntegrazione)) { + // avviso pilotato per integrazioni + String stato = StatoPraticaConstants.INTEGRAZIONE_ACCETTATA; + AvvisoLocalServiceUtil.createStandardAvvisoPratica(dettPratica.getIntPraticaId(), stato, + dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext, + AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0l); + } else if (TipoIntegrazioneUtil.VARIANTE.equals(tipoIntegrazione)) { + // avviso pilotato per varianti + String stato = StatoPraticaConstants.VIDIMATA; + AvvisoLocalServiceUtil.createStandardAvvisoPratica(dettPratica.getIntPraticaId(), stato, + dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext, + AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0l); + } else if (TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO.equals(tipoIntegrazione)) { + + String propertiesTemplateType = StatoPraticaConstants.VARIAZIONE_SOGGETTI; + String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get( + propertiesTemplateType); + long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong( + serviceContext.getCompanyId(), propertiesTemplate); + + AvvisoLocalServiceUtil.addAvviso(dettPratica.getIntPraticaId(), StringPool.BLANK, + new Date(), AvvisoUtil.TIPO_AVVISO_DIRETTO, StatoPraticaConstants.VIDIMATA, + fileEntryIdTemplate, dettPratica.getDettPraticaId(), DettPratica.class.getName(), + 0l, serviceContext); + } + + } else { + // avviso standard da stato pratica + AvvisoLocalServiceUtil.createStandardAvvisoPratica(intPratica, + dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext, + AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0l); + } + } + + // Avvio Workflow + if (!dettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO)) { + // ADT: bug id=7 gestione workflow + ControlloPratica cp = avvioWorkflow(dettPratica, dettPratica.getUserId(), serviceContext); + if (cp != null) + ControlloPraticaLocalServiceUtil.gestioneWFVarianti(cp); + } + + dettPratica = DettPraticaLocalServiceUtil.updateDettPraticaGestita(dettPratica.getDettPraticaId(), + true); + DettPraticaLocalServiceUtil.updateAsset(dettPratica, null, true); + } + + private DettPratica protocollazione(long companyId, long groupId, DettPratica dettPratica) + throws Exception { + + // in caso di errore successivo alla protocollazione salto questa + // operazione + if (Validator.isNull(dettPratica.getProtocollo())) { + + String protocollo = null; + + String title = dettPratica.getDettPraticaId() + "_" + System.currentTimeMillis(); + protocollo = ProtocollazioneUtil.protocollaArrivo(dettPratica, title); + if (Validator.isNull(protocollo)) { + throw new Exception("errore nella protocollazione pratica"); + } + + dettPratica = DettPraticaLocalServiceUtil.updateDettPraticaProtocollo( + dettPratica.getDettPraticaId(), protocollo); + } + + return dettPratica; + } + + private FineLavori protocollazione(long companyId, long groupId, FineLavori fineLavori) throws Exception { + + // in caso di errore successivo alla protocollazione salto questa + // operazione + if (Validator.isNull(fineLavori.getProtocollo())) { + + String protocollo = null; + + String title = fineLavori.getFineLavoriId() + "_" + System.currentTimeMillis(); + protocollo = ProtocollazioneUtil.protocollaArrivo(fineLavori, title); + if (Validator.isNull(protocollo)) { + throw new Exception("errore nella protocollazione fine lavori"); + } + + fineLavori = FineLavoriLocalServiceUtil.updateFineLavoriProtocollo(fineLavori.getFineLavoriId(), + protocollo); + } + + return fineLavori; + } + + private Collaudo protocollazione(long companyId, long groupId, Collaudo collaudo) throws Exception { + + // in caso di errore successivo alla protocollazione salto questa + // operazione + if (Validator.isNull(collaudo.getProtocollo())) { + + String protocollo = null; + + String title = collaudo.getCollaudoId() + "_" + System.currentTimeMillis(); + protocollo = ProtocollazioneUtil.protocollaArrivo(collaudo, title); + if (Validator.isNull(protocollo)) { + throw new Exception("errore nella protocollazione collaudo"); + } + + collaudo = CollaudoLocalServiceUtil + .updateCollaudoProtocollo(collaudo.getCollaudoId(), protocollo); + } + + return collaudo; + } + + private ControlloPratica avvioWorkflow(DettPratica dettPratica, long userId, ServiceContext serviceContext) + throws Exception { + if (dettPratica.isCompleta() && !dettPratica.isGestita()) { + IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(dettPratica.getIntPraticaId()); + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); + if (WorkflowUtil.needToStartWorkflow(dettPratica)) { + boolean updateFlagControlloObbligatorio = true; + // ADT: bug id=7 gestione workflow + ControlloPratica cp = ControlloPraticaLocalServiceUtil.addControlloPratica( + territorio.getGroupId(), userId, intPratica.getIntPraticaId(), + dettPratica.getDettPraticaId(), updateFlagControlloObbligatorio, serviceContext); + return cp; + } + } + return null; + } + + private ServiceContext getServiceContext(DettPratica dettPratica) { + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setCompanyId(dettPratica.getCompanyId()); + serviceContext.setScopeGroupId(dettPratica.getGroupId()); + serviceContext.setUserId(dettPratica.getUserId()); + return serviceContext; + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerSorteggio.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerSorteggio.java deleted file mode 100644 index 7ce188a9..00000000 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerSorteggio.java +++ /dev/null @@ -1,155 +0,0 @@ -package it.tref.liferay.portos.bo.scheduler; - -import it.tref.liferay.portos.bo.model.ControlloPratica; -import it.tref.liferay.portos.bo.model.DettPratica; -import it.tref.liferay.portos.bo.model.IntPratica; -import it.tref.liferay.portos.bo.model.Territorio; -import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; -import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; -import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; -import it.tref.liferay.portos.bo.service.SorteggioLocalServiceUtil; -import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; -import it.tref.liferay.portos.bo.util.SorteggioPraticaUtil; - -import java.util.Date; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -import com.liferay.portal.kernel.log.Log; -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.messaging.Message; -import com.liferay.portal.kernel.messaging.MessageListener; -import com.liferay.portal.kernel.messaging.MessageListenerException; -import com.liferay.portal.model.Company; -import com.liferay.portal.service.CompanyLocalServiceUtil; -import com.liferay.portal.service.ServiceContext; -import com.liferay.util.portlet.PortletProps; - -public class SchedulerSorteggio implements MessageListener { - - private static final Log _log = LogFactoryUtil.getLog(SchedulerSorteggio.class); - - private static final Lock lock = new ReentrantLock(); - - @Override - public void receive(Message message) throws MessageListenerException { - if (lock.tryLock()) { - sorteggio(); - lock.unlock(); - } - } - - private void sorteggio() { - - try { - - String defaultCompany = PortletProps.get("portos.default.company"); - for (Company company : CompanyLocalServiceUtil.getCompanies()) { - long companyId = company.getCompanyId(); - Date now = new Date(); - - if (SorteggioPraticaUtil.isGiornoSorteggio(companyId, now)) { -// _log.info("È giorno di sorteggio per la compagnia " + companyId); -// SorteggioLocalServiceUtil.sorteggio(companyId, now); - } - - } - } catch (Exception e) { - _log.error("error", e); - } - } - - private void avvioWorkflowSorteggiate() { - - try { - // int count = - // SorteggioLocalServiceUtil.countDettPraticaWorkflowNonAvviato(); - // if (count > 0) { - // for (int cursor = 0; cursor <= count; cursor += SIZE) { - List dettPraticaIds = SorteggioLocalServiceUtil.getDettPraticaWorkflowNonAvviato(-1, -1); - for (Long dettPraticaId : dettPraticaIds) { - DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(dettPraticaId); - long intPraticaId = dettPratica.getIntPraticaId(); - ServiceContext serviceContext = getServiceContext(dettPratica); - avvioWorkflow(intPraticaId, dettPratica, serviceContext); - } - // } - // } - } catch (Exception e) { - _log.error("error", e); - } - } - - // TODO sanatoriaRimossa - // private void avvioWorkflowSanatoriaDepositoOpereNonConformi() { - // try { - // int count = - // WorkflowUtil.countIntPraticaIdsPerAvvioWorkflowSanatoriaDepositoOpereNonConformi(); - // if (count > 0) { - // for (int cursor = 0; cursor <= count; cursor += SIZE) { - // List intPraticaIds = - // WorkflowUtil.findIntPraticaIdsPerAvvioWorkflowSanatoriaDepositoOpereNonConformi(cursor, - // cursor - // + SIZE); - // for (Long intPraticaId : intPraticaIds) { - // DettPratica dettPratica = - // DettPraticaLocalServiceUtil.getLastDettPratica(intPraticaId); - // ServiceContext serviceContext = getServiceContext(dettPratica); - // avvioWorkflow(intPraticaId, dettPratica, serviceContext); - // } - // } - // } - // } catch (Exception e) { - // _log.error("error", e); - // } - // } - // - // private void avvioWorkflowSanatoriaDepositoOpereConformi() { - // try { - // int count = - // WorkflowUtil.countIntPraticaIdsPerAvvioWorkflowSanatoriaDepositoOpereConformi(); - // if (count > 0) { - // for (int cursor = 0; cursor <= count; cursor += SIZE) { - // List intPraticaIds = - // WorkflowUtil.findIntPraticaIdsPerAvvioWorkflowSanatoriaDepositoOpereConformi(cursor, - // cursor + - // SIZE); - // for (Long intPraticaId : intPraticaIds) { - // DettPratica dettPratica = - // DettPraticaLocalServiceUtil.getLastDettPratica(intPraticaId); - // ServiceContext serviceContext = getServiceContext(dettPratica); - // avvioWorkflow(intPraticaId, dettPratica, serviceContext); - // } - // } - // } - // } catch (Exception e) { - // _log.error("error", e); - // } - // } - - private void avvioWorkflow(long intPraticaId, DettPratica dettPratica, ServiceContext serviceContext) - throws Exception { - - long userId = dettPratica.getUserId(); - IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(dettPratica.getIntPraticaId()); - Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); - ControlloPratica cp = ControlloPraticaLocalServiceUtil.addControlloPratica(territorio.getGroupId(), - userId, intPratica.getIntPraticaId(), dettPratica.getDettPraticaId(), false, serviceContext); - - // ADT: bug id=7 gestione workflow - ControlloPraticaLocalServiceUtil.gestioneWFVarianti(cp); - - } - - private ServiceContext getServiceContext(DettPratica dettPratica) { - - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(dettPratica.getCompanyId()); - serviceContext.setScopeGroupId(dettPratica.getGroupId()); - serviceContext.setUserId(dettPratica.getUserId()); - return serviceContext; - } - -} diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/SorteggioLocalServiceClpInvoker.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/SorteggioLocalServiceClpInvoker.java index 84ecab15..ed41f713 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/SorteggioLocalServiceClpInvoker.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/SorteggioLocalServiceClpInvoker.java @@ -267,22 +267,18 @@ public class SorteggioLocalServiceClpInvoker { _methodParameterTypes225 = new String[] { "long" }; - _methodName226 = "sorteggio"; + _methodName226 = "search"; - _methodParameterTypes226 = new String[] { "long", "java.util.Date" }; - - _methodName227 = "search"; - - _methodParameterTypes227 = new String[] { + _methodParameterTypes226 = new String[] { "java.lang.Long", "java.lang.String", "java.lang.String", "int", "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.Long", "java.lang.String", "int", "int" }; - _methodName228 = "count"; + _methodName227 = "count"; - _methodParameterTypes228 = new String[] { + _methodParameterTypes227 = new String[] { "java.lang.Long", "java.lang.String", "java.lang.String", "int", "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.Long", "java.lang.String" @@ -610,12 +606,6 @@ public class SorteggioLocalServiceClpInvoker { if (_methodName226.equals(name) && Arrays.deepEquals(_methodParameterTypes226, parameterTypes)) { - return SorteggioLocalServiceUtil.sorteggio(((Long)arguments[0]).longValue(), - (java.util.Date)arguments[1]); - } - - if (_methodName227.equals(name) && - Arrays.deepEquals(_methodParameterTypes227, parameterTypes)) { return SorteggioLocalServiceUtil.search((java.lang.Long)arguments[0], (java.lang.String)arguments[1], (java.lang.String)arguments[2], ((Integer)arguments[3]).intValue(), @@ -626,8 +616,8 @@ public class SorteggioLocalServiceClpInvoker { ((Integer)arguments[11]).intValue()); } - if (_methodName228.equals(name) && - Arrays.deepEquals(_methodParameterTypes228, parameterTypes)) { + if (_methodName227.equals(name) && + Arrays.deepEquals(_methodParameterTypes227, parameterTypes)) { return SorteggioLocalServiceUtil.count((java.lang.Long)arguments[0], (java.lang.String)arguments[1], (java.lang.String)arguments[2], ((Integer)arguments[3]).intValue(), @@ -735,6 +725,4 @@ public class SorteggioLocalServiceClpInvoker { private String[] _methodParameterTypes226; private String _methodName227; private String[] _methodParameterTypes227; - private String _methodName228; - private String[] _methodParameterTypes228; } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java index 3236a338..6e500aa8 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java @@ -116,14 +116,21 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl { } String propertiesTemplate = null; + String tipoProcedura = intPratica.getTipoProcedura(); switch (statoPratica) { case StatoPraticaConstants.VIDIMATA: - String tipoProcedura = intPratica.getTipoProcedura(); if (null == tipoProcedura) tipoProcedura = Constants.PROCEDURA_A; propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get( "DP" + tipoProcedura); break; + case StatoPraticaConstants.SOTTOPOSTA_A_PARERE: + if (Validator.isNull(tipoProcedura) || tipoProcedura.equalsIgnoreCase(Constants.PROCEDURA_A)) { + propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(statoPratica); + } else { + propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get("DPPS"); + } + break; default: propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(statoPratica); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/SorteggioLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/SorteggioLocalServiceImpl.java index 515258c1..9f27cd47 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/SorteggioLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/SorteggioLocalServiceImpl.java @@ -12,9 +12,9 @@ package it.tref.liferay.portos.bo.service.impl; +import it.mwg.sismica.bo.util.SorteggioPraticaUtil; import it.tref.liferay.portos.bo.model.Sorteggio; import it.tref.liferay.portos.bo.service.base.SorteggioLocalServiceBaseImpl; -import it.tref.liferay.portos.bo.util.SorteggioPraticaUtil; import java.util.Date; import java.util.List; @@ -390,12 +390,6 @@ public class SorteggioLocalServiceImpl extends SorteggioLocalServiceBaseImpl { } - public List sorteggio(long companyId, Date dtSorteggio) throws Exception { - - return SorteggioPraticaUtil.sorteggio(companyId, dtSorteggio); - - } - // Bug 32653 public List search(Long groupId, String anno, String mese, int settimana, String committente, String tecnico, String comune, String pratica, Long numeroEstrazione, String provincia, diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AllegatoManualePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AllegatoManualePersistenceImpl.java index b040f227..5c96356f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AllegatoManualePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AllegatoManualePersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchAllegatoManualeException; import it.tref.liferay.portos.bo.model.AllegatoManuale; import it.tref.liferay.portos.bo.model.impl.AllegatoManualeImpl; import it.tref.liferay.portos.bo.model.impl.AllegatoManualeModelImpl; +import it.tref.liferay.portos.bo.service.persistence.AllegatoManualePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AsseverazionePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AsseverazionePersistenceImpl.java index 63caa01d..15633d6f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AsseverazionePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AsseverazionePersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchAsseverazioneException; import it.tref.liferay.portos.bo.model.Asseverazione; import it.tref.liferay.portos.bo.model.impl.AsseverazioneImpl; import it.tref.liferay.portos.bo.model.impl.AsseverazioneModelImpl; +import it.tref.liferay.portos.bo.service.persistence.AsseverazionePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AvvisoPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AvvisoPersistenceImpl.java index b95c271d..38e33edc 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AvvisoPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/AvvisoPersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchAvvisoException; import it.tref.liferay.portos.bo.model.Avviso; import it.tref.liferay.portos.bo.model.impl.AvvisoImpl; import it.tref.liferay.portos.bo.model.impl.AvvisoModelImpl; +import it.tref.liferay.portos.bo.service.persistence.AvvisoPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/CollaudoPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/CollaudoPersistenceImpl.java index a0e6a43b..4ce032ca 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/CollaudoPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/CollaudoPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchCollaudoException; import it.tref.liferay.portos.bo.model.Collaudo; import it.tref.liferay.portos.bo.model.impl.CollaudoImpl; import it.tref.liferay.portos.bo.model.impl.CollaudoModelImpl; +import it.tref.liferay.portos.bo.service.persistence.CollaudoPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunePersistenceImpl.java index b0b64b21..4a23bffd 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunePersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchComuneException; import it.tref.liferay.portos.bo.model.Comune; import it.tref.liferay.portos.bo.model.impl.ComuneImpl; import it.tref.liferay.portos.bo.model.impl.ComuneModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ComunePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunicazionePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunicazionePersistenceImpl.java index 0b7f9ee2..f5b8166f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunicazionePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ComunicazionePersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchComunicazioneException; import it.tref.liferay.portos.bo.model.Comunicazione; import it.tref.liferay.portos.bo.model.impl.ComunicazioneImpl; import it.tref.liferay.portos.bo.model.impl.ComunicazioneModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ComunicazionePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ConfigurazionePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ConfigurazionePersistenceImpl.java index 66507dd0..32809343 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ConfigurazionePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ConfigurazionePersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchConfigurazioneException; import it.tref.liferay.portos.bo.model.Configurazione; import it.tref.liferay.portos.bo.model.impl.ConfigurazioneImpl; import it.tref.liferay.portos.bo.model.impl.ConfigurazioneModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ConfigurazionePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ControlloPraticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ControlloPraticaPersistenceImpl.java index 48cf51eb..a4fa6f91 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ControlloPraticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ControlloPraticaPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchControlloPraticaException; import it.tref.liferay.portos.bo.model.ControlloPratica; import it.tref.liferay.portos.bo.model.impl.ControlloPraticaImpl; import it.tref.liferay.portos.bo.model.impl.ControlloPraticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ControlloPraticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DelegaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DelegaPersistenceImpl.java index 402cecd0..8c56fb32 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DelegaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DelegaPersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchDelegaException; import it.tref.liferay.portos.bo.model.Delega; import it.tref.liferay.portos.bo.model.impl.DelegaImpl; import it.tref.liferay.portos.bo.model.impl.DelegaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.DelegaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DettPraticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DettPraticaPersistenceImpl.java index 6c8a6a04..1c6e2534 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DettPraticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DettPraticaPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchDettPraticaException; import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.impl.DettPraticaImpl; import it.tref.liferay.portos.bo.model.impl.DettPraticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.DettPraticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocAggiuntivaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocAggiuntivaPersistenceImpl.java index 649a5476..c25ae1dc 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocAggiuntivaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocAggiuntivaPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchDocAggiuntivaException; import it.tref.liferay.portos.bo.model.DocAggiuntiva; import it.tref.liferay.portos.bo.model.impl.DocAggiuntivaImpl; import it.tref.liferay.portos.bo.model.impl.DocAggiuntivaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.DocAggiuntivaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocPraticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocPraticaPersistenceImpl.java index 42630357..255330f7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocPraticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/DocPraticaPersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchDocPraticaException; import it.tref.liferay.portos.bo.model.DocPratica; import it.tref.liferay.portos.bo.model.impl.DocPraticaImpl; import it.tref.liferay.portos.bo.model.impl.DocPraticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.DocPraticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/FineLavoriPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/FineLavoriPersistenceImpl.java index a5f79405..7ba24480 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/FineLavoriPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/FineLavoriPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchFineLavoriException; import it.tref.liferay.portos.bo.model.FineLavori; import it.tref.liferay.portos.bo.model.impl.FineLavoriImpl; import it.tref.liferay.portos.bo.model.impl.FineLavoriModelImpl; +import it.tref.liferay.portos.bo.service.persistence.FineLavoriPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/HistoryWorkflowActionPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/HistoryWorkflowActionPersistenceImpl.java index ad50d7ea..f80406ab 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/HistoryWorkflowActionPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/HistoryWorkflowActionPersistenceImpl.java @@ -42,6 +42,7 @@ import it.tref.liferay.portos.bo.NoSuchHistoryWorkflowActionException; import it.tref.liferay.portos.bo.model.HistoryWorkflowAction; import it.tref.liferay.portos.bo.model.impl.HistoryWorkflowActionImpl; import it.tref.liferay.portos.bo.model.impl.HistoryWorkflowActionModelImpl; +import it.tref.liferay.portos.bo.service.persistence.HistoryWorkflowActionPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IUVPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IUVPersistenceImpl.java index a6ba54ac..6f469f0e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IUVPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IUVPersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchIUVException; import it.tref.liferay.portos.bo.model.IUV; import it.tref.liferay.portos.bo.model.impl.IUVImpl; import it.tref.liferay.portos.bo.model.impl.IUVModelImpl; +import it.tref.liferay.portos.bo.service.persistence.IUVPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/InfoFascicoloPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/InfoFascicoloPersistenceImpl.java index 12f22a0a..b85535de 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/InfoFascicoloPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/InfoFascicoloPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchInfoFascicoloException; import it.tref.liferay.portos.bo.model.InfoFascicolo; import it.tref.liferay.portos.bo.model.impl.InfoFascicoloImpl; import it.tref.liferay.portos.bo.model.impl.InfoFascicoloModelImpl; +import it.tref.liferay.portos.bo.service.persistence.InfoFascicoloPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IntPraticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IntPraticaPersistenceImpl.java index 307036e1..ee52c9b7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IntPraticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/IntPraticaPersistenceImpl.java @@ -48,6 +48,7 @@ import it.tref.liferay.portos.bo.NoSuchIntPraticaException; import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.model.impl.IntPraticaImpl; import it.tref.liferay.portos.bo.model.impl.IntPraticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.IntPraticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/PagamentoPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/PagamentoPersistenceImpl.java index 8dbf29df..ee3b3b9b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/PagamentoPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/PagamentoPersistenceImpl.java @@ -46,6 +46,7 @@ import it.tref.liferay.portos.bo.NoSuchPagamentoException; import it.tref.liferay.portos.bo.model.Pagamento; import it.tref.liferay.portos.bo.model.impl.PagamentoImpl; import it.tref.liferay.portos.bo.model.impl.PagamentoModelImpl; +import it.tref.liferay.portos.bo.service.persistence.PagamentoPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ParereGeologoPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ParereGeologoPersistenceImpl.java index c6ce3907..e4133c60 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ParereGeologoPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ParereGeologoPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchParereGeologoException; import it.tref.liferay.portos.bo.model.ParereGeologo; import it.tref.liferay.portos.bo.model.impl.ParereGeologoImpl; import it.tref.liferay.portos.bo.model.impl.ParereGeologoModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ParereGeologoPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ProvinciaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ProvinciaPersistenceImpl.java index daa33e1b..2c7a846f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ProvinciaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/ProvinciaPersistenceImpl.java @@ -43,6 +43,7 @@ import it.tref.liferay.portos.bo.NoSuchProvinciaException; import it.tref.liferay.portos.bo.model.Provincia; import it.tref.liferay.portos.bo.model.impl.ProvinciaImpl; import it.tref.liferay.portos.bo.model.impl.ProvinciaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.ProvinciaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SoggettoPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SoggettoPersistenceImpl.java index 29c4a390..ef2db5f2 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SoggettoPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SoggettoPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchSoggettoException; import it.tref.liferay.portos.bo.model.Soggetto; import it.tref.liferay.portos.bo.model.impl.SoggettoImpl; import it.tref.liferay.portos.bo.model.impl.SoggettoModelImpl; +import it.tref.liferay.portos.bo.service.persistence.SoggettoPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SorteggioPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SorteggioPersistenceImpl.java index ec8a983f..fc566b28 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SorteggioPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/SorteggioPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchSorteggioException; import it.tref.liferay.portos.bo.model.Sorteggio; import it.tref.liferay.portos.bo.model.impl.SorteggioImpl; import it.tref.liferay.portos.bo.model.impl.SorteggioModelImpl; +import it.tref.liferay.portos.bo.service.persistence.SorteggioPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/StoricoSoggettoPraticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/StoricoSoggettoPraticaPersistenceImpl.java index 78333501..0c095d3d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/StoricoSoggettoPraticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/StoricoSoggettoPraticaPersistenceImpl.java @@ -42,6 +42,7 @@ import it.tref.liferay.portos.bo.NoSuchStoricoSoggettoPraticaException; import it.tref.liferay.portos.bo.model.StoricoSoggettoPratica; import it.tref.liferay.portos.bo.model.impl.StoricoSoggettoPraticaImpl; import it.tref.liferay.portos.bo.model.impl.StoricoSoggettoPraticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.StoricoSoggettoPraticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TempisticaPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TempisticaPersistenceImpl.java index 720078c4..252fc452 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TempisticaPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TempisticaPersistenceImpl.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.NoSuchTempisticaException; import it.tref.liferay.portos.bo.model.Tempistica; import it.tref.liferay.portos.bo.model.impl.TempisticaImpl; import it.tref.liferay.portos.bo.model.impl.TempisticaModelImpl; +import it.tref.liferay.portos.bo.service.persistence.TempisticaPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TerritorioPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TerritorioPersistenceImpl.java index a9c7f7d5..c8e0dee9 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TerritorioPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/TerritorioPersistenceImpl.java @@ -44,6 +44,7 @@ import it.tref.liferay.portos.bo.NoSuchTerritorioException; import it.tref.liferay.portos.bo.model.Territorio; import it.tref.liferay.portos.bo.model.impl.TerritorioImpl; import it.tref.liferay.portos.bo.model.impl.TerritorioModelImpl; +import it.tref.liferay.portos.bo.service.persistence.TerritorioPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/UtentePortosPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/UtentePortosPersistenceImpl.java index 89f06b61..83b7ed61 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/UtentePortosPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/persistence/UtentePortosPersistenceImpl.java @@ -43,6 +43,7 @@ import it.tref.liferay.portos.bo.NoSuchUtentePortosException; import it.tref.liferay.portos.bo.model.UtentePortos; import it.tref.liferay.portos.bo.model.impl.UtentePortosImpl; import it.tref.liferay.portos.bo.model.impl.UtentePortosModelImpl; +import it.tref.liferay.portos.bo.service.persistence.UtentePortosPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/SorteggioPraticaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/SorteggioPraticaUtil.java deleted file mode 100644 index 67249713..00000000 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/util/SorteggioPraticaUtil.java +++ /dev/null @@ -1,753 +0,0 @@ -package it.tref.liferay.portos.bo.util; - -import it.tref.liferay.portos.bo.model.Comune; -import it.tref.liferay.portos.bo.model.ControlloPratica; -import it.tref.liferay.portos.bo.model.DettPratica; -import it.tref.liferay.portos.bo.model.IntPratica; -import it.tref.liferay.portos.bo.model.Provincia; -import it.tref.liferay.portos.bo.model.Soggetto; -import it.tref.liferay.portos.bo.model.Sorteggio; -import it.tref.liferay.portos.bo.model.Territorio; -import it.tref.liferay.portos.bo.report.builder.bean.ReportSorteggioBean; -import it.tref.liferay.portos.bo.report.builder.builder.ReportSorteggioBeanBuilder; -import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; -import it.tref.liferay.portos.bo.service.ComuneLocalServiceUtil; -import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; -import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; -import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; -import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; -import it.tref.liferay.portos.bo.service.ProvinciaLocalServiceUtil; -import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil; -import it.tref.liferay.portos.bo.service.SorteggioLocalServiceUtil; -import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; -import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; -import it.tref.liferay.portos.bo.shared.util.FascicoloURLUtil; -import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; -import it.tref.liferay.portos.bo.shared.util.TipoSoggettoUtil; -import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil; -import it.tref.liferay.portos.report.shared.constants.ReportConstants; -import it.tref.liferay.portos.report.shared.dto.ReportDto; -import it.tref.liferay.portos.report.shared.dto.ReportResultDto; -import it.tref.liferay.portos.report.shared.util.ReportUtil; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.security.Provider; -import java.security.SecureRandom; -import java.security.Security; -import java.text.MessageFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.time.DateUtils; - -import com.liferay.portal.kernel.exception.PortalException; -import com.liferay.portal.kernel.exception.SystemException; -import com.liferay.portal.kernel.json.JSONFactoryUtil; -import com.liferay.portal.kernel.json.JSONObject; -import com.liferay.portal.kernel.language.LanguageUtil; -import com.liferay.portal.kernel.log.Log; -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.repository.model.FileEntry; -import com.liferay.portal.kernel.repository.model.Folder; -import com.liferay.portal.kernel.util.GetterUtil; -import com.liferay.portal.kernel.util.LocaleUtil; -import com.liferay.portal.kernel.util.PropsUtil; -import com.liferay.portal.kernel.util.StringPool; -import com.liferay.portal.kernel.util.Validator; -import com.liferay.portal.kernel.workflow.WorkflowConstants; -import com.liferay.portal.model.Company; -import com.liferay.portal.model.Role; -import com.liferay.portal.model.RoleConstants; -import com.liferay.portal.service.CompanyLocalServiceUtil; -import com.liferay.portal.service.RoleLocalServiceUtil; -import com.liferay.portal.service.ServiceContext; -import com.liferay.portal.service.UserLocalServiceUtil; -import com.liferay.portlet.documentlibrary.NoSuchFileException; -import com.liferay.portlet.documentlibrary.model.DLFolder; -import com.liferay.portlet.documentlibrary.model.DLFolderConstants; -import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; -import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil; - -public class SorteggioPraticaUtil { - - private static Log _log = LogFactoryUtil.getLog(SorteggioPraticaUtil.class); - - public static final String DATE_TIME_FORMAT = "dd/MM/yyyy HH:mm:ss"; - - public final static String APERTO = "APERTO"; - public final static String CHIUSO = "CHIUSO"; - - private static final String FOLDER_TEMPLATE_SORTEGGIO = "Template_Sorteggio"; - - private static final String FOLDER_SORTEGGIO = "Report_Sorteggio"; - - private static final String FILE_ENTRY_TEMPLATE_SORTEGGIO = "Sorteggio"; - - private static final String FILE_ENTRY_SORTEGGIO = "Sorteggio_{0}_{1}_{2}"; - private static final String FILE_ENTRY_SORTEGGIO_OLD = "Sorteggio_{0}_{1}_{2}_{3}"; - - public static Date getDataSorteggio(long companyId, boolean next) throws SystemException { - - Date dtSorteggio = null; - // Date dtSorteggio = new Date(); - - Integer dayOfWeekSorteggio = GetterUtil.getInteger(ConfigurazioneLocalServiceUtil - .findByC_ChiaveString(companyId, ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO)); - Integer startDaySorteggio = GetterUtil.getInteger(ConfigurazioneLocalServiceUtil - .findByC_ChiaveString(companyId, ConfigurazioneConstants.START_DAY_SORTEGGIO)); - - if (dayOfWeekSorteggio > 0 && dayOfWeekSorteggio <= 7 && startDaySorteggio > 0 - && startDaySorteggio <= 28) { - - Calendar calendarSorteggio = Calendar.getInstance(); - calendarSorteggio.set(Calendar.DATE, startDaySorteggio); - if (next) { - calendarSorteggio.add(Calendar.MONTH, 1); - } - while (calendarSorteggio.get(Calendar.DAY_OF_WEEK) != dayOfWeekSorteggio) { - calendarSorteggio.add(Calendar.DATE, 1); - } - // se festività -> prossima settimana - if (FestivitaUtil.isFestivo(calendarSorteggio.getTime())) { - calendarSorteggio.add(Calendar.WEEK_OF_YEAR, 1); - } - dtSorteggio = DateUtils.truncate(calendarSorteggio, Calendar.DATE).getTime(); - } - - return dtSorteggio; - } - - public static boolean isGiornoSorteggio(long companyId, Date dt) throws SystemException, ParseException { - Date dtUltimoSorteggio = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss") - .parse(ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, - ConfigurazioneConstants.DATE_ULTIMO_SORTEGGIO)); - - // Almeno 3 giorni dall'ultimo sorteggio - if (dt.getTime() - dtUltimoSorteggio.getTime() > 3 * 24 * 60 * 60 * 1000) { - int dowOggi = Calendar.getInstance().get(Calendar.DAY_OF_WEEK); - int dowSorteggio = Integer.parseInt(ConfigurazioneLocalServiceUtil.findByC_ChiaveString( - companyId, ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO)); - - if (dowOggi == dowSorteggio) { - - } - } - return true; - } - - /** - * - * Implementazione della procedura di sorteggio secondo i requisiti della - * Regione Siciliana. - * - * @author Manifattura Web Group per Regione Siciliana - * @param companyId - * @param dtSorteggio - * @throws PortalException - * @throws SystemException - */ - public static List sorteggio(long companyId, Date dtSorteggio) throws PortalException, - SystemException { - - List esito = new ArrayList<>(); - SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); - esito.add("Sorteggio iniziato in data " + sdf.format(dtSorteggio) + ".

"); - - Map> sorteggiabili = IntPraticaLocalServiceUtil.findSorteggiabiliNew( - companyId, dtSorteggio); - - int numeroSorteggiabili = 0; - for (Map.Entry> s : sorteggiabili.entrySet()) { - numeroSorteggiabili += s.getValue().size(); - } - esito.add("

" + numeroSorteggiabili + " pratiche sottoposte a sorteggio.

"); - - SecureRandom rnd = new SecureRandom(); - List sorteggiate = new ArrayList<>(); - for (Map.Entry> s : sorteggiabili.entrySet()) { - String codiceProvincia = s.getKey(); - List elenco = s.getValue(); - - Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(companyId, codiceProvincia); - long numeroSorteggiate = (long) Math.ceil(0.1 * elenco.size()); - String testoSorteggio; - if (numeroSorteggiate > 1) { - testoSorteggio = "saranno estratte " + numeroSorteggiate + " pratiche"; - } else { - testoSorteggio = "sarà estratta 1 pratica"; - } - esito.add("

Provincia di " + provincia.getProvincia() + " " + elenco.size() - + " pratiche, " + testoSorteggio + ".

    "); - - Map ordinate = new HashMap<>(); - - int chiave; - for (IntPratica pratica : elenco) { - do { - chiave = rnd.nextInt(); - } while (ordinate.containsKey(chiave)); - ordinate.put(chiave, pratica); - } - TreeMap mescolate = new TreeMap(ordinate); - - long contatore = 0; - long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, - "conf.geniocivile.avviso.template.id.deposito.B2"); - for (Map.Entry m : mescolate.entrySet()) { - IntPratica pratica = m.getValue(); - long intPraticaId = pratica.getIntPraticaId(); - DettPratica dettPratica = DettPraticaLocalServiceUtil - .getLastCompletedByIntPratica(intPraticaId); - - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(dettPratica.getCompanyId()); - serviceContext.setScopeGroupId(dettPratica.getGroupId()); - serviceContext.setUserId(dettPratica.getUserId()); - - if (contatore++ < numeroSorteggiate) { - sorteggiate.add(pratica); - esito.add("
  1. Sorteggiata: " + pratica.getNumeroProgetto() + " (id " + intPraticaId - + ") del " + sdf.format(pratica.getDtPratica()) + " (" + m.getKey() + ")
  2. "); - } else { - pratica.setDtSorteggio(dtSorteggio); - IntPraticaLocalServiceUtil.updateIntPratica(pratica); - - esito.add("
  3. Non sorteggiata: " + pratica.getNumeroProgetto() + " (id " + intPraticaId - + ") del " + sdf.format(pratica.getDtPratica()) + " (" + m.getKey() + ")
  4. "); - } - } - esito.add("
"); - } - if (sorteggiate.size() > 0) { - saveSorteggio(companyId, sorteggiate, dtSorteggio); - } - esito.add("Sorteggio terminato in data " + sdf.format(dtSorteggio) + ".

"); - - creaReportSorteggio(companyId, dtSorteggio, esito); - - // Salvataggio data ultimo sorteggio - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(companyId); - serviceContext.setScopeGroupId(-1L); - serviceContext.setUserId(UserLocalServiceUtil.getDefaultUserId(companyId)); - SimpleDateFormat simpleDateTimeFormat = new SimpleDateFormat(DATE_TIME_FORMAT); - esito.add("Sorteggio eseguito in data " + simpleDateTimeFormat.format(dtSorteggio)); - ConfigurazioneLocalServiceUtil.storeConfig(ConfigurazioneConstants.DATE_ULTIMO_SORTEGGIO, - simpleDateTimeFormat.format(dtSorteggio), serviceContext); - - // Log su file - String path = PropsUtil.get("liferay.home") + "/sorteggi"; - try { - File folder = new File(path); - if (!folder.exists()) { - folder.mkdirs(); - } - FileWriter writer = new FileWriter(path + "/sorteggio-" - + new SimpleDateFormat("yyyy-MM-dd").format(dtSorteggio) + ".txt"); - for (String string : esito) - writer.write(string + "\n"); - writer.close(); - } catch (IOException e) { - _log.error("Errore durante il salvataggio del report " + e.getMessage()); - } - - return esito; - } - - private static FileEntry creaReportSorteggio(long companyId, Date dtSorteggio, List contenuto) - throws PortalException, SystemException { - - Role role = RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR); - long userId = UserLocalServiceUtil.getRoleUsers(role.getRoleId(), 0, 1).get(0).getUserId(); - - Company company = CompanyLocalServiceUtil.getCompany(companyId); - Folder folderTemplate = DLAppLocalServiceUtil.getFolder(company.getGroupId(), - DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, "Template"); - FileEntry fileEntryTemplate = DLAppLocalServiceUtil.getFileEntry(folderTemplate.getGroupId(), - folderTemplate.getFolderId(), FILE_ENTRY_TEMPLATE_SORTEGGIO); - - Folder folderReport = DLAppLocalServiceUtil.getFolder(company.getGroupId(), - DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, FOLDER_SORTEGGIO); - - StringBuilder sb = new StringBuilder(contenuto.size()); - for (String riga : contenuto) { - sb.append(riga); - } - Map parameters = new HashMap(); - parameters.put("html", sb.toString()); - - ReportDto reportDto = new ReportDto(); - reportDto.setFileEntryIds(new long[] { fileEntryTemplate.getFileEntryId() }); - reportDto.setFolderId(folderReport.getFolderId()); - reportDto.setFileName(reportFileName(companyId, dtSorteggio)); - - reportDto.setHeader(""); - reportDto.setHeaderHeight(1); - reportDto.setFooter(""); - reportDto.setFooterHeight(40); - - reportDto.setParameters(parameters); - reportDto.setShowNumberOfPage(true); - reportDto.setType(ReportConstants.ReportType.VELOCITY_TO_PDF.toString()); - - String resourcePath = SorteggioPraticaUtil.class.getName().replaceAll("\\w+\\.", "../") - .replace(SorteggioPraticaUtil.class.getSimpleName(), "resource/asseverazioni"); - reportDto.setPortalURL(SorteggioPraticaUtil.class.getResource(resourcePath).getPath()); - - ReportUtil.generateReport(companyId, userId, reportDto, null); - - return null; - } - - private static String reportFileName(long companyId, Date dtSorteggio) { - Calendar calSorteggio = DateUtils.toCalendar(dtSorteggio); - String anno = String.valueOf(calSorteggio.get(Calendar.YEAR)); - int settimana = calSorteggio.get(Calendar.WEEK_OF_YEAR); - return reportFileName(companyId, anno, settimana); - } - - private static String reportFileName(long companyId, String anno, int settimana) { - return "Sorteggio_" + settimana + "_" + anno + "_" + companyId; - } - - private static void invioMailSorteggio(IntPratica intPratica, DettPratica dettPratica, - ServiceContext serviceContext) { - try { - long intPraticaId = intPratica.getIntPraticaId(); - List soggetti = SoggettoLocalServiceUtil.getValidByIntPratica(intPraticaId); - - List toList = new ArrayList(); - for (Soggetto soggetto : soggetti) { - toList.add(soggetto.getEmail()); - } - String[] to = toList.toArray(new String[toList.size()]); - String[] cc = new String[0]; - String[] ccn = new String[0]; - - Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId()); - Comune comune = ComuneLocalServiceUtil.getComune(territorio.getComuneId()); - Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), - territorio.getCodiceProvincia()); - String url = FascicoloURLUtil.getFascicoloFEViewURL(intPratica.getCompanyId(), intPraticaId, - "/html/fascicolofe/view_fascicolo.jsp", ""); - - JSONObject templateVariables = JSONFactoryUtil.createJSONObject(); - templateVariables.put("comune", comune.getDenominazione()); - templateVariables.put("intervento", dettPratica.getDescLongIntervento()); - templateVariables.put("link", url); - templateVariables.put("praticaNum", intPratica.getNumeroProgetto()); - templateVariables.put("provincia", provincia.getProvincia()); - templateVariables.put("tipoPratica", - LanguageUtil.get(LocaleUtil.ITALIAN, "tipo-pratica-" + intPratica.getTipoPratica())); - - MailManagerUtil.sendMailByTemplatName(intPratica.getClass().getName(), intPraticaId, - "NOTIFICA-SORTEGGIO", to, cc, ccn, templateVariables, null, serviceContext); - } catch (PortalException | SystemException e) { - _log.error("Errore durante l'invio mail sorteggio della pratica " + intPratica.getIntPraticaId(), - e); - } - } - - /** - * @author Manifattura Web Group per Regione Siciliana - * - * @param companyId - * @param pratiche - * Lista di pratiche sorteggiate - * @param dtSorteggio - * Data del sorteggio - * @throws PortalException - * @throws SystemException - */ - private static void saveSorteggio(long companyId, List pratiche, Date dtSorteggio) - throws PortalException, SystemException { - - long numeroEstrazione = 1; - for (IntPratica pratica : pratiche) { - - Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(pratica.getTerritorioId()); - Comune comune = ComuneLocalServiceUtil.getComune(territorio.getComuneId()); - Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), - comune.getCodiceProvincia()); - - DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica - .getIntPraticaId()); - - String committente = ""; - List soggetti = SoggettoLocalServiceUtil - .findByIntPratica_TipologiaSoggetto_Aggiuntivo_Rimosso(pratica.getIntPraticaId(), - TipoSoggettoUtil.COMMITTENTE, false, false); - if (soggetti.size() > 0) { - Soggetto soggetto = soggetti.get(0); - - // Bug 32771 - if (Validator.isNotNull(soggetto.getNome()) && Validator.isNotNull(soggetto.getCognome())) - committente = soggetto.getNome() + " " + soggetto.getCognome(); - else if (Validator.isNotNull(soggetto.getDenominazione())) - committente = soggetto.getDenominazione(); - else - committente = soggetto.getLegaleRap(); - } - - // anno, mese, settimana della data sorteggio - Calendar calSorteggio = Calendar.getInstance(); - calSorteggio.setTime(dtSorteggio); - - String anno = String.valueOf(calSorteggio.get(Calendar.YEAR)); - String mese = String.format("%02d", calSorteggio.get(Calendar.MONTH) + 1); - int settimana = calSorteggio.get(Calendar.WEEK_OF_YEAR); - - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(dettPratica.getCompanyId()); - serviceContext.setScopeGroupId(dettPratica.getGroupId()); - serviceContext.setUserId(dettPratica.getUserId()); - - SorteggioLocalServiceUtil.addSorteggio(pratica.getIntPraticaId(), dettPratica.getDettPraticaId(), - anno, mese, settimana, dtSorteggio, "", APERTO, "", numeroEstrazione++, - pratica.getNumeroProgetto(), committente, comune.getDenominazione(), - provincia.getProvincia(), false, pratica.getIntPraticaId(), false, serviceContext); - - ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.addControlloPratica( - pratica.getGroupId(), pratica.getUserId(), pratica.getIntPraticaId(), - dettPratica.getDettPraticaId(), true, serviceContext); - - long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong( - serviceContext.getCompanyId(), "conf.geniocivile.avviso.template.id.deposito.S"); - - AvvisoLocalServiceUtil.addAvviso(pratica.getIntPraticaId(), "Avviso di sorteggio", dtSorteggio, - AvvisoUtil.TIPO_AVVISO_DIRETTO, StatoPraticaConstants.SOTTOPOSTA_A_PARERE, - fileEntryIdTemplate, dettPratica.getDettPraticaId(), DettPratica.class.getName(), - controlloPratica.getControlloPraticaId(), serviceContext); - - IntPraticaLocalServiceUtil.updateIntPraticaSorteggio(pratica.getIntPraticaId(), dtSorteggio, - StatoPraticaConstants.SOTTOPOSTA_A_PARERE); - - } - } - - private static void saveSorteggio(long companyId, long[] numeroEstrazione, List pratiche, - Date dtSorteggio, boolean mesePrecedente, boolean disabled) throws Exception { - - for (Object[] pratica : pratiche) { - - long praticaId = (Long) pratica[0]; - boolean esterna = (Boolean) pratica[1]; - long territorioId = (Long) pratica[2]; - String numeroProgetto = (String) pratica[3]; - String committente = (String) pratica[4]; - - long dettPraticaId = 0L; - long intPraticaId = 0L; - - Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(territorioId); - Comune comune = ComuneLocalServiceUtil.getComune(territorio.getComuneId()); - Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(territorio.getCompanyId(), - comune.getCodiceProvincia()); - if (!esterna) { - IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(praticaId); - - intPraticaId = intPratica.getIntPraticaId(); - - DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(intPratica - .getIntPraticaId()); - dettPraticaId = dettPratica.getDettPraticaId(); - List soggetti = SoggettoLocalServiceUtil - .findByIntPratica_TipologiaSoggetto_Aggiuntivo_Rimosso(intPratica.getIntPraticaId(), - TipoSoggettoUtil.COMMITTENTE, false, false); - if (soggetti.size() > 0) { - // Bug 32771 - if (Validator.isNotNull(soggetti.get(0).getNome()) - && Validator.isNotNull(soggetti.get(0).getCognome())) - committente = soggetti.get(0).getNome() + StringPool.SPACE - + soggetti.get(0).getCognome(); - else - committente = Validator.isNotNull(soggetti.get(0).getDenominazione()) ? soggetti.get( - 0).getDenominazione() : soggetti.get(0).getLegaleRap(); - } - } - - // anno, mese della data sorteggio - Calendar calSorteggio = DateUtils.toCalendar(dtSorteggio); - String anno = String.valueOf(calSorteggio.get(Calendar.YEAR)); - String mese = StringUtils.leftPad(String.valueOf(calSorteggio.get(Calendar.MONTH) + 1), 2, '0'); - int settimana = calSorteggio.get(Calendar.WEEK_OF_YEAR); - - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(companyId); - serviceContext.setScopeGroupId(territorio.getGroupId()); - serviceContext.setUserId(UserLocalServiceUtil.getDefaultUserId(companyId)); - - SorteggioLocalServiceUtil.addSorteggio(intPraticaId, dettPraticaId, anno, mese, settimana, - dtSorteggio, StringPool.BLANK, APERTO, StringPool.BLANK, numeroEstrazione[0]++, - numeroProgetto, committente, comune.getDenominazione(), provincia.getProvincia(), - esterna, (!esterna ? 0L : praticaId), mesePrecedente, serviceContext); - - if (!esterna) { - IntPraticaLocalServiceUtil.updateIntPraticaSorteggio(praticaId, dtSorteggio); - } else { - SorteggioLocalServiceUtil.updateDataSorteggioPraticaEsterna(praticaId, dtSorteggio); - } - } - - } - - public static Date getDateMinSorteggioAnno(Date dt) { - - Date[] rangeAnno = rangeSorteggioAnno(getMeseSorteggio(dt)); - return rangeAnno[0]; - } - - public static FileEntry getFileEntrySorteggio(long companyId, long groupId, Date dtSorteggio) - throws PortalException, SystemException { - - Company company = CompanyLocalServiceUtil.getCompany(companyId); - - Folder folder = DLAppLocalServiceUtil.getFolder(company.getGroupId(), - DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, FOLDER_SORTEGGIO); - String fileName = reportFileName(companyId, dtSorteggio); - - FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(groupId, folder.getFolderId(), fileName); - - return fileEntry; - } - - public static FileEntry getFileEntrySorteggio(long companyId, long groupId, int settimana, String anno) - throws PortalException, SystemException { - - Company company = CompanyLocalServiceUtil.getCompany(companyId); - - Folder folder = DLAppLocalServiceUtil.getFolder(company.getGroupId(), - DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, FOLDER_SORTEGGIO); - String fileName = reportFileName(companyId, anno, settimana); - - return DLAppLocalServiceUtil.getFileEntry(groupId, folder.getFolderId(), fileName); - } - - /* - * Metodi Utilità - */ - - private static void generateReport(long companyId, Date dtSorteggio, long gropuId) throws Exception { - - Role role = RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR); - long userId = UserLocalServiceUtil.getRoleUsers(role.getRoleId(), 0, 1).get(0).getUserId(); - - // anno, mese della data sorteggio - Calendar calSorteggio = DateUtils.toCalendar(dtSorteggio); - String anno = String.valueOf(calSorteggio.get(Calendar.YEAR)); - String mese = StringUtils.leftPad(String.valueOf(calSorteggio.get(Calendar.MONTH) + 1), 2, '0'); - int settimana = calSorteggio.get(Calendar.WEEK_OF_YEAR); - - List sorteggios = new ArrayList( - SorteggioLocalServiceUtil.findByGroupId_Anno_Mese_Settimana(gropuId, anno, mese, settimana)); - - List reportSorteggioBeans = new ArrayList(sorteggios.size()); - for (Sorteggio sorteggio : sorteggios) { - ReportSorteggioBean bean = ReportSorteggioBeanBuilder.build(sorteggio); - reportSorteggioBeans.add(bean); - } - - Collections.sort(reportSorteggioBeans, new Comparator() { - - @Override - public int compare(ReportSorteggioBean b1, ReportSorteggioBean b2) { - - int compare = new Long(b1.getNumeroEstrazione()).compareTo(new Long(b2.getNumeroEstrazione())); - int compareProvincia = b1.getProvincia().compareTo(b2.getProvincia()); - - if (compareProvincia == 0) { - if (compare == 0) { - if (Validator.isNull(b1.getFascia())) { - return -1; - } - compare = b1.getFascia().compareTo(b2.getFascia()); - if (compare == 0) { - return new Long(b1.getPratica()).compareTo(new Long(b2.getPratica())); - } - return compare; - } - return compare; - } - - return compareProvincia; - } - }); - - // vuoto per forzare visualizzazione - if (reportSorteggioBeans.isEmpty()) { - reportSorteggioBeans.add(new ReportSorteggioBean()); - } - Company company = CompanyLocalServiceUtil.getCompany(companyId); - Folder folderTemplate = DLAppLocalServiceUtil.getFolder(company.getGroupId(), - DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, FOLDER_TEMPLATE_SORTEGGIO); - FileEntry fileEntryTemplate = DLAppLocalServiceUtil.getFileEntry(folderTemplate.getGroupId(), - folderTemplate.getFolderId(), FILE_ENTRY_TEMPLATE_SORTEGGIO); - - String fileName = MessageFormat.format(FILE_ENTRY_SORTEGGIO, mese, anno, gropuId); - - Folder folder = null; - try { - folder = DLAppLocalServiceUtil.getFolder(company.getGroupId(), - DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, FOLDER_SORTEGGIO); - } catch (PortalException e) { - folder = DLAppLocalServiceUtil.addFolder(userId, company.getGroupId(), - DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, FOLDER_SORTEGGIO, StringPool.BLANK, - new ServiceContext()); - } - - Map paramaters = new HashMap(); - - paramaters.put("DATA_SORTEGGIO", - new SimpleDateFormat("MMMM yyyy", java.util.Locale.ITALY).format(dtSorteggio)); - - int fasciaAMese = 0; - int fasciaAMesiPrec = 0; - int fasciaBMese = 0; - int fasciaBMesiPrec = 0; - int fasciaCMese = 0; - int fasciaCMesiPrec = 0; - - // Task 32561 - int zona4Mese = 0; - int zona4MesePrec = 0; - - for (ReportSorteggioBean bean : reportSorteggioBeans) { - if (Validator.isNotNull(bean.getFascia())) { - if (bean.getFascia().equals(Constants.FASCIA_A)) { - if (bean.getFase().equals("1")) { - fasciaAMese++; - } else if (bean.getFase().equals("2")) { - fasciaAMesiPrec++; - } - } else if (bean.getFascia().equals(Constants.FASCIA_B)) { - if (bean.getFase().equals("1")) { - fasciaBMese++; - } else if (bean.getFase().equals("2")) { - fasciaBMesiPrec++; - } - } else if (bean.getFascia().equals(Constants.FASCIA_C)) { - if (bean.getFase().equals("1")) { - fasciaCMese++; - } else if (bean.getFase().equals("2")) { - fasciaCMesiPrec++; - } - } - } - - // Task 32561 - if (Validator.isNotNull(bean.getZona())) { - if (("livorno".equalsIgnoreCase(bean.getProvincia()) || "grosseto".equalsIgnoreCase(bean - .getProvincia())) && bean.getZona().equals(Constants.ZONA_4)) { - if (bean.getFase().equals("1")) { - zona4Mese++; - } else if (bean.getFase().equals("2")) { - zona4MesePrec++; - } - } - } - } - - paramaters.put("FASCIA_A_MESE", fasciaAMese); - paramaters.put("FASCIA_A_MESI_PREC", fasciaAMesiPrec); - paramaters.put("FASCIA_B_MESE", fasciaBMese); - paramaters.put("FASCIA_B_MESI_PREC", fasciaBMesiPrec); - paramaters.put("FASCIA_C_MESE", fasciaCMese); - paramaters.put("FASCIA_C_MESI_PREC", fasciaCMesiPrec); - - // Task 32561 - paramaters.put("ZONA_4_MESE", zona4Mese); - paramaters.put("ZONA_4_MESE_PREC", zona4MesePrec); - - // ServiceContext serviceContext = new ServiceContext(); - // serviceContext.setCompanyId(companyId); - // serviceContext.setScopeGroupId(groupId); - // serviceContext.setUserId(userId); - - ReportDto reportDto = new ReportDto(); - reportDto.setFileEntryIds(new long[] { fileEntryTemplate.getFileEntryId() }); - reportDto.setFolderId(folder.getFolderId()); - reportDto.setFileName(fileName); - reportDto.setParameters(paramaters); - // reportDto.setDataSource(reportSorteggioBeans); - reportDto.setShowNumberOfPage(true); - reportDto.setType(ReportConstants.ReportType.JRXML_TO_PDF.toString()); - - ReportResultDto result = ReportUtil - .generateReport(companyId, userId, reportDto, reportSorteggioBeans); - long idFileEntry = result.getFileEntryIds()[0]; - - /* - * Message messageReport = new Message(); - * messageReport.put(ReportConstants.FILE_ENTRY_ID_TEMPLATE, - * fileEntryTemplate.getFileEntryId()); - * messageReport.put(ReportConstants.FOLDER_ID_REPORT, - * folder.getFolderId()); messageReport.put(ReportConstants.REPORT_NAME, - * fileName); messageReport.put(ReportConstants.SERVICE_CONTEXT, - * serviceContext); messageReport.put(ReportConstants.REPORT_PARAMETERS, - * paramaters); messageReport.put(ReportConstants.REPORT_DATASOURCE, - * reportSorteggioBeans); long idFileEntry = (Long) - * MessageBusUtil.sendSynchronousMessage(ReportDestinationNames.SYNC, - * messageReport, 1); - */ - - if (Validator.isNull(idFileEntry)) { - throw new NoSuchFileException(); - } - - } - - private static String getMeseSorteggio(Date dtSorteggio) { - - Calendar calendar = getSorteggio(dtSorteggio); - return StringUtils.leftPad(String.valueOf(calendar.get(Calendar.MONTH) + 1), 2, '0'); - } - - private static Calendar getSorteggio(Date dtSorteggio) { - - Calendar calendar = Calendar.getInstance(); - calendar.setTime(dtSorteggio); - calendar.add(Calendar.MONTH, -1); - return calendar; - } - - private static Date[] rangeSorteggioAnno(String mese) { - - // min - Calendar calMin = getCalendarNoTimeFirstDay(); - if (mese.equalsIgnoreCase("12")) { - calMin.add(Calendar.YEAR, -1); - } - calMin.set(Calendar.MONTH, (Integer.parseInt(mese) - 1)); - calMin.add(Calendar.MONTH, -11); - // max - Calendar calMax = getCalendarNoTimeFirstDay(); - if (mese.equalsIgnoreCase("12")) { - calMax.add(Calendar.YEAR, -1); - } - calMax.set(Calendar.MONTH, (Integer.parseInt(mese) - 1)); - return new Date[] { calMin.getTime(), calMax.getTime() }; - } - - private static Calendar getCalendarNoTimeFirstDay() { - - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.DATE, 1); - cal.set(Calendar.HOUR_OF_DAY, 0); - cal.set(Calendar.MINUTE, 0); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - return cal; - } -} diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties index a3f09548..01a499d5 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_bo - build.number=2301 - build.date=1591708070626 + build.number=2315 + build.date=1591805875908 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sorteggio/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sorteggio/view.jsp index a9c3d8ac..f7062847 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sorteggio/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sorteggio/view.jsp @@ -4,7 +4,7 @@ <%@page import="it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants"%> <%@page import="com.liferay.portlet.PortletURLUtil"%> <%@page import="javax.portlet.PortletURL"%> -<%@page import="it.tref.liferay.portos.bo.util.SorteggioPraticaUtil"%> +<%@page import="it.mwg.sismica.bo.util.SorteggioPraticaUtil"%> <%@page import="com.liferay.portlet.documentlibrary.util.DLUtil"%> <%@page import="com.liferay.portal.kernel.repository.model.FileEntry"%> <%@page import="com.liferay.portal.kernel.exception.PortalException"%> @@ -30,21 +30,6 @@ <% long companyId = company.getCompanyId(); long groupId = themeDisplay.getScopeGroupId(); -int dayOfWeekSorteggioParam = GetterUtil.getInteger( - ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, ConfigurazioneConstants.DAY_OF_WEEK_SORTEGGIO)); -int startDaySorteggioParam =GetterUtil.getInteger( - ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, ConfigurazioneConstants.START_DAY_SORTEGGIO)); - -//boolean sistemaConfigurato = dayOfWeekSorteggioParam>0 && dayOfWeekSorteggioParam<=7 && startDaySorteggioParam>0 && startDaySorteggioParam<=28; -boolean sistemaConfigurato = dayOfWeekSorteggioParam>0 && dayOfWeekSorteggioParam<=7; -%> - - - - - -<% -Date dtSorteggio = SorteggioPraticaUtil.getDataSorteggio(companyId, false); String dataUltimoSorteggioString = ConfigurazioneLocalServiceUtil.findByC_ChiaveString( companyId, ConfigurazioneConstants.DATE_ULTIMO_SORTEGGIO); @@ -55,11 +40,6 @@ if (Validator.isNotNull(dataUltimoSorteggioString)) { dtUltimoSorteggio = DateUtils.truncate( new SimpleDateFormat(SorteggioPraticaUtil.DATE_TIME_FORMAT).parse( dataUltimoSorteggioString), Calendar.DATE); - if (now.compareTo(dtUltimoSorteggio) >= 0 - && DateUtils.toCalendar(now).get(Calendar.MONTH) == - DateUtils.toCalendar(dtUltimoSorteggio).get(Calendar.MONTH)) { - dtSorteggio = SorteggioPraticaUtil.getDataSorteggio(companyId, true); - } } DateFormat formatDtSorteggio = DateFormat.getDateInstance(DateFormat.FULL, locale); @@ -95,16 +75,6 @@ String provincia = ParamUtil.getString(renderRequest, "provincia"); String[] mesi = CalendarUtil.getMonths(locale); -/* String meseN = StringPool.BLANK; -if (Validator.isNotNull(mese)) { - meseN = "00"; - for (int i=0;i @@ -428,6 +398,4 @@ boolean isPublicLayout = layout.isPublicLayout(); - - - + \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ConfigurazioneConstants.java b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ConfigurazioneConstants.java index 92f8b1fe..3a5d3725 100644 --- a/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ConfigurazioneConstants.java +++ b/liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/ConfigurazioneConstants.java @@ -2,41 +2,41 @@ package it.tref.liferay.portos.bo.shared.util; public class ConfigurazioneConstants { - public static final String TEMPLATE_FOLDER_ID = "conf.geniocivile.template.folder.id"; - - public static final String ATTACHMENT_FOLDER_ID = "conf.geniocivile.attachment.folder.id"; - - public static final String MANUAL_AVVISO_FOLDER_ID = "conf.geniocivile.avviso.folder.id.manual"; - - public static final String DIGITAL_SIGNATURE_SERVICE_ADDRESS_SIGN = "conf.geniocivile.digitalSignature.serviceAddressSign"; - public static final String DIGITAL_SIGNATURE_RETURN_URL_SIGN = "conf.geniocivile.digitalSignature.returnURLSign"; - public static final String DIGITAL_SIGNATURE_KEYSTORE_PATH = "conf.geniocivile.digitalSignature.keystore.path"; - public static final String DIGITAL_SIGNATURE_KEYSTORE_PASSWORD = "conf.geniocivile.digitalSignature.keystore.password"; - public static final String DIGITAL_SIGNATURE_TRUSTSTORE_PATH = "conf.geniocivile.digitalSignature.truststore.path"; - public static final String DIGITAL_SIGNATURE_TRUSTSTORE_PASSWORD = "conf.geniocivile.digitalSignature.truststore.password"; - - public static final String SCHEDULER_GENERA_DOCUMENTO = "conf.geniocivile.scheduler.generadocumento"; - public static final String SCHEDULER_FIRMA_DOCUMENTO = "conf.geniocivile.scheduler.firmadocumento"; - public static final String SCHEDULER_INVIO_DOCUMENTO = "conf.geniocivile.scheduler.inviodocumento"; - public static final String SCHEDULER_INVIO_DOCUMENTO_DAX = "conf.geniocivile.scheduler.inviodocumentodax"; - - public static final String DATE_ULTIMO_SORTEGGIO = "conf.geniocivile.sorteggio.data.ultimo.sorteggio"; - public static final String DAY_OF_WEEK_SORTEGGIO = "conf.geniocivile.sorteggio.day.of.week"; - public static final String HOUR_OF_DAY_SORTEGGIO = "conf.sismica.sorteggio.hour.of.day"; - public static final String HOUR_OF_DAY_SORTEGGIO_DEFAULT = "conf.sismica.sorteggio.hour.of.day.default"; - public static final String DAY_OF_WEEK_PUBBLICAZIONE = "conf.sismica.sorteggio.day.of.week.pubblicazione"; - public static final String START_DAY_SORTEGGIO = "conf.geniocivile.sorteggio.start.day"; - - public static final String PROTOCOLLAZIONE_SERVICE_URL = "conf.geniocivile.protocollazione.service.url"; - public static final String PROTOCOLLAZIONE_SERVICE_EXPORT_URL = "conf.geniocivile.protocollazione.export.url"; - public static final String PROTOCOLLAZIONE_SERVICE_IMPORT_URL = "conf.geniocivile.protocollazione.import.url"; - - // nuove configurazioni - public static final String SCHEDULER_VERSIONING = "conf.geniocivile.scheduler.versioning"; - public static final String SCHEDULER_IRIS = "conf.geniocivile.scheduler.iris"; - public static final String IRIS_VERIFICA_PAGAMENTI_URL = "conf.geniocivile.scheduler.iris.debitorie.url"; - public static final String IRIS_COMUNICAZIONI_DEBITORIE_URL = "conf.geniocivile.scheduler.iris.pagamenti.url"; - public static final String IRIS_GENERAZIONE_IUV_URL = "conf.geniocivile.scheduler.iris.iuv.url"; - public static final String IMPORTO_BOLLO = "conf.geniocivile.scheduler.iris.importobollo"; + public static final String TEMPLATE_FOLDER_ID = "conf.geniocivile.template.folder.id"; + + public static final String ATTACHMENT_FOLDER_ID = "conf.geniocivile.attachment.folder.id"; + + public static final String MANUAL_AVVISO_FOLDER_ID = "conf.geniocivile.avviso.folder.id.manual"; + + public static final String DIGITAL_SIGNATURE_SERVICE_ADDRESS_SIGN = "conf.geniocivile.digitalSignature.serviceAddressSign"; + public static final String DIGITAL_SIGNATURE_RETURN_URL_SIGN = "conf.geniocivile.digitalSignature.returnURLSign"; + public static final String DIGITAL_SIGNATURE_KEYSTORE_PATH = "conf.geniocivile.digitalSignature.keystore.path"; + public static final String DIGITAL_SIGNATURE_KEYSTORE_PASSWORD = "conf.geniocivile.digitalSignature.keystore.password"; + public static final String DIGITAL_SIGNATURE_TRUSTSTORE_PATH = "conf.geniocivile.digitalSignature.truststore.path"; + public static final String DIGITAL_SIGNATURE_TRUSTSTORE_PASSWORD = "conf.geniocivile.digitalSignature.truststore.password"; + + public static final String SCHEDULER_GENERA_DOCUMENTO = "conf.geniocivile.scheduler.generadocumento"; + public static final String SCHEDULER_FIRMA_DOCUMENTO = "conf.geniocivile.scheduler.firmadocumento"; + public static final String SCHEDULER_INVIO_DOCUMENTO = "conf.geniocivile.scheduler.inviodocumento"; + public static final String SCHEDULER_INVIO_DOCUMENTO_DAX = "conf.geniocivile.scheduler.inviodocumentodax"; + + public static final String DATE_ULTIMO_SORTEGGIO = "conf.geniocivile.sorteggio.data.ultimo.sorteggio"; + public static final String DAY_OF_WEEK_SORTEGGIO = "conf.geniocivile.sorteggio.day.of.week"; + public static final String HOUR_OF_DAY_SORTEGGIO = "conf.sismica.sorteggio.hour.of.day"; + public static final String HOUR_OF_DAY_SORTEGGIO_DEFAULT = "conf.sismica.sorteggio.hour.of.day.default"; + public static final String DAY_OF_WEEK_PUBBLICAZIONE = "conf.sismica.sorteggio.day.of.week.pubblicazione"; + public static final String START_DAY_SORTEGGIO = "conf.geniocivile.sorteggio.start.day"; + + public static final String PROTOCOLLAZIONE_SERVICE_URL = "conf.geniocivile.protocollazione.service.url"; + public static final String PROTOCOLLAZIONE_SERVICE_EXPORT_URL = "conf.geniocivile.protocollazione.export.url"; + public static final String PROTOCOLLAZIONE_SERVICE_IMPORT_URL = "conf.geniocivile.protocollazione.import.url"; + + // nuove configurazioni + public static final String SCHEDULER_VERSIONING = "conf.geniocivile.scheduler.versioning"; + public static final String SCHEDULER_IRIS = "conf.geniocivile.scheduler.iris"; + public static final String IRIS_VERIFICA_PAGAMENTI_URL = "conf.geniocivile.scheduler.iris.debitorie.url"; + public static final String IRIS_COMUNICAZIONI_DEBITORIE_URL = "conf.geniocivile.scheduler.iris.pagamenti.url"; + public static final String IRIS_GENERAZIONE_IUV_URL = "conf.geniocivile.scheduler.iris.iuv.url"; + public static final String IMPORTO_BOLLO = "conf.geniocivile.scheduler.iris.importobollo"; }