diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java index eb9761e6..55d424af 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java @@ -16,7 +16,6 @@ import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.model.Pagamento; import it.tref.liferay.portos.bo.model.ParereGeologo; import it.tref.liferay.portos.bo.model.Territorio; -import it.tref.liferay.portos.bo.model.impl.AvvisoImpl; import it.tref.liferay.portos.bo.service.AllegatoManualeLocalServiceUtil; import it.tref.liferay.portos.bo.service.AsseverazioneLocalServiceUtil; import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; @@ -35,16 +34,11 @@ import it.tref.liferay.portos.bo.util.AvvisoUtil; import it.tref.liferay.portos.bo.util.Constants; import it.tref.liferay.portos.bo.util.WorkflowConstants; -import java.io.IOException; import java.io.Serializable; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; -import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; @@ -53,13 +47,8 @@ import java.util.Map; import java.util.Map.Entry; import java.util.TreeMap; -import org.apache.commons.io.IOUtils; - -import com.itextpdf.text.pdf.codec.Base64.InputStream; import com.liferay.counter.service.CounterLocalServiceUtil; -import com.liferay.portal.NoSuchRepositoryEntryException; import com.liferay.portal.NoSuchResourcePermissionException; -import com.liferay.portal.kernel.dao.jdbc.DataAccess; import com.liferay.portal.kernel.dao.orm.QueryUtil; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; @@ -79,44 +68,31 @@ import com.liferay.portal.kernel.workflow.WorkflowInstance; import com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil; import com.liferay.portal.kernel.workflow.WorkflowTask; import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil; -import com.liferay.portal.model.Group; import com.liferay.portal.model.Organization; import com.liferay.portal.model.ResourceAction; import com.liferay.portal.model.ResourceConstants; import com.liferay.portal.model.ResourcePermission; -import com.liferay.portal.model.Role; import com.liferay.portal.model.RoleConstants; import com.liferay.portal.model.User; -import com.liferay.portal.security.auth.PrincipalException; -import com.liferay.portal.security.auth.PrincipalThreadLocal; import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.security.permission.PermissionChecker; import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil; -import com.liferay.portal.security.permission.PermissionThreadLocal; -import com.liferay.portal.service.GroupLocalServiceUtil; import com.liferay.portal.service.OrganizationLocalServiceUtil; import com.liferay.portal.service.ResourceActionLocalServiceUtil; import com.liferay.portal.service.ResourcePermissionLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserLocalServiceUtil; -import com.liferay.portal.workflow.kaleo.model.KaleoInstance; import com.liferay.portal.workflow.kaleo.model.KaleoInstanceToken; import com.liferay.portal.workflow.kaleo.model.KaleoTaskAssignmentInstance; import com.liferay.portal.workflow.kaleo.model.KaleoTaskInstanceToken; -import com.liferay.portal.workflow.kaleo.service.KaleoInstanceLocalServiceUtil; -import com.liferay.portal.workflow.kaleo.service.KaleoInstanceTokenLocalService; import com.liferay.portal.workflow.kaleo.service.KaleoInstanceTokenLocalServiceUtil; import com.liferay.portal.workflow.kaleo.service.KaleoTaskAssignmentInstanceLocalServiceUtil; import com.liferay.portal.workflow.kaleo.service.KaleoTaskInstanceTokenLocalServiceUtil; -import com.liferay.portal.workflow.kaleo.service.persistence.KaleoInstanceTokenUtil; -import com.liferay.portlet.documentlibrary.NoSuchFileEntryException; import com.liferay.portlet.documentlibrary.model.DLFileEntry; import com.liferay.portlet.documentlibrary.model.DLFolder; -import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil; import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; -import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil; public class SismicaUtil { private final static Log _log = LogFactoryUtil.getLog(SismicaUtil.class); @@ -439,6 +415,22 @@ public class SismicaUtil { List avvisi = null; List totali = null; String stato = pratica.getStatoPratica(); + + // Avvisi conformi + try { + avvisi = AvvisoLocalServiceUtil.findByIntPraticaId_tipoDocumento( + pratica.getIntPraticaId(), StatoPraticaConstants.CONFORME); + } catch (SystemException e) { + avvisi = new ArrayList<>(); + } + + // Tutti gli avvisi + try { + totali = AvvisoLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId(), + QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); + } catch (SystemException e) { + totali = new ArrayList<>(); + } if (Validator.isNotNull(stato) && Validator.isNotNull(pratica.getTipoProcedura()) && pratica.getTipoPratica().equalsIgnoreCase(Constants.TIPO_PRATICA_DEPOSITO)) { @@ -451,22 +443,6 @@ public class SismicaUtil { } if (Validator.isNotNull(dettPratica)) { - // Avvisi conformi - try { - avvisi = AvvisoLocalServiceUtil.findByIntPraticaId_tipoDocumento( - pratica.getIntPraticaId(), StatoPraticaConstants.CONFORME); - } catch (SystemException e) { - avvisi = new ArrayList<>(); - } - - // Tutti gli avvisi - try { - totali = AvvisoLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId(), - QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); - } catch (SystemException e) { - totali = new ArrayList<>(); - } - // Controllo pratica List controlli = null; try { @@ -480,24 +456,18 @@ public class SismicaUtil { controllo = controlli.get(controlli.size() - 1); } + boolean totaliOk = (totali.size() == 0) + || ((totali.size() == 1) && totali.get(0).getTipoDocumento() + .equalsIgnoreCase(StatoPraticaConstants.VIDIMATA)); if ((avvisi.size() == 0 && stato.equalsIgnoreCase(StatoPraticaConstants.VIDIMATA)) - || (totali.size() <= 1 && stato - .equalsIgnoreCase(StatoPraticaConstants.CONFORME))) { + || (totaliOk && stato.equalsIgnoreCase(StatoPraticaConstants.CONFORME))) { - _log.info("Pratica " + pratica.getNumeroProgetto() + "avvisi.size() = " - + avvisi.size() + ", stato = " + stato); ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(dettPratica.getCompanyId()); serviceContext.setScopeGroupId(dettPratica.getGroupId()); serviceContext.setUserId(dettPratica.getUserId()); if (Validator.isNull(controllo)) { - esito.add("Progetto: " + pratica.getNumeroProgetto() + " (" - + pratica.getIntPraticaId() + "), procedura=" - + pratica.getTipoProcedura() + ", avvisi=" + totali.size() - + ", stato=" + pratica.getStatoPratica() + ", controlli=" - + controlli.size()); - try { controllo = ControlloPraticaLocalServiceUtil.addControlloPratica( dettPratica.getGroupId(), dettPratica.getUserId(), @@ -521,6 +491,16 @@ public class SismicaUtil { fileEntryIdTemplate = 0; } + _log.info("Pratica " + + pratica.getNumeroProgetto() + + ", totali.size() = " + + totali.size() + + (totali.size() > 0 ? ", totali(0) = " + + totali.get(0).getTipoDocumento() : "") + + ", avvisi.size() = " + avvisi.size() + ", stato = " + stato + + ", controllo = " + controllo.getPrimaryKey() + + ", fileEntryIdTemplate = " + fileEntryIdTemplate); + if (Validator.isNotNull(fileEntryIdTemplate)) { try { if (!pratica.getTipoProcedura().equalsIgnoreCase( 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 bc786f08..1dad63f8 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=2457 - build.date=1601477974273 + build.number=2458 + build.date=1601547633470 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java index 6a779f84..421a2c06 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java @@ -28,29 +28,10 @@ import com.liferay.portal.kernel.util.MimeTypesUtil; import com.liferay.portal.kernel.util.StreamUtil; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringUtil; -import com.liferay.portal.kernel.util.Validator; -import com.liferay.portal.model.Role; -import com.liferay.portal.model.RoleConstants; -import com.liferay.portal.model.User; -import com.liferay.portal.security.auth.PrincipalThreadLocal; import com.liferay.portal.security.permission.ActionKeys; -import com.liferay.portal.security.permission.PermissionChecker; -import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil; -import com.liferay.portal.security.permission.PermissionThreadLocal; -import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.ServiceContext; -import com.liferay.portal.service.UserLocalServiceUtil; -import com.liferay.portlet.documentlibrary.DuplicateFileException; -import com.liferay.portlet.documentlibrary.NoSuchFileEntryException; -import com.liferay.portlet.documentlibrary.service.DLAppHelperLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; -import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil; -import com.liferay.portlet.documentlibrary.service.DLContentLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; -import com.liferay.portlet.documentlibrary.util.DLAppHelperThreadLocal; -import com.liferay.portlet.documentlibrary.util.DLProcessorRegistryUtil; -import com.liferay.portlet.trash.service.TrashEntryLocalServiceUtil; - import it.tref.liferay.portos.report.html.core.HtmlToPdfEngine; import it.tref.liferay.portos.report.jasper.core.provider.JasperPdfProvider; import it.tref.liferay.portos.report.jasper.core.report.BeanReport; @@ -194,41 +175,10 @@ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseIm String fileName = title + StringPool.PERIOD + "pdf"; String mimeType = MimeTypesUtil.getContentType(fileName); - // se è già presente lo cancello - // FileEntry fileEntry = null; - // try { - // fileEntry = - // DLAppLocalServiceUtil.getFileEntry(groupId, - // folderId, - // title); - // } catch (PortalException e) { - // } - // if (Validator.isNotNull(fileEntry)) { - // _log.info("Cancello file entry " + - // fileEntry.getFileEntryId()); - // - // Role role = RoleLocalServiceUtil.getRole(companyId, - // RoleConstants.ADMINISTRATOR); - // User user = - // UserLocalServiceUtil.getRoleUsers(role.getRoleId(), 0, - // 1).get(0); - // PermissionChecker permissionChecker = - // PermissionCheckerFactoryUtil.create(user); - // - // PrincipalThreadLocal.setName(user.getUserId()); - // PermissionThreadLocal.setPermissionChecker(permissionChecker); - // - // DLAppServiceUtil.deleteFileEntry(fileEntry.getFileEntryId()); - // DLAppLocalServiceUtil.deleteFileEntry(fileEntry.getFileEntryId()); - // - // DLAppHelperLocalServiceUtil.deleteFileEntry(fileEntry); - // } - - // inserimento con permessi di view per site member - ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(companyId); serviceContext.setUserId(userId); + serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); _log.info("addFileEntry userId=" + userId + ", repositoryId=" + repositoryId + ", folderId=" + folderId + ", sourceFileName=" + fileName + ", mimeType=" + mimeType + ", title=" @@ -240,7 +190,6 @@ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseIm fileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, false, bytes, serviceContext); } catch (PortalException e) { - serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, fileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties index 08aeb2ce..153051e8 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_rep - build.number=23 - build.date=1601539162910 + build.number=24 + build.date=1601549245732 build.auto.upgrade=true ##