Salvatore La Manna 4 anni fa
parent
commit
fc20589ce4
  1. 70
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SismicaUtil.java
  2. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties
  3. 53
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java
  4. 4
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties

70
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.Pagamento;
import it.tref.liferay.portos.bo.model.ParereGeologo; import it.tref.liferay.portos.bo.model.ParereGeologo;
import it.tref.liferay.portos.bo.model.Territorio; 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.AllegatoManualeLocalServiceUtil;
import it.tref.liferay.portos.bo.service.AsseverazioneLocalServiceUtil; import it.tref.liferay.portos.bo.service.AsseverazioneLocalServiceUtil;
import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; 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.Constants;
import it.tref.liferay.portos.bo.util.WorkflowConstants; import it.tref.liferay.portos.bo.util.WorkflowConstants;
import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -53,13 +47,8 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.TreeMap; 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.counter.service.CounterLocalServiceUtil;
import com.liferay.portal.NoSuchRepositoryEntryException;
import com.liferay.portal.NoSuchResourcePermissionException; 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.dao.orm.QueryUtil;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; 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.WorkflowInstanceManagerUtil;
import com.liferay.portal.kernel.workflow.WorkflowTask; import com.liferay.portal.kernel.workflow.WorkflowTask;
import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil; import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.Organization; import com.liferay.portal.model.Organization;
import com.liferay.portal.model.ResourceAction; import com.liferay.portal.model.ResourceAction;
import com.liferay.portal.model.ResourceConstants; import com.liferay.portal.model.ResourceConstants;
import com.liferay.portal.model.ResourcePermission; import com.liferay.portal.model.ResourcePermission;
import com.liferay.portal.model.Role;
import com.liferay.portal.model.RoleConstants; import com.liferay.portal.model.RoleConstants;
import com.liferay.portal.model.User; 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.ActionKeys;
import com.liferay.portal.security.permission.PermissionChecker; import com.liferay.portal.security.permission.PermissionChecker;
import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil; 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.OrganizationLocalServiceUtil;
import com.liferay.portal.service.ResourceActionLocalServiceUtil; import com.liferay.portal.service.ResourceActionLocalServiceUtil;
import com.liferay.portal.service.ResourcePermissionLocalServiceUtil; import com.liferay.portal.service.ResourcePermissionLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserLocalServiceUtil; 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.KaleoInstanceToken;
import com.liferay.portal.workflow.kaleo.model.KaleoTaskAssignmentInstance; import com.liferay.portal.workflow.kaleo.model.KaleoTaskAssignmentInstance;
import com.liferay.portal.workflow.kaleo.model.KaleoTaskInstanceToken; 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.KaleoInstanceTokenLocalServiceUtil;
import com.liferay.portal.workflow.kaleo.service.KaleoTaskAssignmentInstanceLocalServiceUtil; import com.liferay.portal.workflow.kaleo.service.KaleoTaskAssignmentInstanceLocalServiceUtil;
import com.liferay.portal.workflow.kaleo.service.KaleoTaskInstanceTokenLocalServiceUtil; 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.DLFileEntry;
import com.liferay.portlet.documentlibrary.model.DLFolder; 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.DLAppServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil;
public class SismicaUtil { public class SismicaUtil {
private final static Log _log = LogFactoryUtil.getLog(SismicaUtil.class); private final static Log _log = LogFactoryUtil.getLog(SismicaUtil.class);
@ -439,18 +415,7 @@ public class SismicaUtil {
List<Avviso> avvisi = null; List<Avviso> avvisi = null;
List<Avviso> totali = null; List<Avviso> totali = null;
String stato = pratica.getStatoPratica(); String stato = pratica.getStatoPratica();
if (Validator.isNotNull(stato) && Validator.isNotNull(pratica.getTipoProcedura())
&& pratica.getTipoPratica().equalsIgnoreCase(Constants.TIPO_PRATICA_DEPOSITO)) {
// Dettaglio pratica
DettPratica dettPratica = null;
try {
dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica
.getIntPraticaId());
} catch (SystemException e) {
}
if (Validator.isNotNull(dettPratica)) {
// Avvisi conformi // Avvisi conformi
try { try {
avvisi = AvvisoLocalServiceUtil.findByIntPraticaId_tipoDocumento( avvisi = AvvisoLocalServiceUtil.findByIntPraticaId_tipoDocumento(
@ -466,7 +431,18 @@ public class SismicaUtil {
} catch (SystemException e) { } catch (SystemException e) {
totali = new ArrayList<>(); totali = new ArrayList<>();
} }
if (Validator.isNotNull(stato) && Validator.isNotNull(pratica.getTipoProcedura())
&& pratica.getTipoPratica().equalsIgnoreCase(Constants.TIPO_PRATICA_DEPOSITO)) {
// Dettaglio pratica
DettPratica dettPratica = null;
try {
dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica
.getIntPraticaId());
} catch (SystemException e) {
}
if (Validator.isNotNull(dettPratica)) {
// Controllo pratica // Controllo pratica
List<ControlloPratica> controlli = null; List<ControlloPratica> controlli = null;
try { try {
@ -480,24 +456,18 @@ public class SismicaUtil {
controllo = controlli.get(controlli.size() - 1); 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)) if ((avvisi.size() == 0 && stato.equalsIgnoreCase(StatoPraticaConstants.VIDIMATA))
|| (totali.size() <= 1 && stato || (totaliOk && stato.equalsIgnoreCase(StatoPraticaConstants.CONFORME))) {
.equalsIgnoreCase(StatoPraticaConstants.CONFORME))) {
_log.info("Pratica " + pratica.getNumeroProgetto() + "avvisi.size() = "
+ avvisi.size() + ", stato = " + stato);
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(dettPratica.getCompanyId()); serviceContext.setCompanyId(dettPratica.getCompanyId());
serviceContext.setScopeGroupId(dettPratica.getGroupId()); serviceContext.setScopeGroupId(dettPratica.getGroupId());
serviceContext.setUserId(dettPratica.getUserId()); serviceContext.setUserId(dettPratica.getUserId());
if (Validator.isNull(controllo)) { if (Validator.isNull(controllo)) {
esito.add("Progetto: " + pratica.getNumeroProgetto() + " ("
+ pratica.getIntPraticaId() + "), procedura="
+ pratica.getTipoProcedura() + ", avvisi=" + totali.size()
+ ", stato=" + pratica.getStatoPratica() + ", controlli="
+ controlli.size());
try { try {
controllo = ControlloPraticaLocalServiceUtil.addControlloPratica( controllo = ControlloPraticaLocalServiceUtil.addControlloPratica(
dettPratica.getGroupId(), dettPratica.getUserId(), dettPratica.getGroupId(), dettPratica.getUserId(),
@ -521,6 +491,16 @@ public class SismicaUtil {
fileEntryIdTemplate = 0; 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)) { if (Validator.isNotNull(fileEntryIdTemplate)) {
try { try {
if (!pratica.getTipoProcedura().equalsIgnoreCase( if (!pratica.getTipoProcedura().equalsIgnoreCase(

4
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
## ##
build.namespace=portos_bo build.namespace=portos_bo
build.number=2457 build.number=2458
build.date=1601477974273 build.date=1601547633470
build.auto.upgrade=true build.auto.upgrade=true
## ##

53
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.StreamUtil;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil; 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.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.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.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.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.html.core.HtmlToPdfEngine;
import it.tref.liferay.portos.report.jasper.core.provider.JasperPdfProvider; import it.tref.liferay.portos.report.jasper.core.provider.JasperPdfProvider;
import it.tref.liferay.portos.report.jasper.core.report.BeanReport; 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 fileName = title + StringPool.PERIOD + "pdf";
String mimeType = MimeTypesUtil.getContentType(fileName); 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 serviceContext = new ServiceContext();
serviceContext.setCompanyId(companyId); serviceContext.setCompanyId(companyId);
serviceContext.setUserId(userId); serviceContext.setUserId(userId);
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
_log.info("addFileEntry userId=" + userId + ", repositoryId=" + repositoryId + ", folderId=" _log.info("addFileEntry userId=" + userId + ", repositoryId=" + repositoryId + ", folderId="
+ folderId + ", sourceFileName=" + fileName + ", mimeType=" + mimeType + ", title=" + folderId + ", sourceFileName=" + fileName + ", mimeType=" + mimeType + ", title="
@ -240,7 +190,6 @@ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseIm
fileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, false, bytes, fileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, false, bytes,
serviceContext); serviceContext);
} catch (PortalException e) { } catch (PortalException e) {
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, fileName, fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, fileName,
mimeType, title, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext); mimeType, title, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
} }

4
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
## ##
build.namespace=portos_rep build.namespace=portos_rep
build.number=23 build.number=24
build.date=1601539162910 build.date=1601549245732
build.auto.upgrade=true build.auto.upgrade=true
## ##

Caricamento…
Annulla
Salva