diff --git a/liferay-plugins-sdk-6.2/.ivy/ivy-2.4.0.jar b/liferay-plugins-sdk-6.2/.ivy/ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar similarity index 73% rename from liferay-plugins-sdk-6.2/.ivy/ivy-2.4.0.jar rename to liferay-plugins-sdk-6.2/.ivy/ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar index 14ff88e2..4d15fc75 100644 Binary files a/liferay-plugins-sdk-6.2/.ivy/ivy-2.4.0.jar and b/liferay-plugins-sdk-6.2/.ivy/ivy-2.4.0.LIFERAY-PATCHED-1-SNAPSHOT.jar differ diff --git a/liferay-plugins-sdk-6.2/build.properties b/liferay-plugins-sdk-6.2/build.properties index efc4a0ce..037bc22d 100644 --- a/liferay-plugins-sdk-6.2/build.properties +++ b/liferay-plugins-sdk-6.2/build.properties @@ -337,8 +337,8 @@ ivy.custom.settings.file=${sdk.dir}/ivy-settings.xml ivy.home=${sdk.dir}/.ivy - ivy.jar.url=http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar - #ivy.jar.url=http://cdn.repository.liferay.com/nexus/content/repositories/liferay-snapshots-ce/com/liferay/org.apache.ivy/${ivy.version}/org.apache.ivy-${ivy.version}.jar + #ivy.jar.url=http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar + ivy.jar.url=https://cdn.lfrs.sl/repository.liferay.com/nexus/content/repositories/liferay-public-snapshots/com/liferay/org.apache.ivy/${ivy.version}/org.apache.ivy-${ivy.version}.jar ivy.log.level=quiet ivy.pom.developer.name=Brian Wing Shun Chan @@ -352,8 +352,8 @@ ivy.resolve.transitive.dependencies=true ivy.resolve.transitive.dependencies.test=true - ivy.version=2.4.0 - #ivy.version=2.4.0.LIFERAY-PATCHED-1-SNAPSHOT + #ivy.version=2.4.0 + ivy.version=2.4.0.LIFERAY-PATCHED-1-SNAPSHOT ## ## JMX diff --git a/liferay-plugins-sdk-6.2/ivy-settings.xml b/liferay-plugins-sdk-6.2/ivy-settings.xml index e4b51893..df236df3 100644 --- a/liferay-plugins-sdk-6.2/ivy-settings.xml +++ b/liferay-plugins-sdk-6.2/ivy-settings.xml @@ -2,13 +2,20 @@ - + + - + - + + + org.opensaml + https://build.shibboleth.net/nexus/content/repositories/releases + + + \ 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/portlet/AllegatiManualiPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/AllegatiManualiPortlet.java index 684c4020..16f6455e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/AllegatiManualiPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/AllegatiManualiPortlet.java @@ -44,116 +44,116 @@ import com.liferay.util.bridges.mvc.MVCPortlet; public class AllegatiManualiPortlet extends MVCPortlet { - private Log _log = LogFactoryUtil.getLog(AllegatiManualiPortlet.class); - - public void uploadAllegatoManuale(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, - SystemException { - try { - UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); - ServiceContext serviceContext = ServiceContextFactory.getInstance(uploadRequest); - long intPraticaId = ParamUtil.getLong(uploadRequest, "intPraticaId"); - long dettPraticaId = ParamUtil.getLong(uploadRequest, "dettPraticaId"); - String descrizione = ParamUtil.getString(uploadRequest, "descrizione"); - String sourceFileName = uploadRequest.getFileName("docFile"); - File file = uploadRequest.getFile("docFile"); - - if (Validator.isNotNull(sourceFileName) && file != null) { - // lunghezza fissata a 200 - if (sourceFileName.length() > 200) { - SessionErrors.add(actionRequest, "error.geniocivilefe.allegato.manuale.length.valid"); - } - } else { - SessionErrors.add(actionRequest, "error.geniocivilefe.allegato.manuale.is.request"); - } - - if (!SessionErrors.isEmpty(actionRequest)) { - PortalUtil.copyRequestParameters(actionRequest, actionResponse); - } else { - if (Validator.isNotNull(intPraticaId) && Validator.isNotNull(dettPraticaId)) { - byte[] content = FileUtil.getBytes(file); - - AllegatoManuale allegatoManuale = - AllegatoManualeLocalServiceUtil.addAllegatoManuale(serviceContext.getUserId(), intPraticaId, - dettPraticaId, descrizione, content, sourceFileName, serviceContext); - } - } - - PortalUtil.copyRequestParameters(actionRequest, actionResponse); - } catch (Exception e) { - PortalUtil.copyRequestParameters(actionRequest, actionResponse); - _log.error("Error", e); - throw new SystemException(e); - } - - } - - public void deleteAllegatoManuale(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { - long allegatoManualeId = ParamUtil.getLong(actionRequest, "allegatoManualeId"); - AllegatoManualeServiceUtil.deleteAllegatoManuale(allegatoManualeId); - } - - @Override - public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, - PortletException { - - String id = resourceRequest.getResourceID(); - - try { - if ("downloadAll".equals(id)) { - long intPraticaId = ParamUtil.getLong(resourceRequest, "intPraticaId"); - List docs = AllegatoManualeServiceUtil.findByIntPratica(intPraticaId); - - ZipWriter zipWriter = ZipWriterFactoryUtil.getZipWriter(); - - for (AllegatoManuale doc : docs) { - - InputStream inputStream = null; - try { - FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(doc.getFileEntryId()); - inputStream = - DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), fileEntry.getVersion(), false); - - String name = fileEntry.getTitle() + StringPool.PERIOD + fileEntry.getExtension(); - zipWriter.addEntry(name, inputStream); - } finally { - StreamUtil.cleanUp(inputStream); - } - } - - resourceResponse.reset(); - - File file = zipWriter.getFile(); - byte[] data = Files.readAllBytes(file.toPath()); - - resourceResponse.setContentType(ContentTypes.APPLICATION_ZIP); - resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate"); - resourceResponse - .addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getName() + "\""); - resourceResponse.setContentLength(data.length); - - resourceResponse.getPortletOutputStream().write(data); - resourceResponse.getPortletOutputStream().flush(); - resourceResponse.getPortletOutputStream().close(); - - } else if ("importFile".equals(id)) { - - long classPk = ParamUtil.getLong(resourceRequest, "classPk"); - String className = ParamUtil.getString(resourceRequest, "className"); - - FilesImporter.importaFile(classPk, className); - - PortletResponseUtil - .write( - resourceResponse, - "

Completato

Refresh"); - - } else { - super.serveResource(resourceRequest, resourceResponse); - } - } catch (PortalException | SystemException e) { - _log.error(e, e); - throw new IOException(e); - } - } + private Log _log = LogFactoryUtil.getLog(AllegatiManualiPortlet.class); + + public void uploadAllegatoManuale(ActionRequest actionRequest, ActionResponse actionResponse) + throws PortalException, SystemException { + try { + UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); + ServiceContext serviceContext = ServiceContextFactory.getInstance(uploadRequest); + long intPraticaId = ParamUtil.getLong(uploadRequest, "intPraticaId"); + long dettPraticaId = ParamUtil.getLong(uploadRequest, "dettPraticaId"); + String descrizione = ParamUtil.getString(uploadRequest, "descrizione"); + String sourceFileName = uploadRequest.getFileName("docFile"); + File file = uploadRequest.getFile("docFile"); + + if (Validator.isNotNull(sourceFileName) && file != null) { + // lunghezza fissata a 200 + if (sourceFileName.length() > 200) { + SessionErrors.add(actionRequest, "error.geniocivilefe.allegato.manuale.length.valid"); + } + } else { + SessionErrors.add(actionRequest, "error.geniocivilefe.allegato.manuale.is.request"); + } + + if (!SessionErrors.isEmpty(actionRequest)) { + PortalUtil.copyRequestParameters(actionRequest, actionResponse); + } else { + if (Validator.isNotNull(intPraticaId) && Validator.isNotNull(dettPraticaId)) { + byte[] content = FileUtil.getBytes(file); + + AllegatoManualeLocalServiceUtil + .addAllegatoManuale(serviceContext.getUserId(), intPraticaId, dettPraticaId, + descrizione, content, sourceFileName, serviceContext); + } + } + + PortalUtil.copyRequestParameters(actionRequest, actionResponse); + } catch (Exception e) { + PortalUtil.copyRequestParameters(actionRequest, actionResponse); + _log.error("Error", e); + throw new SystemException(e); + } + + } + + public void deleteAllegatoManuale(ActionRequest actionRequest, ActionResponse actionResponse) + throws Exception { + long allegatoManualeId = ParamUtil.getLong(actionRequest, "allegatoManualeId"); + AllegatoManualeServiceUtil.deleteAllegatoManuale(allegatoManualeId); + } + + @Override + public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) + throws IOException, PortletException { + + String id = resourceRequest.getResourceID(); + + try { + if ("downloadAll".equals(id)) { + long intPraticaId = ParamUtil.getLong(resourceRequest, "intPraticaId"); + List docs = AllegatoManualeServiceUtil.findByIntPratica(intPraticaId); + + ZipWriter zipWriter = ZipWriterFactoryUtil.getZipWriter(); + + for (AllegatoManuale doc : docs) { + + InputStream inputStream = null; + try { + FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(doc.getFileEntryId()); + inputStream = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getFileEntryId(), + fileEntry.getVersion(), false); + + String name = fileEntry.getTitle() + StringPool.PERIOD + fileEntry.getExtension(); + zipWriter.addEntry(name, inputStream); + } finally { + StreamUtil.cleanUp(inputStream); + } + } + + resourceResponse.reset(); + + File file = zipWriter.getFile(); + byte[] data = Files.readAllBytes(file.toPath()); + + resourceResponse.setContentType(ContentTypes.APPLICATION_ZIP); + resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate"); + resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + + file.getName() + "\""); + resourceResponse.setContentLength(data.length); + + resourceResponse.getPortletOutputStream().write(data); + resourceResponse.getPortletOutputStream().flush(); + resourceResponse.getPortletOutputStream().close(); + + } else if ("importFile".equals(id)) { + + long classPk = ParamUtil.getLong(resourceRequest, "classPk"); + String className = ParamUtil.getString(resourceRequest, "className"); + + FilesImporter.importaFile(classPk, className); + + PortletResponseUtil + .write(resourceResponse, + "

Completato

Refresh"); + + } else { + super.serveResource(resourceRequest, resourceResponse); + } + } catch (PortalException | SystemException e) { + _log.error(e, e); + throw new IOException(e); + } + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/SismicaAdministrationPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/SismicaAdministrationPortlet.java index 9b6dd8de..0e6186b5 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/SismicaAdministrationPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/SismicaAdministrationPortlet.java @@ -7,6 +7,7 @@ import it.tref.liferay.portos.bo.model.ControlloPratica; import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.DocPratica; import it.tref.liferay.portos.bo.model.IntPratica; +import it.tref.liferay.portos.bo.model.Pagamento; import it.tref.liferay.portos.bo.model.Sorteggio; import it.tref.liferay.portos.bo.model.Territorio; import it.tref.liferay.portos.bo.service.ConfigurazioneLocalService; @@ -17,6 +18,7 @@ import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DocPraticaLocalService; import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; +import it.tref.liferay.portos.bo.service.PagamentoLocalServiceUtil; import it.tref.liferay.portos.bo.service.SorteggioLocalServiceUtil; import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; import it.tref.liferay.portos.bo.service.persistence.DocPraticaPersistenceImpl; @@ -96,13 +98,21 @@ public class SismicaAdministrationPortlet extends MVCPortlet { public void sostituisciDL(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, PortalException, IOException { SismicaUtil.sostituisciDL(actionRequest, actionResponse); - Long userId = null; + long userId = 0; String title = null; String description = null; String mimeType = null; String changeLog = StringPool.BLANK; FileEntry fileEntry = null; Date now = new Date(); + long companyId = 0; + long groupId = 0; + long defaultFolderId = 0; + Folder defaultFolder = null; + String folderName = null; + byte[] bytes = null; + long folderId = 0; + long repositoryId = 0; ServiceContext serviceContext = new ServiceContext(); String className = ParamUtil.getString(actionRequest, "className"); @@ -117,18 +127,18 @@ public class SismicaAdministrationPortlet extends MVCPortlet { case "it.tref.liferay.portos.bo.model.DocPratica": DocPratica pratica = DocPraticaLocalServiceUtil.getDocPratica(idOggetto); userId = pratica.getUserId(); - long companyId = pratica.getCompanyId(); - long groupId = pratica.getGroupId(); + companyId = pratica.getCompanyId(); + groupId = pratica.getGroupId(); serviceContext.setCompanyId(companyId); serviceContext.setScopeGroupId(groupId); serviceContext.setUserId(userId); - long defaultFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); - Folder defaultFolder = DLAppLocalServiceUtil.getFolder(defaultFolderId); - String folderName = PraticaUtil.getFolderName(pratica.getClassPk()); - long folderId = defaultFolder.getFolderId(); - long repositoryId = defaultFolder.getRepositoryId(); + defaultFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); + defaultFolder = DLAppLocalServiceUtil.getFolder(defaultFolderId); + folderName = PraticaUtil.getFolderName(pratica.getClassPk()); + folderId = defaultFolder.getFolderId(); + repositoryId = defaultFolder.getRepositoryId(); try { folder = DLAppLocalServiceUtil.getFolder(repositoryId, folderId, folderName); @@ -137,16 +147,16 @@ public class SismicaAdministrationPortlet extends MVCPortlet { StringPool.BLANK, serviceContext); } - byte[] bytes = FileUtil.getBytes(file); + bytes = FileUtil.getBytes(file); title = pratica.getTipologia() + StringPool.UNDERLINE + sourceFileName; description = sourceFileName; mimeType = MimeTypesUtil.getContentType(sourceFileName); - try { + /*try { DLAppLocalServiceUtil.deleteFileEntry(pratica.getDlFileEntryId()); } catch(PortalException e){ - } + }*/ try { fileEntry = DLAppLocalServiceUtil.getFileEntry(pratica.getDlFileEntryId()); @@ -157,14 +167,61 @@ public class SismicaAdministrationPortlet extends MVCPortlet { fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, folder.getRepositoryId(), folder.getFolderId(), now.getTime() + "_" + sourceFileName, mimeType, title, description, changeLog, bytes, serviceContext); } - - /*fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, folder.getRepositoryId(), folder.getFolderId(), now.getTime() + "_" - + sourceFileName, mimeType, title, description, changeLog, bytes, serviceContext);*/ + pratica.setDlFileEntryId(fileEntry.getFileEntryId()); pratica.setSha256(DigestUtils.sha256Hex(bytes)); DocPraticaLocalServiceUtil.updateDocPratica(pratica); break; + case "it.tref.liferay.portos.bo.model.Pagamento": + Pagamento pagamento = PagamentoLocalServiceUtil.getPagamento(idOggetto); + userId = pagamento.getUserId(); + companyId = pagamento.getCompanyId(); + groupId = pagamento.getGroupId(); + + serviceContext.setCompanyId(companyId); + serviceContext.setScopeGroupId(groupId); + serviceContext.setUserId(userId); + + defaultFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); + defaultFolder = DLAppLocalServiceUtil.getFolder(defaultFolderId); + folderName = PraticaUtil.getFolderName(pagamento.getClassPk()); + folderId = defaultFolder.getFolderId(); + repositoryId = defaultFolder.getRepositoryId(); + + try { + folder = DLAppLocalServiceUtil.getFolder(repositoryId, folderId, folderName); + } catch (NoSuchFolderException e) { + folder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, folderId, folderName, + StringPool.BLANK, serviceContext); + } + + bytes = FileUtil.getBytes(file); + title = now.getTime() + StringPool.UNDERLINE + "pagamento_manuale" + StringPool.UNDERLINE + + pagamento.getPagamentoId() + StringPool.UNDERLINE + sourceFileName; + description = StringPool.BLANK; + mimeType = MimeTypesUtil.getContentType(sourceFileName); + + /*try { + DLAppLocalServiceUtil.deleteFileEntry(pagamento.getFileEntryId()); + } catch(PortalException e){ + + }*/ + + try { + fileEntry = DLAppLocalServiceUtil.getFileEntry(pagamento.getFileEntryId()); + fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntry.getFileEntryId(), + now.getTime() + "_" + sourceFileName, mimeType, title, description, changeLog, false, bytes, + serviceContext); + } catch (PortalException e) { + fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, folder.getRepositoryId(), folder.getFolderId(), now.getTime() + "_" + sourceFileName, + mimeType, title, description, changeLog, bytes, serviceContext); + } + + pagamento.setFileEntryId(fileEntry.getFileEntryId()); + PagamentoLocalServiceUtil.updatePagamento(pagamento); + break; + default: break; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AllegatoManualeLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AllegatoManualeLocalServiceImpl.java index 4656ebb4..31fc777b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AllegatoManualeLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AllegatoManualeLocalServiceImpl.java @@ -34,6 +34,7 @@ import com.liferay.portal.kernel.util.MimeTypesUtil; import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.model.User; +import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; import com.liferay.portlet.documentlibrary.NoSuchFolderException; @@ -121,6 +122,7 @@ public class AllegatoManualeLocalServiceImpl extends AllegatoManualeLocalService Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId); String folderName = PraticaUtil.getFolderName(dettPratica.getDettPraticaId()); + serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); Folder folder = null; try { folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), defaultFolder.getFolderId(), folderName); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java index 56092796..c29c7ed8 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java @@ -63,6 +63,7 @@ import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.model.User; +import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portlet.documentlibrary.NoSuchFileEntryException; @@ -577,6 +578,7 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase String folderName = PraticaUtil.getFolderName(dettPratica.getDettPraticaId()); + serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); Folder folder = null; try { folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), 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 7f570c65..2a633890 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 @@ -62,6 +62,7 @@ import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.model.User; +import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.service.ServiceContext; import com.liferay.portlet.documentlibrary.NoSuchFileEntryException; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; @@ -982,7 +983,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl { dynamicQuery.add(RestrictionsFactoryUtil.eq("fileEntryIdInvio", 0l)); dynamicQuery.add(RestrictionsFactoryUtil.ne("fileEntryIdBase", 0l)); dynamicQuery.add(RestrictionsFactoryUtil.eq("rifiutato", false)); - List avvisi = avvisoPersistence.findWithDynamicQuery(dynamicQuery); + List avvisi = avvisoPersistence.findWithDynamicQuery(dynamicQuery); return avvisi; } @@ -1083,6 +1084,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl { if (Validator.isNotNull(folder)) { byte[] bytes = Base64.decode(fileToSave); + serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(avviso.getUserId(), folder.getRepositoryId(), folderId, fileName, MimeTypesUtil.getContentType(fileName + ".p7m"), fileName + ".p7m", "", "", bytes, diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DocAggiuntivaLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DocAggiuntivaLocalServiceImpl.java index e1b24e19..6df51f79 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DocAggiuntivaLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DocAggiuntivaLocalServiceImpl.java @@ -31,6 +31,7 @@ import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.model.User; +import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.service.ServiceContext; import com.liferay.portlet.documentlibrary.NoSuchFileEntryException; import com.liferay.portlet.documentlibrary.NoSuchFolderException; @@ -141,6 +142,8 @@ public class DocAggiuntivaLocalServiceImpl extends DocAggiuntivaLocalServiceBase Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId); String folderName = PraticaUtil.getFolderName(dettPratica.getDettPraticaId()); + + serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); Folder folder = null; try { folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), defaultFolder.getFolderId(), folderName); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DocPraticaLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DocPraticaLocalServiceImpl.java index 54824b32..aa9c03b7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DocPraticaLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/DocPraticaLocalServiceImpl.java @@ -45,6 +45,7 @@ import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.workflow.WorkflowConstants; import com.liferay.portal.model.RoleConstants; import com.liferay.portal.model.User; +import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil; import com.liferay.portal.security.permission.PermissionThreadLocal; import com.liferay.portal.service.RoleLocalServiceUtil; @@ -57,13 +58,14 @@ import com.liferay.portlet.documentlibrary.NoSuchFolderException; * The implementation of the doc pratica local service. * *

- * All custom service methods should be put in this class. Whenever methods are added, rerun - * ServiceBuilder to copy their definitions into the + * All custom service methods should be put in this class. Whenever methods are + * added, rerun ServiceBuilder to copy their definitions into the * {@link it.tref.liferay.portos.bo.service.DocPraticaLocalService} interface. * *

- * This is a local service. Methods of this service will not have security checks based on the - * propagated JAAS credentials because this service can only be accessed from within the same VM. + * This is a local service. Methods of this service will not have security + * checks based on the propagated JAAS credentials because this service can only + * be accessed from within the same VM. *

* * @author Davide Barbagallo, 3F Consulting @@ -71,655 +73,667 @@ import com.liferay.portlet.documentlibrary.NoSuchFolderException; * @see it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil */ public class DocPraticaLocalServiceImpl extends DocPraticaLocalServiceBaseImpl { - /* - * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link - * it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil} to access the doc pratica local - * service. - */ - - private Log _log = LogFactoryUtil.getLog(DocPraticaLocalServiceImpl.class); - - @Override - public DocPratica deleteDocPratica(DocPratica docPratica) throws SystemException { + /* + * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use + * {@link it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil} to + * access the doc pratica local service. + */ + + private Log _log = LogFactoryUtil.getLog(DocPraticaLocalServiceImpl.class); + + @Override + public DocPratica deleteDocPratica(DocPratica docPratica) throws SystemException { + + try { + if (Validator.isNotNull(docPratica.getDlFileEntryId())) { + dlAppLocalService.deleteFileEntry(docPratica.getDlFileEntryId()); + } + } catch (NoSuchFileEntryException | NoSuchRepositoryEntryException e) { + + } catch (PortalException e) { + throw new SystemException(e); + } + return super.deleteDocPratica(docPratica); + } - try { - if (Validator.isNotNull(docPratica.getDlFileEntryId())) { - dlAppLocalService.deleteFileEntry(docPratica.getDlFileEntryId()); - } - } catch (NoSuchFileEntryException | NoSuchRepositoryEntryException e) { + @Override + public DocPratica deleteDocPratica(long docPraticaId) throws PortalException, SystemException { - } catch (PortalException e) { - throw new SystemException(e); - } - return super.deleteDocPratica(docPratica); - } + return deleteDocPratica(docPraticaLocalService.getDocPratica(docPraticaId)); + } - @Override - public DocPratica deleteDocPratica(long docPraticaId) throws PortalException, SystemException { + public DocPratica addDocPratica(long userId, String className, long classPk, long intPraticaId, + byte[] dlFileEntry, String fileName, String version, boolean praticaValidata, String descLong, + String tipologia, String sha256, boolean aggiornato, String jsonFirmatari, + long dettPraticaIdRimozione, Date dtDataRimozione, ServiceContext serviceContext) + throws PortalException, SystemException { - return deleteDocPratica(docPraticaLocalService.getDocPratica(docPraticaId)); - } + User user = userPersistence.findByPrimaryKey(userId); + + Date now = new Date(); + + validate(serviceContext.getScopeGroupId(), 0L, className, classPk, intPraticaId, dlFileEntry, + fileName, version, praticaValidata, descLong, tipologia, sha256, aggiornato, jsonFirmatari, + dettPraticaIdRimozione, dtDataRimozione); + + DocPratica docPratica = docPraticaPersistence.create(counterLocalService.increment(DocPratica.class + .getName())); + + FileEntry fileEntry = addAttachment(classPk, intPraticaId, userId, fileName, dlFileEntry, tipologia); + + docPratica.setCompanyId(serviceContext.getCompanyId()); + docPratica.setUserId(user.getUserId()); + docPratica.setUserName(user.getFullName()); + docPratica.setCreateDate(serviceContext.getCreateDate(now)); + docPratica.setModifiedDate(serviceContext.getModifiedDate(now)); + docPratica.setGroupId(serviceContext.getScopeGroupId()); + + docPratica.setClassName(className); + docPratica.setClassPk(classPk); + docPratica.setIntPraticaId(intPraticaId); + docPratica.setDlFileEntryId(fileEntry.getFileEntryId()); + docPratica.setVersion(version); + docPratica.setPraticaValidata(praticaValidata); + docPratica.setDescLong(descLong); + docPratica.setTipologia(tipologia); + docPratica.setSha256(sha256); + docPratica.setAggiornato(aggiornato); + docPratica.setJsonFirmatari(jsonFirmatari); + docPratica.setDettPraticaIdRimozione(dettPraticaIdRimozione); + docPratica.setDtDataRimozione(dtDataRimozione); + + docPratica.setStatus(WorkflowConstants.STATUS_PENDING); + + docPratica = docPraticaPersistence.update(docPratica); + + return docPratica; + } + + public DocPratica addDocPratica(long userId, String className, long classPk, long intPraticaId, + byte[] dlFileEntry, String fileName, String tipologia, String jsonFirmatari, + ServiceContext serviceContext) throws PortalException, SystemException { + + User user = userPersistence.findByPrimaryKey(userId); + + Date now = new Date(); + + DocPratica docPratica = docPraticaPersistence.create(counterLocalService.increment(DocPratica.class + .getName())); + + FileEntry fileEntry = addAttachment(classPk, intPraticaId, userId, fileName, dlFileEntry, tipologia); + + docPratica.setCompanyId(serviceContext.getCompanyId()); + docPratica.setUserId(user.getUserId()); + docPratica.setUserName(user.getFullName()); + docPratica.setCreateDate(serviceContext.getCreateDate(now)); + docPratica.setModifiedDate(serviceContext.getModifiedDate(now)); + docPratica.setGroupId(serviceContext.getScopeGroupId()); + + docPratica.setClassName(className); + docPratica.setClassPk(classPk); + docPratica.setIntPraticaId(intPraticaId); + docPratica.setDlFileEntryId(fileEntry.getFileEntryId()); + docPratica.setVersion("0"); + docPratica.setPraticaValidata(false); + docPratica.setDescLong(fileName); + docPratica.setTipologia(tipologia); + docPratica.setAggiornato(false); + docPratica.setJsonFirmatari(jsonFirmatari); + docPratica.setDettPraticaIdRimozione(0l); + docPratica.setDtDataRimozione(null); + + docPratica.setStatus(WorkflowConstants.STATUS_PENDING); + + docPratica = docPraticaPersistence.update(docPratica); + + return docPratica; + } + + public DocPratica addDocPratica(long userId, String className, long classPk, long intPraticaId, + long fileEntryId, String fileName, String tipologia, String jsonFirmatari, + ServiceContext serviceContext) throws PortalException, SystemException { + + User user = userPersistence.findByPrimaryKey(userId); + + Date now = new Date(); + + DocPratica docPratica = docPraticaPersistence.create(counterLocalService.increment(DocPratica.class + .getName())); + + docPratica.setCompanyId(serviceContext.getCompanyId()); + docPratica.setUserId(user.getUserId()); + docPratica.setUserName(user.getFullName()); + docPratica.setCreateDate(serviceContext.getCreateDate(now)); + docPratica.setModifiedDate(serviceContext.getModifiedDate(now)); + docPratica.setGroupId(serviceContext.getScopeGroupId()); + + docPratica.setClassName(className); + docPratica.setClassPk(classPk); + docPratica.setIntPraticaId(intPraticaId); + docPratica.setDlFileEntryId(fileEntryId); + docPratica.setVersion("0"); + docPratica.setPraticaValidata(false); + docPratica.setDescLong(fileName); + docPratica.setTipologia(tipologia); + docPratica.setAggiornato(false); + docPratica.setJsonFirmatari(jsonFirmatari); + docPratica.setDettPraticaIdRimozione(0l); + docPratica.setDtDataRimozione(null); + + docPratica.setStatus(WorkflowConstants.STATUS_PENDING); + + docPratica = docPraticaPersistence.update(docPratica); + + return docPratica; + } + + public DocPratica addDocPraticaForImport(long userId, String className, long classPk, long intPraticaId, + byte[] dlFileEntry, String fileName, String version, boolean praticaValidata, String descLong, + String tipologia, String sha256, boolean aggiornato, String jsonFirmatari, + long dettPraticaIdRimozione, Date dtDataRimozione, long oldDocPraticaId, + ServiceContext serviceContext) throws PortalException, SystemException { + + Date now = new Date(); + + validate(serviceContext.getScopeGroupId(), 0L, className, classPk, intPraticaId, dlFileEntry, + fileName, version, praticaValidata, descLong, tipologia, sha256, aggiornato, jsonFirmatari, + dettPraticaIdRimozione, dtDataRimozione); + + DocPratica docPratica = docPraticaPersistence.create(counterLocalService.increment(DocPratica.class + .getName())); + + docPratica.setCompanyId(serviceContext.getCompanyId()); + docPratica.setUserId(userId); + if (userId > 0) { + User user = userPersistence.findByPrimaryKey(userId); + docPratica.setUserName(user.getFullName()); + } + docPratica.setCreateDate(serviceContext.getCreateDate(now)); + docPratica.setModifiedDate(serviceContext.getModifiedDate(now)); + docPratica.setGroupId(serviceContext.getScopeGroupId()); + docPratica.setClassName(className); + docPratica.setClassPk(classPk); + docPratica.setIntPraticaId(intPraticaId); + docPratica.setVersion(version); + docPratica.setPraticaValidata(praticaValidata); + docPratica.setDescLong(descLong); + docPratica.setTipologia(tipologia); + docPratica.setSha256(sha256); + docPratica.setAggiornato(aggiornato); + docPratica.setJsonFirmatari(jsonFirmatari); + docPratica.setDettPraticaIdRimozione(dettPraticaIdRimozione); + docPratica.setDtDataRimozione(dtDataRimozione); + docPratica.setOldDocPraticaId(oldDocPraticaId); + + docPratica.setStatus(WorkflowConstants.STATUS_APPROVED); + + return docPraticaPersistence.update(docPratica); + } + + public FileEntry addAttachment(long classPk, long intPraticaId, long delegaUserId, String sourceFileName, + byte[] content, String tipoAllegato) throws SystemException, PortalException { + + FileEntry fileEntry = null; + + // DettPratica dettPratica = + // dettPraticaPersistence.fetchByPrimaryKey(dettPraticaId); + IntPratica intPratica = intPraticaPersistence.fetchByPrimaryKey(intPraticaId); + Territorio territorio = territorioPersistence.fetchByPrimaryKey(intPratica.getTerritorioId()); + + long companyId = territorio.getCompanyId(); + long groupId = territorio.getGroupId(); + + // TODO forse è meglio ragionare con un'altra logica per i permessi + User user = UserLocalServiceUtil.getRoleUsers( + RoleLocalServiceUtil.getRole(intPratica.getCompanyId(), RoleConstants.ADMINISTRATOR) + .getRoleId()).get(0); + try { + PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil.create(user)); + } catch (Exception e) { + throw new SystemException(e); + + } + long userId = user.getUserId(); + + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setCompanyId(companyId); + serviceContext.setScopeGroupId(groupId); + serviceContext.setUserId(userId); + serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); + + long defaultFolderId = configurazioneLocalService.findByC_ChiaveLong(companyId, + ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); + + Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId); + + String folderName = PraticaUtil.getFolderName(classPk); + + Folder folder = null; + try { + folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), + defaultFolder.getFolderId(), folderName); + } catch (NoSuchFolderException e) { + // cartella non presente -> creo cartella + folder = dlAppLocalService.addFolder(userId, defaultFolder.getRepositoryId(), + defaultFolder.getFolderId(), folderName, StringPool.BLANK, serviceContext); + } + Date now = new Date(); + String title = tipoAllegato + StringPool.UNDERLINE + sourceFileName; + String description = sourceFileName; + String mimeType = MimeTypesUtil.getContentType(sourceFileName); + + String changeLog = StringPool.BLANK; + fileEntry = dlAppLocalService.addFileEntry(userId, folder.getRepositoryId(), folder.getFolderId(), + now.getTime() + "_" + sourceFileName, mimeType, title, description, changeLog, content, + serviceContext); + + try { + PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil + .create(UserLocalServiceUtil.getUser(delegaUserId))); + } catch (Exception e) { + throw new SystemException(e); + + } + return fileEntry; + } + + public FileEntry getAttachment(long classPk) throws SystemException, PortalException { + + DocPratica fileAllegato = docPraticaPersistence.findByPrimaryKey(classPk); + return dlAppLocalService.getFileEntry(fileAllegato.getDlFileEntryId()); + } + + public void addFirma(long docPraticaId, String codiceFiscale) throws PortalException, SystemException { + + DocPratica docPratica = docPraticaLocalService.getDocPratica(docPraticaId); + docPratica.setJsonFirmatari(FirmeUtil.addFirma(docPratica.getJsonFirmatari(), codiceFiscale)); + docPraticaLocalService.updateDocPratica(docPratica); + } + + public void addFirmeAndApprova(long docPraticaId, List codiciFiscali) throws PortalException, + SystemException { + + DocPratica docPratica = docPraticaLocalService.getDocPratica(docPraticaId); + String jsonFirmatari = docPratica.getJsonFirmatari(); + for (String codiceFiscale : codiciFiscali) { + jsonFirmatari = FirmeUtil.addFirmaDigitale(jsonFirmatari, codiceFiscale); + } + docPratica.setJsonFirmatari(jsonFirmatari); + docPratica.setModifiedDate(new Date()); + docPratica.setStatus(WorkflowConstants.STATUS_APPROVED); + docPraticaLocalService.updateDocPratica(docPratica); + } - public DocPratica addDocPratica(long userId, String className, long classPk, long intPraticaId, byte[] dlFileEntry, - String fileName, String version, boolean praticaValidata, String descLong, String tipologia, String sha256, - boolean aggiornato, String jsonFirmatari, long dettPraticaIdRimozione, Date dtDataRimozione, - ServiceContext serviceContext) throws PortalException, SystemException { + public void addErrorAndApprova(long docPraticaId, String errorCode) throws PortalException, + SystemException { - User user = userPersistence.findByPrimaryKey(userId); + DocPratica docPratica = docPraticaLocalService.getDocPratica(docPraticaId); + docPratica.setModifiedDate(new Date()); + docPratica.setErrorCode(errorCode); + if ("400".equalsIgnoreCase(errorCode)) { + docPratica.setStatus(WorkflowConstants.STATUS_DENIED); + } + docPraticaLocalService.updateDocPratica(docPratica); + } - Date now = new Date(); + public void removeFirma(long docPraticaId, String codiceFiscale) throws PortalException, SystemException { - validate(serviceContext.getScopeGroupId(), 0L, className, classPk, intPraticaId, dlFileEntry, fileName, version, - praticaValidata, descLong, tipologia, sha256, aggiornato, jsonFirmatari, dettPraticaIdRimozione, - dtDataRimozione); - - - DocPratica docPratica = docPraticaPersistence.create(counterLocalService.increment(DocPratica.class.getName())); - - FileEntry fileEntry = addAttachment(classPk, intPraticaId, userId, fileName, dlFileEntry, tipologia); + DocPratica docPratica = docPraticaLocalService.getDocPratica(docPraticaId); + docPratica.setJsonFirmatari(FirmeUtil.removeFirma(docPratica.getJsonFirmatari(), codiceFiscale)); + docPraticaLocalService.updateDocPratica(docPratica); + } - docPratica.setCompanyId(serviceContext.getCompanyId()); - docPratica.setUserId(user.getUserId()); - docPratica.setUserName(user.getFullName()); - docPratica.setCreateDate(serviceContext.getCreateDate(now)); - docPratica.setModifiedDate(serviceContext.getModifiedDate(now)); - docPratica.setGroupId(serviceContext.getScopeGroupId()); + private void validate(long groupId, long docPraticaId, String className, long classPk, long intPraticaId, + byte[] dlFileEntry, String fileName, String version, boolean praticaValidata, String descLong, + String tipologia, String sha256, boolean aggiornato, String jsonFirmatari, + long dettPraticaIdRimozione, Date dtDataRimozione) throws PortalException, SystemException { - docPratica.setClassName(className); - docPratica.setClassPk(classPk); - docPratica.setIntPraticaId(intPraticaId); - docPratica.setDlFileEntryId(fileEntry.getFileEntryId()); - docPratica.setVersion(version); - docPratica.setPraticaValidata(praticaValidata); - docPratica.setDescLong(descLong); - docPratica.setTipologia(tipologia); - docPratica.setSha256(sha256); - docPratica.setAggiornato(aggiornato); - docPratica.setJsonFirmatari(jsonFirmatari); - docPratica.setDettPraticaIdRimozione(dettPraticaIdRimozione); - docPratica.setDtDataRimozione(dtDataRimozione); + // TODO Write your own validation code - docPratica.setStatus(WorkflowConstants.STATUS_PENDING); + } - docPratica = docPraticaPersistence.update(docPratica); + public DocPratica updateDocPraticaAggiornato(long docPraticaId, boolean aggiornato) + throws SystemException { - return docPratica; - } + DocPratica docPratica = docPraticaPersistence.fetchByPrimaryKey(docPraticaId); + docPratica.setAggiornato(aggiornato); + docPratica.setModifiedDate(new Date()); + return docPraticaLocalService.updateDocPratica(docPratica); + } - public DocPratica addDocPratica(long userId, String className, long classPk, long intPraticaId, byte[] dlFileEntry, - String fileName, String tipologia, String jsonFirmatari, ServiceContext serviceContext) throws PortalException, - SystemException { - - User user = userPersistence.findByPrimaryKey(userId); - - Date now = new Date(); - - DocPratica docPratica = docPraticaPersistence.create(counterLocalService.increment(DocPratica.class.getName())); - - FileEntry fileEntry = addAttachment(classPk, intPraticaId, userId, fileName, dlFileEntry, tipologia); - - docPratica.setCompanyId(serviceContext.getCompanyId()); - docPratica.setUserId(user.getUserId()); - docPratica.setUserName(user.getFullName()); - docPratica.setCreateDate(serviceContext.getCreateDate(now)); - docPratica.setModifiedDate(serviceContext.getModifiedDate(now)); - docPratica.setGroupId(serviceContext.getScopeGroupId()); - - docPratica.setClassName(className); - docPratica.setClassPk(classPk); - docPratica.setIntPraticaId(intPraticaId); - docPratica.setDlFileEntryId(fileEntry.getFileEntryId()); - docPratica.setVersion("0"); - docPratica.setPraticaValidata(false); - docPratica.setDescLong(fileName); - docPratica.setTipologia(tipologia); - docPratica.setAggiornato(false); - docPratica.setJsonFirmatari(jsonFirmatari); - docPratica.setDettPraticaIdRimozione(0l); - docPratica.setDtDataRimozione(null); - - docPratica.setStatus(WorkflowConstants.STATUS_PENDING); - - docPratica = docPraticaPersistence.update(docPratica); - - return docPratica; - } - - public DocPratica addDocPratica(long userId, String className, long classPk, long intPraticaId, long fileEntryId, - String fileName, String tipologia, String jsonFirmatari, ServiceContext serviceContext) throws PortalException, - SystemException { - - User user = userPersistence.findByPrimaryKey(userId); - - Date now = new Date(); - - DocPratica docPratica = docPraticaPersistence.create(counterLocalService.increment(DocPratica.class.getName())); - - docPratica.setCompanyId(serviceContext.getCompanyId()); - docPratica.setUserId(user.getUserId()); - docPratica.setUserName(user.getFullName()); - docPratica.setCreateDate(serviceContext.getCreateDate(now)); - docPratica.setModifiedDate(serviceContext.getModifiedDate(now)); - docPratica.setGroupId(serviceContext.getScopeGroupId()); + public int countDocPraticaDaInviareDax() throws SystemException { - docPratica.setClassName(className); - docPratica.setClassPk(classPk); - docPratica.setIntPraticaId(intPraticaId); - docPratica.setDlFileEntryId(fileEntryId); - docPratica.setVersion("0"); - docPratica.setPraticaValidata(false); - docPratica.setDescLong(fileName); - docPratica.setTipologia(tipologia); - docPratica.setAggiornato(false); - docPratica.setJsonFirmatari(jsonFirmatari); - docPratica.setDettPraticaIdRimozione(0l); - docPratica.setDtDataRimozione(null); - - docPratica.setStatus(WorkflowConstants.STATUS_PENDING); - - docPratica = docPraticaPersistence.update(docPratica); - - return docPratica; - } - - public DocPratica addDocPraticaForImport(long userId, String className, long classPk, long intPraticaId, - byte[] dlFileEntry, String fileName, String version, boolean praticaValidata, String descLong, String tipologia, - String sha256, boolean aggiornato, String jsonFirmatari, long dettPraticaIdRimozione, Date dtDataRimozione, - long oldDocPraticaId, ServiceContext serviceContext) throws PortalException, SystemException { - - Date now = new Date(); - - validate(serviceContext.getScopeGroupId(), 0L, className, classPk, intPraticaId, dlFileEntry, fileName, version, - praticaValidata, descLong, tipologia, sha256, aggiornato, jsonFirmatari, dettPraticaIdRimozione, - dtDataRimozione); - - - DocPratica docPratica = docPraticaPersistence.create(counterLocalService.increment(DocPratica.class.getName())); - - docPratica.setCompanyId(serviceContext.getCompanyId()); - docPratica.setUserId(userId); - if (userId > 0) { - User user = userPersistence.findByPrimaryKey(userId); - docPratica.setUserName(user.getFullName()); - } - docPratica.setCreateDate(serviceContext.getCreateDate(now)); - docPratica.setModifiedDate(serviceContext.getModifiedDate(now)); - docPratica.setGroupId(serviceContext.getScopeGroupId()); - docPratica.setClassName(className); - docPratica.setClassPk(classPk); - docPratica.setIntPraticaId(intPraticaId); - docPratica.setVersion(version); - docPratica.setPraticaValidata(praticaValidata); - docPratica.setDescLong(descLong); - docPratica.setTipologia(tipologia); - docPratica.setSha256(sha256); - docPratica.setAggiornato(aggiornato); - docPratica.setJsonFirmatari(jsonFirmatari); - docPratica.setDettPraticaIdRimozione(dettPraticaIdRimozione); - docPratica.setDtDataRimozione(dtDataRimozione); - docPratica.setOldDocPraticaId(oldDocPraticaId); - - docPratica.setStatus(WorkflowConstants.STATUS_APPROVED); - - return docPraticaPersistence.update(docPratica); - } - - public FileEntry addAttachment(long classPk, long intPraticaId, long delegaUserId, String sourceFileName, - byte[] content, String tipoAllegato) throws SystemException, PortalException { - - FileEntry fileEntry = null; - - // DettPratica dettPratica = dettPraticaPersistence.fetchByPrimaryKey(dettPraticaId); - IntPratica intPratica = intPraticaPersistence.fetchByPrimaryKey(intPraticaId); - Territorio territorio = territorioPersistence.fetchByPrimaryKey(intPratica.getTerritorioId()); - - long companyId = territorio.getCompanyId(); - long groupId = territorio.getGroupId(); - - // TODO forse è meglio ragionare con un'altra logica per i permessi - User user = - UserLocalServiceUtil.getRoleUsers( - RoleLocalServiceUtil.getRole(intPratica.getCompanyId(), RoleConstants.ADMINISTRATOR).getRoleId()).get(0); - try { - PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil.create(user)); - } catch (Exception e) { - throw new SystemException(e); - - } - long userId = user.getUserId(); - - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setCompanyId(companyId); - serviceContext.setScopeGroupId(groupId); - serviceContext.setUserId(userId); - - // TODO forse mettiamo i permesssi ma non mi pare sicuro. - - long defaultFolderId = - configurazioneLocalService.findByC_ChiaveLong(companyId, ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); - - Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId); - - String folderName = PraticaUtil.getFolderName(classPk); - - Folder folder = null; - try { - folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), defaultFolder.getFolderId(), folderName); - } catch (NoSuchFolderException e) { - // cartella non presente -> creo cartella - folder = - dlAppLocalService.addFolder(userId, defaultFolder.getRepositoryId(), defaultFolder.getFolderId(), folderName, - StringPool.BLANK, serviceContext); - } - Date now = new Date(); - String title = tipoAllegato + StringPool.UNDERLINE + sourceFileName; - String description = sourceFileName; - String mimeType = MimeTypesUtil.getContentType(sourceFileName); - - String changeLog = StringPool.BLANK; - fileEntry = - dlAppLocalService.addFileEntry(userId, folder.getRepositoryId(), folder.getFolderId(), now.getTime() + "_" - + sourceFileName, mimeType, title, description, changeLog, content, serviceContext); - - try { - PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil.create(UserLocalServiceUtil - .getUser(delegaUserId))); - } catch (Exception e) { - throw new SystemException(e); - - } - return fileEntry; - } - - public FileEntry getAttachment(long classPk) throws SystemException, PortalException { + DynamicQuery dynamicQuery = dynamicQueryDocPraticaDaInviareDax(); + return (int) docPraticaPersistence.countWithDynamicQuery(dynamicQuery); + } + + @SuppressWarnings("unchecked") + public List getDocPraticaDaInviareDax(int start, int end) throws SystemException { + + DynamicQuery dynamicQuery = dynamicQueryDocPraticaDaInviareDax(); + return docPraticaPersistence.findWithDynamicQuery(dynamicQuery, start, end); + } - DocPratica fileAllegato = docPraticaPersistence.findByPrimaryKey(classPk); - return dlAppLocalService.getFileEntry(fileAllegato.getDlFileEntryId()); - } - - public void addFirma(long docPraticaId, String codiceFiscale) throws PortalException, SystemException { - - DocPratica docPratica = docPraticaLocalService.getDocPratica(docPraticaId); - docPratica.setJsonFirmatari(FirmeUtil.addFirma(docPratica.getJsonFirmatari(), codiceFiscale)); - docPraticaLocalService.updateDocPratica(docPratica); - } + private DynamicQuery dynamicQueryDocPraticaDaInviareDax() { - public void addFirmeAndApprova(long docPraticaId, List codiciFiscali) throws PortalException, SystemException { + DynamicQuery dynamicQuery = docPraticaLocalService.dynamicQuery(); + dynamicQuery.add(PropertyFactoryUtil.forName("dtInvioDax").isNull()); + dynamicQuery.add(PropertyFactoryUtil.forName("daxId").eq(0L)); + dynamicQuery.add(PropertyFactoryUtil.forName("praticaValidata").eq(true)); + dynamicQuery.addOrder(OrderFactoryUtil.asc("createDate")); + return dynamicQuery; + } - DocPratica docPratica = docPraticaLocalService.getDocPratica(docPraticaId); - String jsonFirmatari = docPratica.getJsonFirmatari(); - for (String codiceFiscale : codiciFiscali) { - jsonFirmatari = FirmeUtil.addFirmaDigitale(jsonFirmatari, codiceFiscale); - } - docPratica.setJsonFirmatari(jsonFirmatari); - docPratica.setModifiedDate(new Date()); - docPratica.setStatus(WorkflowConstants.STATUS_APPROVED); - docPraticaLocalService.updateDocPratica(docPratica); - } + public int countByClassPk(long classPk) throws SystemException { - public void addErrorAndApprova(long docPraticaId, String errorCode) throws PortalException, SystemException { + return docPraticaPersistence.countByClassPk(classPk); + } - DocPratica docPratica = docPraticaLocalService.getDocPratica(docPraticaId); - docPratica.setModifiedDate(new Date()); - docPratica.setErrorCode(errorCode); - if ("400".equalsIgnoreCase(errorCode)) { - docPratica.setStatus(WorkflowConstants.STATUS_DENIED); - } - docPraticaLocalService.updateDocPratica(docPratica); - } + public List findByClassPk(long classPk, int start, int end) throws SystemException { - public void removeFirma(long docPraticaId, String codiceFiscale) throws PortalException, SystemException { + return docPraticaPersistence.findByClassPk(classPk, start, end); + } - DocPratica docPratica = docPraticaLocalService.getDocPratica(docPraticaId); - docPratica.setJsonFirmatari(FirmeUtil.removeFirma(docPratica.getJsonFirmatari(), codiceFiscale)); - docPraticaLocalService.updateDocPratica(docPratica); - } + public List findByIntPratica(long intPraticaId) throws SystemException { - private void validate(long groupId, long docPraticaId, String className, long classPk, long intPraticaId, - byte[] dlFileEntry, String fileName, String version, boolean praticaValidata, String descLong, String tipologia, - String sha256, boolean aggiornato, String jsonFirmatari, long dettPraticaIdRimozione, Date dtDataRimozione) - throws PortalException, SystemException { + return docPraticaPersistence.findByIntPratica(intPraticaId); + } - // TODO Write your own validation code + public List findByClassPk(long classPk) throws SystemException { + return docPraticaPersistence.findByClassPk(classPk); + } - } + public List findByStaus(int status, int start, int end, OrderByComparator order) + throws SystemException { - public DocPratica updateDocPraticaAggiornato(long docPraticaId, boolean aggiornato) throws SystemException { + return docPraticaPersistence.findByStatus(status, start, end, order); + } - DocPratica docPratica = docPraticaPersistence.fetchByPrimaryKey(docPraticaId); - docPratica.setAggiornato(aggiornato); - docPratica.setModifiedDate(new Date()); - return docPraticaLocalService.updateDocPratica(docPratica); - } + public int countByStatus(long status) throws SystemException { - public int countDocPraticaDaInviareDax() throws SystemException { + return docPraticaPersistence.countByStatus(status); + } - DynamicQuery dynamicQuery = dynamicQueryDocPraticaDaInviareDax(); - return (int) docPraticaPersistence.countWithDynamicQuery(dynamicQuery); - } + public int countByClassPk_Tipologia(long classPk, String tipologia) throws SystemException { - @SuppressWarnings("unchecked") - public List getDocPraticaDaInviareDax(int start, int end) throws SystemException { + return docPraticaPersistence.countByClassPk_Tipologia(classPk, tipologia); + } - DynamicQuery dynamicQuery = dynamicQueryDocPraticaDaInviareDax(); - return docPraticaPersistence.findWithDynamicQuery(dynamicQuery, start, end); - } + public List findByClassPk_Tipologia(long classPk, String tipologia, int start, int end) + throws SystemException { - private DynamicQuery dynamicQueryDocPraticaDaInviareDax() { + return docPraticaPersistence.findByClassPk_Tipologia(classPk, tipologia, start, end); + } - DynamicQuery dynamicQuery = docPraticaLocalService.dynamicQuery(); - dynamicQuery.add(PropertyFactoryUtil.forName("dtInvioDax").isNull()); - dynamicQuery.add(PropertyFactoryUtil.forName("daxId").eq(0L)); - dynamicQuery.add(PropertyFactoryUtil.forName("praticaValidata").eq(true)); - dynamicQuery.addOrder(OrderFactoryUtil.asc("createDate")); - return dynamicQuery; - } + public List findByIntPratica_Tipologia(long intPraticaId, String tipologia, int start, int end) + throws SystemException { - public int countByClassPk(long classPk) throws SystemException { + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").eq(tipologia)); + dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); + return soggettoPersistence.findWithDynamicQuery(dynamicQuery, start, end); + } - return docPraticaPersistence.countByClassPk(classPk); - } + public List findByIntPratica_ClassPk_Tipologia(long intPraticaId, long classPk, + String tipologia, int start, int end) throws SystemException { - public List findByClassPk(long classPk, int start, int end) throws SystemException { + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.le("classPk", classPk)); + dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").eq(tipologia)); + dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); + return dynamicQuery(dynamicQuery, start, end); + } - return docPraticaPersistence.findByClassPk(classPk, start, end); - } + public List findByIntPratica_ClassPk_Tipologie(long intPraticaId, long classPk, + List tipologie) throws SystemException { - public List findByIntPratica(long intPraticaId) throws SystemException { + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.le("classPk", classPk)); + dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").in(tipologie)); + dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); + return dynamicQuery(dynamicQuery); + } - return docPraticaPersistence.findByIntPratica(intPraticaId); - } + public List findByIntPratica_ClassPkEqual_Tipologie(long intPraticaId, long classPk, + List tipologie) throws SystemException { - public List findByClassPk(long classPk) throws SystemException { + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.eq("classPk", classPk)); + dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").in(tipologie)); + dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); + return dynamicQuery(dynamicQuery); + } - return docPraticaPersistence.findByClassPk(classPk); - } + public DocPratica fetchByC_Group_DlFileEntry_Version(long dlFileEntryId, String version) + throws SystemException { - public List findByStaus(int status, int start, int end, OrderByComparator order) throws SystemException { + return docPraticaPersistence.fetchByDlFileEntry_Version(dlFileEntryId, version); + } - return docPraticaPersistence.findByStatus(status, start, end, order); - } + public DocPratica fetchByOldDocPraticaId(long oldDocPraticaId) throws SystemException { - public int countByStatus(long status) throws SystemException { + return docPraticaPersistence.fetchByOldDocPratica(oldDocPraticaId); + } - return docPraticaPersistence.countByStatus(status); - } + public List findDistinctDlFileEntryId(long classPk, String tipologia, int start, int end) + throws SystemException { - public int countByClassPk_Tipologia(long classPk, String tipologia) throws SystemException { + return findDistinctDlFileEntryId(new long[] { classPk }, tipologia, start, end); + } - return docPraticaPersistence.countByClassPk_Tipologia(classPk, tipologia); - } + public List findDistinctDlFileEntryId(long[] classPks, String tipologia, int start, int end) + throws SystemException { - public List findByClassPk_Tipologia(long classPk, String tipologia, int start, int end) - throws SystemException { + DynamicQuery dynamicQuery = docPraticaLocalService.dynamicQuery(); + dynamicQuery.setProjection(ProjectionFactoryUtil.distinct(ProjectionFactoryUtil + .property("dlFileEntryId"))); + dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").eq(tipologia)); + Junction or = RestrictionsFactoryUtil.disjunction(); + for (long classPk : classPks) { + or.add(PropertyFactoryUtil.forName("classPk").eq(classPk)); + } + dynamicQuery.add(or); + dynamicQuery.addOrder(OrderFactoryUtil.desc("dlFileEntryId")); + return docPraticaPersistence.findWithDynamicQuery(dynamicQuery, start, end); + } - return docPraticaPersistence.findByClassPk_Tipologia(classPk, tipologia, start, end); - } + public List getValidByIntPratica(long intPraticaId) throws SystemException { - public List findByIntPratica_Tipologia(long intPraticaId, String tipologia, int start, int end) - throws SystemException { + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.eq("dettPraticaIdRimozione", null)); + dynamicQuery.addOrder(OrderFactoryUtil.asc("dettPraticaIdRimozione")); + return dynamicQuery(dynamicQuery); + } + + public List getValidByIntPratica_Tipologia(long intPraticaId, String tipologia, int start, + int end) throws SystemException { + + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.eq("tipologia", tipologia)); + dynamicQuery.add(RestrictionsFactoryUtil.eq("rimosso", false)); + dynamicQuery.addOrder(OrderFactoryUtil.asc("dettPraticaIdRimozione")); + return dynamicQuery(dynamicQuery, start, end); + } + + public int countValidTmpByIntPratica_Tipologia(long intPraticaId, String tipologia) + throws SystemException { + + DynamicQuery dynamicQuery = createvalidTmpQueryByIntPratica(intPraticaId); + dynamicQuery.add(RestrictionsFactoryUtil.eq("tipologia", tipologia)); + + return (int) docPraticaPersistence.countWithDynamicQuery(dynamicQuery); + } + + public List getValidTmpByIntPratica_Tipologia(long intPraticaId, String tipologia, int start, + int end) throws SystemException { + + DynamicQuery dynamicQuery = createvalidTmpQueryByIntPratica(intPraticaId); + dynamicQuery.add(RestrictionsFactoryUtil.eq("tipologia", tipologia)); + + dynamicQuery.addOrder(OrderFactoryUtil.asc("dettPraticaIdRimozione")); + return dynamicQuery(dynamicQuery, start, end); + } + + public List getValidTmpByIntPratica_DettPratica_Tipologia(long intPraticaId, + long dettPraticaId, String tipologia, int start, int end) throws SystemException { - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").eq(tipologia)); - dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); - return soggettoPersistence.findWithDynamicQuery(dynamicQuery, start, end); - } + DynamicQuery dynamicQuery = createvalidTmpQueryByIntPratica(intPraticaId); + dynamicQuery.add(RestrictionsFactoryUtil.eq("tipologia", tipologia)); + dynamicQuery.add(RestrictionsFactoryUtil.eq("classPk", dettPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.eq("className", DettPratica.class.getName())); - public List findByIntPratica_ClassPk_Tipologia(long intPraticaId, long classPk, String tipologia, - int start, int end) throws SystemException { + dynamicQuery.addOrder(OrderFactoryUtil.asc("dettPraticaIdRimozione")); + return dynamicQuery(dynamicQuery, start, end); + } - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.le("classPk", classPk)); - dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").eq(tipologia)); - dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); - return dynamicQuery(dynamicQuery, start, end); - } + public List getValidTmpByIntPratica_Tipologie(long intPraticaId, String[] tipologie, + int start, int end) throws SystemException { - public List findByIntPratica_ClassPk_Tipologie(long intPraticaId, long classPk, List tipologie) - throws SystemException { + DynamicQuery dynamicQuery = createvalidTmpQueryByIntPratica(intPraticaId); + dynamicQuery.add(RestrictionsFactoryUtil.in("tipologia", tipologie)); + + dynamicQuery.addOrder(OrderFactoryUtil.asc("dettPraticaIdRimozione")); + return dynamicQuery(dynamicQuery, start, end); + } + + public int countValidTmpByIntPratica_Tipologie(long intPraticaId, String[] tipologie) + throws SystemException { + + DynamicQuery dynamicQuery = createvalidTmpQueryByIntPratica(intPraticaId); + dynamicQuery.add(RestrictionsFactoryUtil.in("tipologia", tipologie)); - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.le("classPk", classPk)); - dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").in(tipologie)); - dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); - return dynamicQuery(dynamicQuery); - } + return (int) docPraticaPersistence.countWithDynamicQuery(dynamicQuery); + } - public List findByIntPratica_ClassPkEqual_Tipologie(long intPraticaId, long classPk, - List tipologie) throws SystemException { + private DynamicQuery createvalidTmpQueryByIntPratica(long intPraticaId) { - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.eq("classPk", classPk)); - dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").in(tipologie)); - dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); - return dynamicQuery(dynamicQuery); - } + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.eq("dettPraticaIdRimozione", null)); + + return dynamicQuery; + } + + public List getInvalidByIntPratica(long intPraticaId) throws SystemException { + + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.ne("rimosso", false)); + dynamicQuery.addOrder(OrderFactoryUtil.desc("dettPraticaIdRimozione")); + return dynamicQuery(dynamicQuery); + } + + public List getInvalidTmpByIntPratica(long intPraticaId) throws SystemException { + + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.ne("dettPraticaIdRimozione", null)); + dynamicQuery.addOrder(OrderFactoryUtil.desc("dettPraticaIdRimozione")); + return dynamicQuery(dynamicQuery); + } + + public List getValidUntilClassPkByIntPratica(long intPraticaId, long classPk, + String tipologia, int start, int end) throws SystemException { + + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.le("classPk", classPk)); + dynamicQuery.add(RestrictionsFactoryUtil.eq("tipologia", tipologia)); + // dynamicQuery.add(RestrictionsFactoryUtil.eq("dettPraticaIdRimozione", + // null)); + dynamicQuery.add(RestrictionsFactoryUtil.eq("rimosso", false)); + dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); + return dynamicQuery(dynamicQuery, start, end); + } + + public void completeInvalidation(long intPraticaId) throws SystemException { + + Date now = new Date(); + List allegatiDaInvalidare = getInvalidTmpByIntPratica(intPraticaId); + for (DocPratica docPratica : allegatiDaInvalidare) { + docPratica.setRimosso(true); + docPratica.setDtDataRimozione(now); + + docPratica = updateDocPratica(docPratica); + } + } + + public List getDocPraticaWithOldFileEntryId(int start, int end) throws SystemException { + + DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(DocPratica.class); + dynamicQuery.add(PropertyFactoryUtil.forName("oldDlFileEntryId").ne(0L)); + dynamicQuery.addOrder(OrderFactoryUtil.desc("oldDlFileEntryId")); + + return docPraticaLocalService.dynamicQuery(dynamicQuery, start, end); + } + + // ADT BUG FE ID = 9 + public DocPratica addDocPraticaAnnullamento(long userId, String className, long classPk, + long intPraticaId, long fileEntryId, String fileName, String tipologia, String sha256, + String jsonFirmatari, ServiceContext serviceContext) throws PortalException, SystemException { + + User user = userPersistence.findByPrimaryKey(userId); + + Date now = new Date(); + + DocPratica docPratica = docPraticaPersistence.create(counterLocalService.increment(DocPratica.class + .getName())); + + docPratica.setCompanyId(serviceContext.getCompanyId()); + docPratica.setUserId(user.getUserId()); + docPratica.setUserName(user.getFullName()); + docPratica.setCreateDate(serviceContext.getCreateDate(now)); + docPratica.setModifiedDate(serviceContext.getModifiedDate(now)); + docPratica.setGroupId(serviceContext.getScopeGroupId()); + + docPratica.setClassName(className); + docPratica.setClassPk(classPk); + docPratica.setIntPraticaId(intPraticaId); + docPratica.setDlFileEntryId(fileEntryId); + docPratica.setVersion("0"); + docPratica.setPraticaValidata(false); + docPratica.setDescLong(fileName); + docPratica.setTipologia(tipologia); + docPratica.setSha256(sha256); + docPratica.setAggiornato(false); + docPratica.setJsonFirmatari(jsonFirmatari); + docPratica.setDettPraticaIdRimozione(0l); + docPratica.setDtDataRimozione(null); + + docPratica.setStatus(WorkflowConstants.STATUS_PENDING); + + docPratica = docPraticaPersistence.update(docPratica); + + return docPratica; + } + + /** + * Metodo nuovo ADT + * + * @param intPraticaId + * @param classPk + * @param tipologia + * @param start + * @param end + * @return + * @throws SystemException + */ + public List findByIntPratica_ClassPk_TipologiaNew(long intPraticaId, long classPk, + String tipologia, int start, int end) throws SystemException { + + DynamicQuery dynamicQuery = dynamicQuery(); + dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); + dynamicQuery.add(RestrictionsFactoryUtil.eq("classPk", classPk)); + dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").eq(tipologia)); + dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); + return dynamicQuery(dynamicQuery, start, end); + } - public DocPratica fetchByC_Group_DlFileEntry_Version(long dlFileEntryId, String version) throws SystemException { - - return docPraticaPersistence.fetchByDlFileEntry_Version(dlFileEntryId, version); - } - - public DocPratica fetchByOldDocPraticaId(long oldDocPraticaId) throws SystemException { - - return docPraticaPersistence.fetchByOldDocPratica(oldDocPraticaId); - } - - public List findDistinctDlFileEntryId(long classPk, String tipologia, int start, int end) - throws SystemException { - - return findDistinctDlFileEntryId(new long[] {classPk}, tipologia, start, end); - } - - public List findDistinctDlFileEntryId(long[] classPks, String tipologia, int start, int end) - throws SystemException { - - DynamicQuery dynamicQuery = docPraticaLocalService.dynamicQuery(); - dynamicQuery.setProjection(ProjectionFactoryUtil.distinct(ProjectionFactoryUtil.property("dlFileEntryId"))); - dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").eq(tipologia)); - Junction or = RestrictionsFactoryUtil.disjunction(); - for (long classPk : classPks) { - or.add(PropertyFactoryUtil.forName("classPk").eq(classPk)); - } - dynamicQuery.add(or); - dynamicQuery.addOrder(OrderFactoryUtil.desc("dlFileEntryId")); - return docPraticaPersistence.findWithDynamicQuery(dynamicQuery, start, end); - } - - public List getValidByIntPratica(long intPraticaId) throws SystemException { - - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.eq("dettPraticaIdRimozione", null)); - dynamicQuery.addOrder(OrderFactoryUtil.asc("dettPraticaIdRimozione")); - return dynamicQuery(dynamicQuery); - } - - public List getValidByIntPratica_Tipologia(long intPraticaId, String tipologia, int start, int end) - throws SystemException { - - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.eq("tipologia", tipologia)); - dynamicQuery.add(RestrictionsFactoryUtil.eq("rimosso", false)); - dynamicQuery.addOrder(OrderFactoryUtil.asc("dettPraticaIdRimozione")); - return dynamicQuery(dynamicQuery, start, end); - } - - public int countValidTmpByIntPratica_Tipologia(long intPraticaId, String tipologia) throws SystemException { - - DynamicQuery dynamicQuery = createvalidTmpQueryByIntPratica(intPraticaId); - dynamicQuery.add(RestrictionsFactoryUtil.eq("tipologia", tipologia)); - - return (int) docPraticaPersistence.countWithDynamicQuery(dynamicQuery); - } - - public List getValidTmpByIntPratica_Tipologia(long intPraticaId, String tipologia, int start, int end) - throws SystemException { - - DynamicQuery dynamicQuery = createvalidTmpQueryByIntPratica(intPraticaId); - dynamicQuery.add(RestrictionsFactoryUtil.eq("tipologia", tipologia)); - - dynamicQuery.addOrder(OrderFactoryUtil.asc("dettPraticaIdRimozione")); - return dynamicQuery(dynamicQuery, start, end); - } - - public List getValidTmpByIntPratica_DettPratica_Tipologia(long intPraticaId, long dettPraticaId, String tipologia, int start, int end) - throws SystemException { - - DynamicQuery dynamicQuery = createvalidTmpQueryByIntPratica(intPraticaId); - dynamicQuery.add(RestrictionsFactoryUtil.eq("tipologia", tipologia)); - dynamicQuery.add(RestrictionsFactoryUtil.eq("classPk", dettPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.eq("className", DettPratica.class.getName())); - - dynamicQuery.addOrder(OrderFactoryUtil.asc("dettPraticaIdRimozione")); - return dynamicQuery(dynamicQuery, start, end); - } - - public List getValidTmpByIntPratica_Tipologie(long intPraticaId, String[] tipologie, int start, int end) - throws SystemException { - - DynamicQuery dynamicQuery = createvalidTmpQueryByIntPratica(intPraticaId); - dynamicQuery.add(RestrictionsFactoryUtil.in("tipologia", tipologie)); - - dynamicQuery.addOrder(OrderFactoryUtil.asc("dettPraticaIdRimozione")); - return dynamicQuery(dynamicQuery, start, end); - } - - public int countValidTmpByIntPratica_Tipologie(long intPraticaId, String[] tipologie) throws SystemException { - - DynamicQuery dynamicQuery = createvalidTmpQueryByIntPratica(intPraticaId); - dynamicQuery.add(RestrictionsFactoryUtil.in("tipologia", tipologie)); - - return (int) docPraticaPersistence.countWithDynamicQuery(dynamicQuery); - } - - private DynamicQuery createvalidTmpQueryByIntPratica(long intPraticaId) { - - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.eq("dettPraticaIdRimozione", null)); - - return dynamicQuery; - } - - public List getInvalidByIntPratica(long intPraticaId) throws SystemException { - - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.ne("rimosso", false)); - dynamicQuery.addOrder(OrderFactoryUtil.desc("dettPraticaIdRimozione")); - return dynamicQuery(dynamicQuery); - } - - public List getInvalidTmpByIntPratica(long intPraticaId) throws SystemException { - - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.ne("dettPraticaIdRimozione", null)); - dynamicQuery.addOrder(OrderFactoryUtil.desc("dettPraticaIdRimozione")); - return dynamicQuery(dynamicQuery); - } - - public List getValidUntilClassPkByIntPratica(long intPraticaId, long classPk, String tipologia, - int start, int end) throws SystemException { - - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.le("classPk", classPk)); - dynamicQuery.add(RestrictionsFactoryUtil.eq("tipologia", tipologia)); - // dynamicQuery.add(RestrictionsFactoryUtil.eq("dettPraticaIdRimozione", null)); - dynamicQuery.add(RestrictionsFactoryUtil.eq("rimosso", false)); - dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); - return dynamicQuery(dynamicQuery, start, end); - } - - public void completeInvalidation(long intPraticaId) throws SystemException { - - Date now = new Date(); - List allegatiDaInvalidare = getInvalidTmpByIntPratica(intPraticaId); - for (DocPratica docPratica : allegatiDaInvalidare) { - docPratica.setRimosso(true); - docPratica.setDtDataRimozione(now); - - docPratica = updateDocPratica(docPratica); - } - } - - public List getDocPraticaWithOldFileEntryId(int start, int end) throws SystemException { - - DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(DocPratica.class); - dynamicQuery.add(PropertyFactoryUtil.forName("oldDlFileEntryId").ne(0L)); - dynamicQuery.addOrder(OrderFactoryUtil.desc("oldDlFileEntryId")); - - return docPraticaLocalService.dynamicQuery(dynamicQuery, start, end); - } - -//ADT BUG FE ID = 9 - public DocPratica addDocPraticaAnnullamento(long userId, String className, long classPk, long intPraticaId, long fileEntryId, - String fileName, String tipologia, String sha256, String jsonFirmatari, ServiceContext serviceContext) throws PortalException, - SystemException { - - User user = userPersistence.findByPrimaryKey(userId); - - Date now = new Date(); - - DocPratica docPratica = docPraticaPersistence.create(counterLocalService.increment(DocPratica.class.getName())); - - docPratica.setCompanyId(serviceContext.getCompanyId()); - docPratica.setUserId(user.getUserId()); - docPratica.setUserName(user.getFullName()); - docPratica.setCreateDate(serviceContext.getCreateDate(now)); - docPratica.setModifiedDate(serviceContext.getModifiedDate(now)); - docPratica.setGroupId(serviceContext.getScopeGroupId()); - - docPratica.setClassName(className); - docPratica.setClassPk(classPk); - docPratica.setIntPraticaId(intPraticaId); - docPratica.setDlFileEntryId(fileEntryId); - docPratica.setVersion("0"); - docPratica.setPraticaValidata(false); - docPratica.setDescLong(fileName); - docPratica.setTipologia(tipologia); - docPratica.setSha256(sha256); - docPratica.setAggiornato(false); - docPratica.setJsonFirmatari(jsonFirmatari); - docPratica.setDettPraticaIdRimozione(0l); - docPratica.setDtDataRimozione(null); - - docPratica.setStatus(WorkflowConstants.STATUS_PENDING); - - docPratica = docPraticaPersistence.update(docPratica); - - return docPratica; - } - - - /** - *Metodo nuovo ADT - * - * @param intPraticaId - * @param classPk - * @param tipologia - * @param start - * @param end - * @return - * @throws SystemException - */ - public List findByIntPratica_ClassPk_TipologiaNew(long intPraticaId, long classPk, String tipologia, - int start, int end) throws SystemException { - - DynamicQuery dynamicQuery = dynamicQuery(); - dynamicQuery.add(RestrictionsFactoryUtil.eq("intPraticaId", intPraticaId)); - dynamicQuery.add(RestrictionsFactoryUtil.eq("classPk", classPk)); - dynamicQuery.add(PropertyFactoryUtil.forName("tipologia").eq(tipologia)); - dynamicQuery.addOrder(OrderFactoryUtil.desc("classPk")); - return dynamicQuery(dynamicQuery, start, end); - } - } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java index b0e5d684..82f96da1 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java @@ -74,6 +74,7 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; + import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang.StringUtils; @@ -107,6 +108,7 @@ import com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil; import com.liferay.portal.kernel.workflow.WorkflowTask; import com.liferay.portal.model.User; import com.liferay.portal.model.WorkflowInstanceLink; +import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.security.permission.PermissionThreadLocal; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserLocalServiceUtil; @@ -1133,6 +1135,7 @@ public class IntPraticaLocalServiceImpl extends IntPraticaLocalServiceBaseImpl { String folderName = PraticaUtil.getFolderName(dettPratica.getDettPraticaId()); + serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); Folder folder = null; try { folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/PagamentoLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/PagamentoLocalServiceImpl.java index 09eeb388..9669c7ba 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/PagamentoLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/PagamentoLocalServiceImpl.java @@ -44,6 +44,7 @@ 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.User; +import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.service.ServiceContext; import com.liferay.portlet.documentlibrary.NoSuchFolderException; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; @@ -67,7 +68,8 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; * @see it.tref.liferay.portos.bo.service.PagamentoLocalServiceUtil */ public class PagamentoLocalServiceImpl extends PagamentoLocalServiceBaseImpl { - private static final Log _log = LogFactoryUtil.getLog(PagamentoLocalServiceImpl.class); + private static final Log _log = LogFactoryUtil.getLog(PagamentoLocalServiceImpl.class); + /* * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use * {@link it.tref.liferay.portos.bo.service.PagamentoLocalServiceUtil} to @@ -272,7 +274,6 @@ public class PagamentoLocalServiceImpl extends PagamentoLocalServiceBaseImpl { return updatePagamento(pagamento); } - @SuppressWarnings("unchecked") public List findByCommittente_Mezzo(String codiceFiscaleCommittente, String mezzo, int start, int end) throws SystemException { @@ -289,7 +290,6 @@ public class PagamentoLocalServiceImpl extends PagamentoLocalServiceBaseImpl { return (int) pagamentoPersistence.countWithDynamicQuery(dynamicQuery); } - @SuppressWarnings("unchecked") public List findByCommittente_Mezzo_Utilizzata(String codiceFiscaleCommittente, String mezzo, String utilizzata, int start, int end) throws SystemException { @@ -585,6 +585,7 @@ public class PagamentoLocalServiceImpl extends PagamentoLocalServiceBaseImpl { String folderName = PraticaUtil.getFolderName(pagamento.getClassPk()); + serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); Folder folder = null; try { folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), @@ -644,6 +645,7 @@ public class PagamentoLocalServiceImpl extends PagamentoLocalServiceBaseImpl { String folderName = PraticaUtil.getFolderName(pagamento.getClassPk()); + serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); Folder folder = null; try { folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ParereGeologoLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ParereGeologoLocalServiceImpl.java index cb2ca483..374f6860 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ParereGeologoLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ParereGeologoLocalServiceImpl.java @@ -31,6 +31,7 @@ import com.liferay.portal.kernel.util.MimeTypesUtil; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.model.User; +import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portlet.documentlibrary.NoSuchFileEntryException; @@ -116,6 +117,7 @@ public class ParereGeologoLocalServiceImpl extends ParereGeologoLocalServiceBase Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId); String folderName = PraticaUtil.getFolderName(parereGeologo.getDettPraticaId()); + serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); Folder folder = null; try { folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), 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 e192abab..10b78447 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=2474 - build.date=1602313407057 + build.number=2477 + build.date=1602754023327 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp index a64996f4..cf5baf36 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp @@ -169,6 +169,8 @@ String dataProssimoSorteggio = + diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/service.properties index c4af8e02..9e4f6817 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_calendar_appointments - build.number=173 - build.date=1576157134948 + build.number=174 + build.date=1602593587481 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/calendar.jsp b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/calendar.jsp index f373ee8e..ac84ed62 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/calendar.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/html/calendar_appointments/tabs/calendar.jsp @@ -24,7 +24,7 @@ if(isIstruttoreForOrgs){ selectedOrganizationId = "" + defaultBoUserOrganization; } else { - selectedOrganizationId = "21055"; + selectedOrganizationId = "14287050"; } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view_accordion.jsp b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view_accordion.jsp index c5714f13..9bc5ed52 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view_accordion.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/allegatipratica/view_accordion.jsp @@ -1,3 +1,5 @@ +<%@page import="com.liferay.portal.kernel.log.LogFactoryUtil"%> +<%@page import="com.liferay.portal.kernel.log.Log"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="it.tref.liferay.portos.bo.shared.util.PortletKeys"%> <%@page import="it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil"%> @@ -38,9 +40,10 @@ <%@page import="java.util.LinkedHashMap"%> <%@page import="java.util.Map.Entry"%> -<%@ include file="/html/allegatipratica/init.jsp" %> +<%@ include file="/html/allegatipratica/init.jsp"%> <% + Log _log = LogFactoryUtil.getLog("view_accordion.jsp"); String comingFrom = ParamUtil.getString(request,"comingFrom", GetterUtil.getString( PortalUtil.getOriginalServletRequest(request).getParameter("page_allegati"), @@ -88,27 +91,25 @@ tipologiaAllegati.add(DocumentiPraticaUtil.TIPOLOGIA_ALLEGATO_ANNULLAMENTO_FASCICOLO); type="ad"; } - %> - - - - - - + + + + + + -
- - - - - -
+
+ + + + +
<% - for(String codiceDoc:tipologiaAllegati){ List docPraticas; if(fullVersion){ @@ -118,175 +119,166 @@ docPraticas = DocPraticaServiceUtil.getValidUntilClassPkByIntPratica(intPraticaId, classPk, codiceDoc, QueryUtil.ALL_POS, QueryUtil.ALL_POS); } %> -
-
- -
- <% +
+
+ +
+ <% if(!docPraticas.isEmpty()){ %> - - - - - - - - <%-- <% if(!comingFrom.equals("page_va_allegati") && !comingFrom.equals("page_in_allegati") ) { %> --%> - - - <%-- <% } %> --%> - - - - - <% + +
STATOALLEGATOFIRMEAGGIUNTO DAINVALIDATO DAAZIONI
+ + + + + + <%-- <% if(!comingFrom.equals("page_va_allegati") && !comingFrom.equals("page_in_allegati") ) { %> --%> + + + <%-- <% } %> --%> + + + + + <% for(DocPratica docPratica:docPraticas){ - long docPraticaId = docPratica.getDocPraticaId(); + long docPraticaId = docPratica.getDocPraticaId(); + _log.info("Processo docPratica id = "+docPraticaId); %> - - - - + + + + <%-- <% if(!comingFrom.equals("page_va_allegati") && !comingFrom.equals("page_in_allegati") ) { %> --%> + - <%-- <% if(!comingFrom.equals("page_va_allegati") && !comingFrom.equals("page_in_allegati") ) { %> --%> - - - <%-- <% + + + <%-- <% } %> --%> - - - - - <% + + + + + <% } %> - -
STATOALLEGATOFIRMEAGGIUNTO DAINVALIDATO DAAZIONI
- - - <%= docPratica.getFileName() %> - - <% - FirmeBean firme = FirmeUtil.deserialize(docPratica.getJsonFirmatari()); - StringBuilder title = new StringBuilder(); - if(firme.numeroFirme()>0){ - if(!firme.getFirmeDigitali().isEmpty()){ - title.append("Firma sul file:
    "); - for(FirmeDetail firma: firme.getFirmeDigitali()){ - title.append("
  • "+firma.getCfFirmatario()); - if(Validator.isNotNull(firma.getDtFirma())){ - title.append(" del "+dateFormatDate.format(firma.getDtFirma())); - } - title.append("
  • "); - } - title.append("
"); - } - if(!firme.getFirmeApplicativo().isEmpty()){ - title.append("Firme da applicativo:
    "); - for(FirmeDetail firma: firme.getFirmeApplicativo()){ - title.append("
  • "+firma.getCfFirmatario()); - if(Validator.isNotNull(firma.getDtFirma())){ - title.append(" del "+dateFormatDate.format(firma.getDtFirma())); - } - title.append("
  • "); - } - title.append("
"); - } - } - if(firme.numeroFirme()>0){ - %> - - <%=firme.numeroFirme() %> - - <% - }else{ - %> - - <% - } +
+ <%=docPratica.getFileName()%> + <% + FirmeBean firme = FirmeUtil.deserialize(docPratica.getJsonFirmatari()); + StringBuilder title = new StringBuilder(); + if(firme.numeroFirme()>0){ + if(!firme.getFirmeDigitali().isEmpty()){ + title.append("Firma sul file:
    "); + for(FirmeDetail firma: firme.getFirmeDigitali()){ + title.append("
  • "+firma.getCfFirmatario()); + if(Validator.isNotNull(firma.getDtFirma())){ + title.append(" del "+dateFormatDate.format(firma.getDtFirma())); + } + title.append("
  • "); + } + title.append("
"); + } + if(!firme.getFirmeApplicativo().isEmpty()){ + title.append("Firme da applicativo:
    "); + for(FirmeDetail firma: firme.getFirmeApplicativo()){ + title.append("
  • "+firma.getCfFirmatario()); + if(Validator.isNotNull(firma.getDtFirma())){ + title.append(" del "+dateFormatDate.format(firma.getDtFirma())); + } + title.append("
  • "); + } + title.append("
"); + } + } + if(firme.numeroFirme()>0){ + %> <%=firme.numeroFirme()%> + <% + }else{ + %> <% + } + %> +
+ <% + String description = StringPool.BLANK; + + if(DettPratica.class.getName().equalsIgnoreCase(docPratica.getClassName())){ + DettPratica adding = DettPraticaLocalServiceUtil.fetchDettPratica(docPratica.getClassPk()); + if(adding!=null){ + description = adding.getFullDescription() ; + } + }else if(FineLavori.class.getName().equalsIgnoreCase(docPratica.getClassName())){ + FineLavori adding = FineLavoriLocalServiceUtil.fetchFineLavori(docPratica.getClassPk()); + if(adding!=null){ + description = adding.getFullDescription() ; + } + }else if(Collaudo.class.getName().equalsIgnoreCase(docPratica.getClassName())){ + Collaudo adding = CollaudoLocalServiceUtil.fetchCollaudo(docPratica.getClassPk()); + if(adding!=null){ + description = adding.getFullDescription() ; + } + } + + out.print(description); %> - - <% - String description = StringPool.BLANK; - - if(DettPratica.class.getName().equalsIgnoreCase(docPratica.getClassName())){ - DettPratica adding = DettPraticaLocalServiceUtil.fetchDettPratica(docPratica.getClassPk()); - if(adding!=null){ - description = adding.getFullDescription() ; - } - }else if(FineLavori.class.getName().equalsIgnoreCase(docPratica.getClassName())){ - FineLavori adding = FineLavoriLocalServiceUtil.fetchFineLavori(docPratica.getClassPk()); - if(adding!=null){ - description = adding.getFullDescription() ; - } - }else if(Collaudo.class.getName().equalsIgnoreCase(docPratica.getClassName())){ - Collaudo adding = CollaudoLocalServiceUtil.fetchCollaudo(docPratica.getClassPk()); - if(adding!=null){ - description = adding.getFullDescription() ; - } - } - - out.print(description); - %> - - <% - DettPratica removing = DettPraticaLocalServiceUtil.fetchDettPratica(docPratica.getDettPraticaIdRimozione()); - if(removing != null){ - %> - <%= removing.getFullDescription() %> - <% - } - %> - + <% + DettPratica removing = DettPraticaLocalServiceUtil.fetchDettPratica(docPratica.getDettPraticaIdRimozione()); + if(removing != null){ + %> <%=removing.getFullDescription()%> <% + } + %> + - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + +
+ + <% } %> -
+
<% } %> \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/edit_fascicolo.jsp b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/edit_fascicolo.jsp index 640845eb..2783b8b0 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/edit_fascicolo.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/edit_fascicolo.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.liferay.portal.kernel.util.HttpUtil"%> <%@page import="it.tref.liferay.portos.bo.shared.util.PortletKeys"%> <%@page import="it.tref.liferay.portos.bo.shared.util.TipoIntegrazioneUtil"%> @@ -13,7 +12,6 @@ <%@page import="com.liferay.portal.kernel.util.ArrayUtil"%> <%@ include file="/html/fascicolofe/init.jsp" %> - <% String backURL = ParamUtil.getString(request, "backURL"); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/navigator/common/save_actions.jspf b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/navigator/common/save_actions.jspf index 429cb50f..63698e4a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/navigator/common/save_actions.jspf +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/navigator/common/save_actions.jspf @@ -1,6 +1,11 @@ +<%@page import="it.tref.liferay.portos.bo.shared.util.PortletKeys"%> +<%@page import="com.liferay.portal.kernel.language.LanguageUtil"%> +<%@page import="it.tref.liferay.portos.bo.model.Delega"%> +<%@page import="com.liferay.portal.kernel.util.ParamUtil"%> +<%@page import="com.liferay.portal.kernel.log.Log"%> +<%@page import="com.liferay.portal.kernel.log.LogFactoryUtil"%> <%@page import="com.liferay.portal.kernel.util.Validator"%> <%@page import="it.tref.liferay.portos.bo.shared.util.TipoSoggettoUtil"%> -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="javax.portlet.PortletResponse"%> <%@page import="com.liferay.portal.model.Portlet"%> <%@page import="java.util.HashMap"%> @@ -21,73 +26,74 @@ <%@page import="it.tref.liferay.portos.bo.service.DelegaLocalServiceUtil"%> <%@page import="it.tref.liferay.portos.bo.util.AsseverazioniUtil"%> <%@page import="it.tref.liferay.portos.bo.util.DelegheUtil"%> -
+
<% + Log _log = LogFactoryUtil.getLog("save_actions.jspf"); + String randomId = StringUtil.randomId(); String formName = "fmDomande"; - String buttonId = "fmbuttonsalvaconferma_"+randomId; - String buttonAsseverazioneId = "fmbuttonasseverazione_"+randomId; - String script = - "var el_relazioni = $('textarea[name=_" + PortletKeys.FASCICOLOFE + "_{{prefix}}Relazioni]');" + - "if (el_relazioni.length) {" + - "var el_coniugio = $('input[name=_" + PortletKeys.FASCICOLOFE + "_{{prefix}}Coniugio]');" + - "var el_coniugiochk = $('input[name=_" + PortletKeys.FASCICOLOFE + "_{{prefix}}Coniugio]:checked');" + - - "console.log('length: ' + el_relazioni.length);" + - - "var err_coniugio = (el_coniugiochk.length == 0);" + - "var err_relazioni = ((el_relazioni.val().replace(/\\s*/g, '').length < 10) && (el_coniugiochk.val() == 1));" + - - "el_coniugio.parent().css({color:(err_coniugio ? '#a94442' : '#333')});" + - "el_relazioni.css({'border-color':(err_relazioni ?'#a94442' : '#ccc')});" + - - "if (err_coniugio || err_relazioni) {" + - "$('#" + renderResponse.getNamespace() + "{{prefix}}SaveAndCloseDiv_" + randomId + "').parent().scrollTop(0);" + - "return false;" + - "}" + - "}" + - "saveDettPratica(false, '{{type}}');"; + String buttonId = "fmbuttonsalvaconferma_" + randomId; + String buttonAsseverazioneId = "fmbuttonasseverazione_" + randomId; + String script = "var el_relazioni = $('textarea[name=_" + + PortletKeys.FASCICOLOFE + + "_{{prefix}}Relazioni]');" + + "if (el_relazioni.length) {" + + "var el_coniugio = $('input[name=_" + + PortletKeys.FASCICOLOFE + + "_{{prefix}}Coniugio]');" + + "var el_coniugiochk = $('input[name=_" + + PortletKeys.FASCICOLOFE + + "_{{prefix}}Coniugio]:checked');" + + + + "console.log('length: ' + el_relazioni.length);" + + + + "var err_coniugio = (el_coniugiochk.length == 0);" + + "var err_relazioni = ((el_relazioni.val().replace(/\\s*/g, '').length < 10) && (el_coniugiochk.val() == 1));" + + + + "el_coniugio.parent().css({color:(err_coniugio ? '#a94442' : '#333')});" + + "el_relazioni.css({'border-color':(err_relazioni ?'#a94442' : '#ccc')});" + + + "if (err_coniugio || err_relazioni) {" + "$('#" + renderResponse.getNamespace() + + "{{prefix}}SaveAndCloseDiv_" + randomId + "').parent().scrollTop(0);" + "return false;" + + "}" + "}" + "saveDettPratica(false, '{{type}}');"; %> - - - - - - + + + + + + - - - + + + - - - + + + - - - + + + <% - boolean isEsente = dettPratica.getNormEsenteBollo() && dettPratica.getNormEsenteSpese(); - boolean isIntegrazione = dettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE); + boolean isEsente = dettPratica.getNormEsenteBollo() + && dettPratica.getNormEsenteSpese(); + boolean isIntegrazione = dettPratica.getTipoIntegrazione().equals( + TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE); %> <%-- --%> <% - Map dataMap = new HashMap(); - dataMap.put("id", renderResponse.getNamespace()+"openVerificaFascicolo"); + Map dataMap = new HashMap(); + dataMap.put("id", renderResponse.getNamespace() + "openVerificaFascicolo"); %> - - + + - - - + + + - + + linkCssClass='<%=ValidazionePraticaUtil.canCompleteIntegrazione(dettPraticaId) ? "btn btn-primary" + : "btn btn-primary disabled"%>' + iconCssClass="fa fa-check" message="Concludi Integrazione" url="<%=completeIntegrazioneURL%>" + data="<%=dataMap%>" /> - - - - + + + + - + + linkCssClass='<%=ValidazionePraticaUtil.canCompleteDettPraticaEsente(dettPraticaId) ? "btn btn-primary" + : "btn btn-primary disabled"%>' + iconCssClass="fa fa-check" useDialog="<%=true%>" message="Concludi Domanda" + url="<%=completeDomandaEsenteURL%>" data="<%=dataMap%>" /> - - + + - + - - - - <% + + + + <% long delegaId = ParamUtil.getLong(request, "delegaId"); - Delega delega = DelegaLocalServiceUtil.getDelega(delegaId); - boolean validated = true; - StringBuilder tooltipSection = new StringBuilder(); - if(delega.getTipologia().equalsIgnoreCase(DelegheUtil.TIPO_GEOLOGO)){ - //List notCompleted = ValidazionePraticaUtil.notCompletedSection(SezioniUtil.SEZIONE_GEOLOGICA, dettPraticaId); - List notCompleted = ValidazionePraticaUtil.hasDelegaGeologoCompleted(dettPraticaId); - if(!notCompleted.isEmpty()){ - validated = false; - tooltipSection.append("
    "); - for(String incomplete : notCompleted){ - tooltipSection.append("
  • "+LanguageUtil.get(pageContext, incomplete)+"
  • "); - } - tooltipSection.append("
"); - } - } + if (delegaId == 0) { + _log.error("Errore pratica id " + intPratica.getIntPraticaId() + ", utente " + + user.getScreenName() + ", delegaId = 0"); + } + Delega delega = DelegaLocalServiceUtil.getDelega(delegaId); + boolean validated = true; + StringBuilder tooltipSection = new StringBuilder(); + if (delega.getTipologia().equalsIgnoreCase(DelegheUtil.TIPO_GEOLOGO)) { + //List notCompleted = ValidazionePraticaUtil.notCompletedSection(SezioniUtil.SEZIONE_GEOLOGICA, dettPraticaId); + List notCompleted = ValidazionePraticaUtil + .hasDelegaGeologoCompleted(dettPraticaId); + if (!notCompleted.isEmpty()) { + validated = false; + tooltipSection.append("
    "); + for (String incomplete : notCompleted) { + tooltipSection.append("
  • " + + LanguageUtil.get(pageContext, incomplete) + "
  • "); + } + tooltipSection.append("
"); + } + } %> - + <% - String buttonIdVerifica = "fmbuttonverifica_"+randomId; + String buttonIdVerifica = "fmbuttonverifica_" + randomId; %> - - + +