From 7231c41224be8c250e655d94063a746d0ab6d426 Mon Sep 17 00:00:00 2001 From: E-A B Date: Wed, 11 Jan 2023 11:47:38 +0100 Subject: [PATCH] diff portlets,themes,webs --- .../NoSuchRichiestaAccessoAttiException.java | 26 +- .../atti/portlet/AccessoAttiBOPortlet.java | 395 +++++++++----- .../atti/portlet/AccessoAttiFEPortlet.java | 338 ++++++++---- .../CreazioneAccountPortosPortlet.java | 48 +- ...estaAccessoAttiLocalServiceClpInvoker.java | 22 +- .../RichiestaAccessoAttiLocalServiceImpl.java | 257 ++++++--- .../impl/RichiestaAccessoAttiServiceImpl.java | 37 +- .../atti/uti/AccessoAttiAccessTokenUtil.java | 32 +- .../accesso/atti/uti/DocumentLibraryUtil.java | 57 +- .../accesso/atti/uti/EmailSenderUtil.java | 142 +++-- .../html/accesso_atti_bo/add_richiesta.jsp | 246 +++++---- .../DuplicateFunzionarioException.java | 21 +- .../DuplicatePrenotazioneException.java | 21 +- .../DuplicateProfessionistaException.java | 21 +- .../NoSuchDisponibilitaException.java | 21 +- .../NoSuchFunzionarioException.java | 21 +- .../NoSuchPrenotazioneException.java | 21 +- .../NoSuchProfessionistaException.java | 21 +- .../SlotNotAvailableException.java | 21 +- .../docroot/WEB-INF/liferay-portlet.xml | 8 +- .../portlet/CompanyConfigurationPortlet.java | 18 +- .../html/company_configuration/init.jsp | 1 - .../html/company_configuration/view.jsp | 29 +- .../docroot/html/init.jsp | 1 - .../portos/cookies/action/StartUpAction.java | 163 +++--- .../portos-cookies-portlet/docroot/init.jsp | 1 - .../portos-cookies-portlet/docroot/view.jsp | 1 - .../docroot/WEB-INF/portlet.xml | 5 +- .../deployalert/action/DeployAction.java | 128 +++-- .../deployalert/constants/MailConstants.java | 9 +- .../control/DeployAlertControl.java | 23 +- .../portlet/NotificatorPortlet.java | 100 ++-- .../impl/NotificationLogLocalServiceImpl.java | 86 +-- .../NotificationMailLocalServiceImpl.java | 227 ++++---- .../NotificationLogPersistenceImpl.java | 1 - .../NotificationMailPersistenceImpl.java | 1 - .../deployalert/util/DeployAlertUtil.java | 157 +++--- .../docroot/html/init.jsp | 1 - .../html/notificator/edit_notification.jsp | 1 - .../docroot/html/notificator/init.jsp | 1 - .../docroot/html/notificator/view.jsp | 1 - .../docroot/WEB-INF/liferay-hook.xml | 2 +- .../docroot/WEB-INF/liferay-portlet.xml | 10 +- .../model/impl/KaleoInstanceImpl.java | 38 +- .../controller/model/impl/KaleoNodeImpl.java | 38 +- .../impl/KaleoTaskAssignmentInstanceImpl.java | 42 +- .../controller/model/impl/KaleoTaskImpl.java | 38 +- .../impl/KaleoTaskInstanceTokenImpl.java | 39 +- .../KaleoInstancePersistenceImpl.java | 3 +- .../KaleoInstanceTokenPersistenceImpl.java | 3 +- .../persistence/KaleoLogPersistenceImpl.java | 3 +- .../persistence/KaleoNodePersistenceImpl.java | 3 +- ...TaskAssignmentInstancePersistenceImpl.java | 3 +- ...KaleoTaskInstanceTokenPersistenceImpl.java | 3 +- .../persistence/KaleoTaskPersistenceImpl.java | 3 +- .../docroot/WEB-INF/liferay-hook.xml | 2 +- .../docroot/WEB-INF/service.xml | 136 ++--- .../portos/kaleo/ddm/FormDDMDisplay.java | 83 ++- .../portos/kaleo/model/impl/FormLogImpl.java | 34 +- .../model/impl/FormTemplateLinkImpl.java | 35 +- ...flowFormAdminPortletControlPanelEntry.java | 19 +- .../docroot/WEB-INF/liferay-hook.xml | 6 +- .../log/action/LogRequestPostAction.java | 2 +- .../liferay/log/action/LogStartupAction.java | 5 +- .../liferay/log/constants/LogConstants.java | 18 +- .../log/constants/LogDestinationNames.java | 11 +- .../liferay/log/constants/LogFormat.java | 51 +- .../portos-log-portlet/docroot/html/init.jsp | 1 - .../portos-log-portlet/docroot/view.jsp | 1 - .../docroot/WEB-INF/liferay-display.xml | 2 +- .../docroot/WEB-INF/liferay-hook.xml | 2 +- .../docroot/WEB-INF/service.xml | 225 +++----- .../docroot/WEB-INF/sql/indexes.properties | 6 +- .../docroot/WEB-INF/sql/indexes.sql | 5 +- .../docroot/WEB-INF/sql/tables.sql | 6 + .../messaging/MailManagerMessageListener.java | 24 +- .../impl/EmailAttachmentLocalServiceImpl.java | 183 +++---- .../service/impl/EmailLocalServiceImpl.java | 285 +++++----- .../impl/EmailTemplateLocalServiceImpl.java | 399 +++++++------- .../portos/mailmanager/util/MailEngine.java | 16 +- .../mailmanager/util/MailManagerUtil.java | 2 + .../html/common/email_dialog_attachment.jsp | 1 - .../docroot/html/email_templates/edit.jsp | 1 - .../email_send_popup_button.jsp | 1 - .../email_templates/email_template_action.jsp | 1 - .../docroot/html/email_templates/init.jsp | 1 - .../send_popup/close_popup.jsp | 1 - .../html/email_templates/send_popup/init.jsp | 1 - .../html/email_templates/send_popup/view.jsp | 1 - .../docroot/html/email_templates/toolbar.jsp | 1 - .../docroot/html/email_templates/view.jsp | 1 - .../docroot/html/init.jsp | 3 +- .../docroot/html/mail_manager/edit.jsp | 1 - .../html/mail_manager/email_action.jsp | 1 - .../email_history_popup_button.jsp | 1 - .../docroot/html/mail_manager/init.jsp | 1 - .../docroot/html/mail_manager/view.jsp | 1 - .../docroot/WEB-INF/liferay-display.xml | 4 +- .../docroot/WEB-INF/service.xml | 62 +-- .../portlet/AdminMaintenancePortlet.java | 175 ++++--- .../MaintenanceSchedulePersistenceImpl.java | 1 - .../docroot/html/plugin/top.jsp | 492 ++++++++++++------ .../impl/KaleoTaskAssignmentInstanceImpl.java | 42 +- ...KaleoTaskAssignmentInstanceFinderImpl.java | 123 +++-- .../engine/ReportScadenzarioIstruttorie.java | 182 ++++--- .../engine/ReportTempisticheIstruttorie.java | 279 +++++----- .../report/engine/template/TemplatesADV.java | 317 ++++++----- .../engine/util/ReportEngineServiceUtil.java | 19 +- .../docroot/WEB-INF/liferay-display.xml | 2 +- .../docroot/WEB-INF/service.xml | 30 +- .../html/core/HeaderFooterPageEvent.java | 29 +- .../report/html/core/HtmlToPdfEngine.java | 97 +++- .../report/html/core/ImageTagProcessor.java | 38 +- .../core/annotation/BeanReportAnnotation.java | 1 + .../messaging/ProtocolloMessageListener.java | 63 +-- .../messaging/ReportMessageListener.java | 86 ++- .../messaging/ReportTaskMessageListener.java | 58 ++- .../impl/ReportTaskLocalServiceImpl.java | 79 +-- .../impl/ReportTaskManagerServiceImpl.java | 131 +++-- .../docroot/WEB-INF/liferay-look-and-feel.xml | 2 +- .../workflow_instances/workflow_logs.jspf | 4 +- .../docroot/WEB-INF/liferay-web.xml | 92 ++-- .../WEB-INF/src/content/Language.properties | 1 + .../src/content/Language_it.properties | 1 + 124 files changed, 4032 insertions(+), 2914 deletions(-) diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/accesso/atti/NoSuchRichiestaAccessoAttiException.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/accesso/atti/NoSuchRichiestaAccessoAttiException.java index 86403a01..bcb85edc 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/accesso/atti/NoSuchRichiestaAccessoAttiException.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/accesso/atti/NoSuchRichiestaAccessoAttiException.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.accesso.atti; @@ -11,28 +17,24 @@ package it.tref.liferay.portos.accesso.atti; import com.liferay.portal.NoSuchModelException; /** - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting */ -@SuppressWarnings("serial") public class NoSuchRichiestaAccessoAttiException extends NoSuchModelException { public NoSuchRichiestaAccessoAttiException() { - super(); } public NoSuchRichiestaAccessoAttiException(String msg) { - super(msg); } public NoSuchRichiestaAccessoAttiException(String msg, Throwable cause) { - super(msg, cause); } public NoSuchRichiestaAccessoAttiException(Throwable cause) { - super(cause); } -} + +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiBOPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiBOPortlet.java index 6ab88742..1ee46772 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiBOPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiBOPortlet.java @@ -52,66 +52,89 @@ import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.util.PortalUtil; import com.liferay.util.bridges.mvc.MVCPortlet; +/** + * Portlet implementation class AccessoAttiBOPortlet + */ public class AccessoAttiBOPortlet extends MVCPortlet { public static final Log _log = LogFactoryUtil.getLog(AccessoAttiBOPortlet.class); - public void accettaRichiesta(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, - AddressException { + public void accettaRichiesta(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, AddressException{ ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + long richiestaAccessoAttiId = ParamUtil.getLong(actionRequest, "richiestaAccessoAttiId"); String testoEmail = ParamUtil.getString(actionRequest, "testoEmail"); - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAttiId); - if (richiestaAccessoAtti != null) { - String accessToken = AccessoAttiAccessTokenUtil.generateAccessToken(richiestaAccessoAttiId, + + RichiestaAccessoAtti richiestaAccessoAtti = + RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId); + if(richiestaAccessoAtti != null){ + + String accessToken = AccessoAttiAccessTokenUtil.generateAccessToken(richiestaAccessoAttiId, richiestaAccessoAtti.getNumeroProgetto(), richiestaAccessoAtti.getUserId()); + richiestaAccessoAtti.setFunzionarioId(themeDisplay.getUserId()); richiestaAccessoAtti.setGestita(true); richiestaAccessoAtti.setAccettata(true); richiestaAccessoAtti.setDtAccettazione(new Date()); richiestaAccessoAtti.setAccessToken(accessToken); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); + try { + String protocollo = ProtocolloUtil.protocollaArrivoAccessoAtti(richiestaAccessoAtti.getGroupId(), - richiestaAccessoAtti.getCompanyId(), richiestaAccessoAtti.getUserName(), + richiestaAccessoAtti.getCompanyId(), richiestaAccessoAtti.getUserName(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), RichiestaAccessoAtti.class.getName()); + richiestaAccessoAtti.setProtocolloUscita(protocollo); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); + } catch (Exception e) { _log.error(e); } + EmailSenderUtil.sendAcceptedEmail(richiestaAccessoAttiId, testoEmail); + } } - public void rifiutaRichiesta(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, - AddressException { + public void rifiutaRichiesta(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, AddressException{ ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + long richiestaAccessoAttiId = ParamUtil.getLong(actionRequest, "richiestaAccessoAttiId"); String motivoRifiuto = ParamUtil.getString(actionRequest, "motivoRifiuto"); - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAttiId); - if (richiestaAccessoAtti != null) { + + + RichiestaAccessoAtti richiestaAccessoAtti = + RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId); + if(richiestaAccessoAtti != null){ + richiestaAccessoAtti.setFunzionarioId(themeDisplay.getUserId()); richiestaAccessoAtti.setGestita(true); richiestaAccessoAtti.setAccettata(false); richiestaAccessoAtti.setDtAccettazione(new Date()); richiestaAccessoAtti.setAccessToken("-1"); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); + try { + String protocollo = ProtocolloUtil.protocollaArrivoAccessoAtti(richiestaAccessoAtti.getGroupId(), - richiestaAccessoAtti.getCompanyId(), richiestaAccessoAtti.getUserName(), + richiestaAccessoAtti.getCompanyId(), richiestaAccessoAtti.getUserName(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), RichiestaAccessoAtti.class.getName()); + richiestaAccessoAtti.setProtocolloUscita(protocollo); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); + } catch (Exception e) { _log.error(e); } + EmailSenderUtil.sendDeniedEmail(richiestaAccessoAttiId, motivoRifiuto); } + } public void ricercaGestite(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException { @@ -120,48 +143,65 @@ public class AccessoAttiBOPortlet extends MVCPortlet { String protocollo = actionRequest.getParameter("protocollo"); String dataDal = actionRequest.getParameter("dataDal"); String dataAl = actionRequest.getParameter("dataAl"); + actionResponse.setRenderParameter("numeroProgetto", numeroProgetto); actionResponse.setRenderParameter("protocollo", protocollo); actionResponse.setRenderParameter("dataDal", dataDal); actionResponse.setRenderParameter("dataAl", dataAl); + actionResponse.setRenderParameter("tabs1", "Richieste Concluse"); + } @Override - public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, + public void serveResource(ResourceRequest resourceRequest, + ResourceResponse resourceResponse) throws IOException, PortletException { String id = resourceRequest.getResourceID(); - if ("exportRicerca".equals(id)) { + + if("exportRicerca".equals(id)){ + ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); Locale locale = themeDisplay.getLocale(); + User user = themeDisplay.getUser(); + + String csv = StringPool.BLANK; + HttpServletRequest request = PortalUtil.getHttpServletRequest(resourceRequest); HttpServletResponse response = PortalUtil.getHttpServletResponse(resourceResponse); + try { csv = exportSearch(locale, resourceRequest, user); } catch (SystemException | ParseException | PortalException e) { - _log.error(e, e); + _log.error(e,e); } - ServletResponseUtil.sendFile(request, response, "export_ricerca_accesso_atti_" + new Date().getTime() - + ".csv", csv.getBytes(StringPool.UTF8), ContentTypes.TEXT_CSV_UTF8); + + ServletResponseUtil.sendFile(request, response, "export_ricerca_accesso_atti_"+ new Date().getTime() + ".csv", csv.getBytes(StringPool.UTF8), + ContentTypes.TEXT_CSV_UTF8); + } + super.serveResource(resourceRequest, resourceResponse); } - private String exportSearch(Locale locale, ResourceRequest resourceRequest, User user) throws SystemException, - ParseException, PortalException { + private String exportSearch(Locale locale, ResourceRequest resourceRequest, User user) throws SystemException, ParseException, PortalException { ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); + HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(resourceRequest); StringBuilder sb = new StringBuilder(); + String numeroProgetto = ParamUtil.getString(httpRequest, "numeroProgetto", StringPool.BLANK); String protocollo = ParamUtil.getString(httpRequest, "protocollo", StringPool.BLANK); String dataDal = ParamUtil.getString(httpRequest, "dataDal", StringPool.BLANK); String dataAl = ParamUtil.getString(httpRequest, "dataAl", StringPool.BLANK); - List lista = RichiestaAccessoAttiLocalServiceUtil.findCompletate(numeroProgetto, - protocollo, dataDal, dataAl, -1, -1); + + List lista = + RichiestaAccessoAttiLocalServiceUtil.findCompletate(numeroProgetto, protocollo, dataDal, dataAl, -1, -1); + sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "Utente Richiedente"))); sb.append(StringPool.SEMICOLON); sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "Data Gestione"))); @@ -182,68 +222,98 @@ public class AccessoAttiBOPortlet extends MVCPortlet { sb.append(StringPool.SEMICOLON); sb.append(CSVUtil.encode(LanguageUtil.get(getPortletConfig(), locale, "Gestita Da"))); sb.append(StringPool.SEMICOLON); + sb.append(StringPool.NEW_LINE); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + for (RichiestaAccessoAtti atto : lista) { + sb.append(CSVUtil.encode(UserLocalServiceUtil.getUser(atto.getUserId()).getFullName())); sb.append(StringPool.SEMICOLON); + sb.append(CSVUtil.encode(sdf.format(atto.getDtAccettazione()))); sb.append(StringPool.SEMICOLON); + sb.append(CSVUtil.encode(atto.getProtocolloEntrata())); sb.append(StringPool.SEMICOLON); + sb.append(CSVUtil.encode(atto.getProtocolloUscita())); sb.append(StringPool.SEMICOLON); + sb.append(CSVUtil.encode(atto.getNumeroProgetto())); sb.append(StringPool.SEMICOLON); + sb.append(CSVUtil.encode(sdf.format(atto.getDtVidimazione()))); sb.append(StringPool.SEMICOLON); + sb.append(CSVUtil.encode(atto.getSanatoria() ? "SI" : "NO")); sb.append(StringPool.SEMICOLON); - if (atto.getIntPraticaId() != 0L) { + + if(atto.getIntPraticaId() != 0L){ + Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(atto.getTerritorioId()); Comune comune = ComuneLocalServiceUtil.getComune(territorio.getComuneId()); - Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(themeDisplay.getCompanyId(), - comune.getCodiceProvincia()); + Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(themeDisplay.getCompanyId(), comune.getCodiceProvincia()); + sb.append(CSVUtil.encode(provincia.getProvincia())); sb.append(StringPool.SEMICOLON); + } else { + sb.append(CSVUtil.encode("")); sb.append(StringPool.SEMICOLON); + } + sb.append(CSVUtil.encode(atto.getAccettata() ? "SI" : "NO")); sb.append(StringPool.SEMICOLON); + sb.append(CSVUtil.encode(UserLocalServiceUtil.getUser(atto.getFunzionarioId()).getFullName())); sb.append(StringPool.SEMICOLON); + sb.append(StringPool.NEW_LINE); + } + return sb.toString(); } - - public void aggiungiRichiestaBO(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, - AddressException, ParseException { - + + public void aggiungiRichiestaBO(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, AddressException, ParseException{ + long accessoAttiId = 0L; + ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date dataCheck = sdf.parse("01/01/2015"); + boolean isNoCNSUser = ParamUtil.getBoolean(actionRequest, "isNoCNSUser"); + String codiceFiscale = ParamUtil.getString(actionRequest, "codiceFiscale"); String emailRicontatto = ParamUtil.getString(actionRequest, "emailRicontatto"); String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto"); Date dataVidimazione = ParamUtil.getDate(actionRequest, "dataVidimazione", sdf); + String qualitaPersona = ParamUtil.getString(actionRequest, "qualitaPersona"); String visione = ParamUtil.getString(actionRequest, "visione"); String copiaDettaglio = ParamUtil.getString(actionRequest, "copiaDett"); String motivazione = ParamUtil.getString(actionRequest, "motivazione"); boolean sanatoria = ParamUtil.getBoolean(actionRequest, "sanatoria"); - if (numeroProgetto != null && !numeroProgetto.equalsIgnoreCase("")) { - if (!dataVidimazione.before(dataCheck) && !sanatoria) { + + if(numeroProgetto != null && !numeroProgetto.equalsIgnoreCase("")){ + + if(!dataVidimazione.before(dataCheck) && !sanatoria){ + IntPratica intPratica = IntPraticaLocalServiceUtil.findByNumeroProgetto(numeroProgetto); - if (intPratica != null) { - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .createRichiestaAccessoAtti(CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class - .getName())); + if(intPratica != null){ + + RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.createRichiestaAccessoAtti( + CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class.getName())); + + accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId(); + richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId()); richiestaAccessoAtti.setIntPraticaId(intPratica.getIntPraticaId()); richiestaAccessoAtti.setGroupId(intPratica.getGroupId()); @@ -254,139 +324,194 @@ public class AccessoAttiBOPortlet extends MVCPortlet { richiestaAccessoAtti.setMotivazioneRichiesta(motivazione); richiestaAccessoAtti.setNumeroProgetto(numeroProgetto); richiestaAccessoAtti.setSanatoria(sanatoria); - if (sanatoria) { + + if(sanatoria){ Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf); richiestaAccessoAtti.setDtSanatoria(dataSanatoria); } + richiestaAccessoAtti.setTipologiaPersona(qualitaPersona); - if (visione.equalsIgnoreCase("copia")) { + + if(visione.equalsIgnoreCase("copia")){ richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio); } + richiestaAccessoAtti.setTipologiaRichiesta(visione); - User loggedUser = UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), - codiceFiscale.toLowerCase()); - if (loggedUser != null) { + + User loggedUser = + UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), codiceFiscale.toLowerCase()); + if(loggedUser != null){ richiestaAccessoAtti.setUserId(loggedUser.getUserId()); richiestaAccessoAtti.setUserName(loggedUser.getScreenName()); } else { richiestaAccessoAtti.setUserName(codiceFiscale.toLowerCase()); } + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); + UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); - if (dataVidimazione.before(dataCheck) || sanatoria) { - if (uploadRequest.getSize("allegatoPagamento") != 0) { + + if(dataVidimazione.before(dataCheck) || sanatoria){ + + if(uploadRequest.getSize("allegatoPagamento") != 0){ + String sourceFileName = uploadRequest.getFileName("allegatoPagamento"); - File fileApp = uploadRequest.getFile("allegatoPagamento"); - long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( - themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), - sourceFileName, fileApp, true); - RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); - richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + File fileApp = uploadRequest.getFile("allegatoPagamento"); + + long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( + themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, true); + + RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); + richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + } } - if (isNoCNSUser) { - if (uploadRequest.getSize("documentoIdentita") != 0) { + + if(isNoCNSUser){ + + if(uploadRequest.getSize("documentoIdentita") != 0){ + String sourceFileName = uploadRequest.getFileName("documentoIdentita"); - File fileApp = uploadRequest.getFile("documentoIdentita"); - long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( - themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), - sourceFileName, fileApp, false); - RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); - richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + File fileApp = uploadRequest.getFile("documentoIdentita"); + + long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( + themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, false); + + RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); + richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + } } - RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(accessoAttiId); + + RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(accessoAttiId); + try { - String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti( - richiesta.getRichiestaAccessoAttiId(), richiesta.getIntPraticaId(), - richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(), richiesta.getCompanyId(), - richiesta.getUserName()); + + String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(richiesta.getRichiestaAccessoAttiId(), + richiesta.getIntPraticaId(), richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(), + richiesta.getCompanyId(), richiesta.getUserName()); + richiesta.setProtocolloEntrata(protocollo); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta); + } catch (Exception e) { _log.error(e); } + EmailSenderUtil.sendAcceptedRequest(accessoAttiId); - actionResponse.setRenderParameter("jspPage", "/html/accesso_atti_fe/richiesta-inviata-success.jsp"); + actionResponse.setRenderParameter("jspPage","/html/accesso_atti_fe/richiesta-inviata-success.jsp"); + + + } else { SessionErrors.add(actionRequest, "atto-non-esistente"); } + } else { - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .createRichiestaAccessoAtti(CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class - .getName())); - accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId(); - richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId()); - richiestaAccessoAtti.setCreateDate(new Date()); - richiestaAccessoAtti.setEmailRicontatto(emailRicontatto); - richiestaAccessoAtti.setDtVidimazione(dataVidimazione); - richiestaAccessoAtti.setMotivazioneRichiesta(motivazione); - richiestaAccessoAtti.setNumeroProgetto(numeroProgetto); - richiestaAccessoAtti.setSanatoria(sanatoria); - if (sanatoria) { - Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf); - richiestaAccessoAtti.setDtSanatoria(dataSanatoria); - } - richiestaAccessoAtti.setTipologiaPersona(qualitaPersona); - if (visione.equalsIgnoreCase("copia")) { - richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio); - } - richiestaAccessoAtti.setTipologiaRichiesta(visione); - User loggedUser = UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), - codiceFiscale.toLowerCase()); - if (loggedUser != null) { - richiestaAccessoAtti.setUserId(loggedUser.getUserId()); - richiestaAccessoAtti.setUserName(loggedUser.getScreenName()); - } else { - richiestaAccessoAtti.setUserName(codiceFiscale.toLowerCase()); - } - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); - UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); - if (dataVidimazione.before(dataCheck) || sanatoria) { - if (uploadRequest.getSize("allegatoPagamento") != 0) { - String sourceFileName = uploadRequest.getFileName("allegatoPagamento"); - File fileApp = uploadRequest.getFile("allegatoPagamento"); - long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( - themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), - sourceFileName, fileApp, true); - RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); - richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + + RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.createRichiestaAccessoAtti( + CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class.getName())); + + + accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId(); + + richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId()); +// richiestaAccessoAtti.setIntPraticaId(intPratica.getIntPraticaId()); +// richiestaAccessoAtti.setGroupId(intPratica.getGroupId()); +// richiestaAccessoAtti.setTerritorioId(intPratica.getTerritorioId()); + richiestaAccessoAtti.setCreateDate(new Date()); + richiestaAccessoAtti.setEmailRicontatto(emailRicontatto); + richiestaAccessoAtti.setDtVidimazione(dataVidimazione); + richiestaAccessoAtti.setMotivazioneRichiesta(motivazione); + richiestaAccessoAtti.setNumeroProgetto(numeroProgetto); + richiestaAccessoAtti.setSanatoria(sanatoria); + if(sanatoria){ + Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf); + richiestaAccessoAtti.setDtSanatoria(dataSanatoria); } - } - if (isNoCNSUser) { - if (uploadRequest.getSize("documentoIdentita") != 0) { - String sourceFileName = uploadRequest.getFileName("documentoIdentita"); - File fileApp = uploadRequest.getFile("documentoIdentita"); - long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( - themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), - sourceFileName, fileApp, false); - RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); - richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + richiestaAccessoAtti.setTipologiaPersona(qualitaPersona); + + if(visione.equalsIgnoreCase("copia")){ + richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio); } - } - RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(accessoAttiId); - try { - String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti( - richiesta.getRichiestaAccessoAttiId(), richiesta.getIntPraticaId(), richiesta.getGroupId(), - RichiestaAccessoAtti.class.getName(), richiesta.getCompanyId(), richiesta.getUserName()); - richiesta.setProtocolloEntrata(protocollo); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta); - } catch (Exception e) { - _log.error(e); - } - EmailSenderUtil.sendAcceptedRequest(accessoAttiId); - actionResponse.setRenderParameter("jspPage", "/html/accesso_atti_fe/richiesta-inviata-success.jsp"); + + richiestaAccessoAtti.setTipologiaRichiesta(visione); + + User loggedUser = + UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), codiceFiscale.toLowerCase()); + if(loggedUser != null){ + richiestaAccessoAtti.setUserId(loggedUser.getUserId()); + richiestaAccessoAtti.setUserName(loggedUser.getScreenName()); + } else { + richiestaAccessoAtti.setUserName(codiceFiscale.toLowerCase()); + } + + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); + + UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); + + if(dataVidimazione.before(dataCheck) || sanatoria){ + + if(uploadRequest.getSize("allegatoPagamento") != 0){ + + String sourceFileName = uploadRequest.getFileName("allegatoPagamento"); + File fileApp = uploadRequest.getFile("allegatoPagamento"); + + long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( + themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, true); + + RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); + richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + + } + } + + if(isNoCNSUser){ + + if(uploadRequest.getSize("documentoIdentita") != 0){ + + String sourceFileName = uploadRequest.getFileName("documentoIdentita"); + File fileApp = uploadRequest.getFile("documentoIdentita"); + + long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( + themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, false); + + RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); + richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + + } + } + + RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(accessoAttiId); + + try { + + String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(richiesta.getRichiestaAccessoAttiId(), + richiesta.getIntPraticaId(), richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(), + richiesta.getCompanyId(), richiesta.getUserName()); + + richiesta.setProtocolloEntrata(protocollo); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta); + + } catch (Exception e) { + _log.error(e); + } + + EmailSenderUtil.sendAcceptedRequest(accessoAttiId); + actionResponse.setRenderParameter("jspPage","/html/accesso_atti_fe/richiesta-inviata-success.jsp"); + } - } + + + } + + + } + + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiFEPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiFEPortlet.java index 90c03b3d..7360a963 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiFEPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiFEPortlet.java @@ -30,34 +30,47 @@ import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.util.PortalUtil; import com.liferay.util.bridges.mvc.MVCPortlet; +/** + * Portlet implementation class AccessoAttiFEPortlet + */ public class AccessoAttiFEPortlet extends MVCPortlet { - + public static final Log _log = LogFactoryUtil.getLog(AccessoAttiFEPortlet.class); - - public void inviaRichiestaAccessoAtti(ActionRequest actionRequest, ActionResponse actionResponse) - throws ParseException, SystemException, AddressException { - + + public void inviaRichiestaAccessoAtti(ActionRequest actionRequest, ActionResponse actionResponse) throws ParseException, SystemException, AddressException{ + long accessoAttiId = 0L; + ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date dataCheck = sdf.parse("01/01/2015"); + boolean isNoCNSUser = ParamUtil.getBoolean(actionRequest, "isNoCNSUser"); + String emailRicontatto = ParamUtil.getString(actionRequest, "emailRicontatto"); String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto"); Date dataVidimazione = ParamUtil.getDate(actionRequest, "dataVidimazione", sdf); + String qualitaPersona = ParamUtil.getString(actionRequest, "qualitaPersona"); String visione = ParamUtil.getString(actionRequest, "visione"); String copiaDettaglio = ParamUtil.getString(actionRequest, "copiaDett"); String motivazione = ParamUtil.getString(actionRequest, "motivazione"); boolean sanatoria = ParamUtil.getBoolean(actionRequest, "sanatoria"); - if (numeroProgetto != null && !numeroProgetto.equalsIgnoreCase("")) { - if (!dataVidimazione.before(dataCheck) && !sanatoria) { + + if(numeroProgetto != null && !numeroProgetto.equalsIgnoreCase("")){ + + if(!dataVidimazione.before(dataCheck) && !sanatoria){ + IntPratica intPratica = IntPraticaLocalServiceUtil.findByNumeroProgetto(numeroProgetto); - if (intPratica != null) { - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .createRichiestaAccessoAtti(CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class - .getName())); + if(intPratica != null){ + + RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.createRichiestaAccessoAtti( + CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class.getName())); + + accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId(); + richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId()); richiestaAccessoAtti.setIntPraticaId(intPratica.getIntPraticaId()); richiestaAccessoAtti.setGroupId(intPratica.getGroupId()); @@ -68,144 +81,202 @@ public class AccessoAttiFEPortlet extends MVCPortlet { richiestaAccessoAtti.setMotivazioneRichiesta(motivazione); richiestaAccessoAtti.setNumeroProgetto(numeroProgetto); richiestaAccessoAtti.setSanatoria(sanatoria); - if (sanatoria) { + + if(sanatoria){ Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf); richiestaAccessoAtti.setDtSanatoria(dataSanatoria); } + richiestaAccessoAtti.setTipologiaPersona(qualitaPersona); - if (visione.equalsIgnoreCase("copia")) { + + if(visione.equalsIgnoreCase("copia")){ richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio); } + richiestaAccessoAtti.setTipologiaRichiesta(visione); + richiestaAccessoAtti.setUserId(themeDisplay.getUserId()); richiestaAccessoAtti.setUserName(themeDisplay.getUser().getScreenName()); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); + UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); - if (dataVidimazione.before(dataCheck) || sanatoria) { - if (uploadRequest.getSize("allegatoPagamento") != 0) { + + if(dataVidimazione.before(dataCheck) || sanatoria){ + + if(uploadRequest.getSize("allegatoPagamento") != 0){ + String sourceFileName = uploadRequest.getFileName("allegatoPagamento"); - File fileApp = uploadRequest.getFile("allegatoPagamento"); - long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( - themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), - sourceFileName, fileApp, true); - RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); - richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + File fileApp = uploadRequest.getFile("allegatoPagamento"); + + long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( + themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, true); + + RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); + richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + } } - if (isNoCNSUser) { - if (uploadRequest.getSize("documentoIdentita") != 0) { + + if(isNoCNSUser){ + + if(uploadRequest.getSize("documentoIdentita") != 0){ + String sourceFileName = uploadRequest.getFileName("documentoIdentita"); - File fileApp = uploadRequest.getFile("documentoIdentita"); - long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( - themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), - sourceFileName, fileApp, false); - RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); - richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + File fileApp = uploadRequest.getFile("documentoIdentita"); + + long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( + themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, false); + + RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); + richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + } } - RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(accessoAttiId); + + RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(accessoAttiId); + try { - String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti( - richiesta.getRichiestaAccessoAttiId(), richiesta.getIntPraticaId(), - richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(), richiesta.getCompanyId(), - richiesta.getUserName()); + + String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(richiesta.getRichiestaAccessoAttiId(), + richiesta.getIntPraticaId(), richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(), + richiesta.getCompanyId(), richiesta.getUserName()); + richiesta.setProtocolloEntrata(protocollo); RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta); + } catch (Exception e) { _log.error(e); } + EmailSenderUtil.sendAcceptedRequest(accessoAttiId); - actionResponse.setRenderParameter("jspPage", "/html/accesso_atti_fe/richiesta-inviata-success.jsp"); + actionResponse.setRenderParameter("jspPage","/html/accesso_atti_fe/richiesta-inviata-success.jsp"); + + + } else { SessionErrors.add(actionRequest, "atto-non-esistente"); } + } else { - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .createRichiestaAccessoAtti(CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class - .getName())); - accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId(); - richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId()); - richiestaAccessoAtti.setCreateDate(new Date()); - richiestaAccessoAtti.setEmailRicontatto(emailRicontatto); - richiestaAccessoAtti.setDtVidimazione(dataVidimazione); - richiestaAccessoAtti.setMotivazioneRichiesta(motivazione); - richiestaAccessoAtti.setNumeroProgetto(numeroProgetto); - richiestaAccessoAtti.setSanatoria(sanatoria); - if (sanatoria) { - Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf); - richiestaAccessoAtti.setDtSanatoria(dataSanatoria); - } - richiestaAccessoAtti.setTipologiaPersona(qualitaPersona); - if (visione.equalsIgnoreCase("copia")) { - richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio); - } - richiestaAccessoAtti.setTipologiaRichiesta(visione); - richiestaAccessoAtti.setUserId(themeDisplay.getUserId()); - richiestaAccessoAtti.setUserName(themeDisplay.getUser().getScreenName()); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); - UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); - if (dataVidimazione.before(dataCheck) || sanatoria) { - if (uploadRequest.getSize("allegatoPagamento") != 0) { - String sourceFileName = uploadRequest.getFileName("allegatoPagamento"); - File fileApp = uploadRequest.getFile("allegatoPagamento"); - long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( - themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), - sourceFileName, fileApp, true); - RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); - richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + + RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.createRichiestaAccessoAtti( + CounterLocalServiceUtil.increment(RichiestaAccessoAtti.class.getName())); + + + accessoAttiId = richiestaAccessoAtti.getRichiestaAccessoAttiId(); + + richiestaAccessoAtti.setCompanyId(themeDisplay.getCompanyId()); +// richiestaAccessoAtti.setIntPraticaId(intPratica.getIntPraticaId()); +// richiestaAccessoAtti.setGroupId(intPratica.getGroupId()); +// richiestaAccessoAtti.setTerritorioId(intPratica.getTerritorioId()); + richiestaAccessoAtti.setCreateDate(new Date()); + richiestaAccessoAtti.setEmailRicontatto(emailRicontatto); + richiestaAccessoAtti.setDtVidimazione(dataVidimazione); + richiestaAccessoAtti.setMotivazioneRichiesta(motivazione); + richiestaAccessoAtti.setNumeroProgetto(numeroProgetto); + richiestaAccessoAtti.setSanatoria(sanatoria); + if(sanatoria){ + Date dataSanatoria = ParamUtil.getDate(actionRequest, "dataSanatoria", sdf); + richiestaAccessoAtti.setDtSanatoria(dataSanatoria); } - } - if (isNoCNSUser) { - if (uploadRequest.getSize("documentoIdentita") != 0) { - String sourceFileName = uploadRequest.getFileName("documentoIdentita"); - File fileApp = uploadRequest.getFile("documentoIdentita"); - long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( - themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), - sourceFileName, fileApp, false); - RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); - richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + richiestaAccessoAtti.setTipologiaPersona(qualitaPersona); + + if(visione.equalsIgnoreCase("copia")){ + richiestaAccessoAtti.setTipologiaRichiestaDettaglio(copiaDettaglio); } - } - RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(accessoAttiId); - try { - String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti( - richiesta.getRichiestaAccessoAttiId(), richiesta.getIntPraticaId(), richiesta.getGroupId(), - RichiestaAccessoAtti.class.getName(), richiesta.getCompanyId(), richiesta.getUserName()); - richiesta.setProtocolloEntrata(protocollo); - RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta); - } catch (Exception e) { - _log.error(e); - } - EmailSenderUtil.sendAcceptedRequest(accessoAttiId); - actionResponse.setRenderParameter("jspPage", "/html/accesso_atti_fe/richiesta-inviata-success.jsp"); + + richiestaAccessoAtti.setTipologiaRichiesta(visione); + + richiestaAccessoAtti.setUserId(themeDisplay.getUserId()); + richiestaAccessoAtti.setUserName(themeDisplay.getUser().getScreenName()); + + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAtti); + + UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); + + if(dataVidimazione.before(dataCheck) || sanatoria){ + + if(uploadRequest.getSize("allegatoPagamento") != 0){ + + String sourceFileName = uploadRequest.getFileName("allegatoPagamento"); + File fileApp = uploadRequest.getFile("allegatoPagamento"); + + long fileEntryIdPagamento = DocumentLibraryUtil.saveFileEntryAccessoAtti( + themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, true); + + RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); + richiestaAccessoAttiUpdate.setFileEntryIdPagamento(fileEntryIdPagamento); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + + } + } + + if(isNoCNSUser){ + + if(uploadRequest.getSize("documentoIdentita") != 0){ + + String sourceFileName = uploadRequest.getFileName("documentoIdentita"); + File fileApp = uploadRequest.getFile("documentoIdentita"); + + long fileEntryIdDocumento = DocumentLibraryUtil.saveFileEntryAccessoAtti( + themeDisplay.getCompanyGroupId(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), sourceFileName, fileApp, false); + + RichiestaAccessoAtti richiestaAccessoAttiUpdate = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAtti.getRichiestaAccessoAttiId()); + richiestaAccessoAttiUpdate.setFileEntryIdDocumentoIdentita(fileEntryIdDocumento); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiestaAccessoAttiUpdate); + + } + } + + RichiestaAccessoAtti richiesta = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(accessoAttiId); + + try { + + String protocollo = ProtocolloUtil.protocollaPartenzaAccessoAtti(richiesta.getRichiestaAccessoAttiId(), + richiesta.getIntPraticaId(), richiesta.getGroupId(), RichiestaAccessoAtti.class.getName(), + richiesta.getCompanyId(), richiesta.getUserName()); + + richiesta.setProtocolloEntrata(protocollo); + RichiestaAccessoAttiLocalServiceUtil.updateRichiestaAccessoAtti(richiesta); + + } catch (Exception e) { + _log.error(e); + } + + EmailSenderUtil.sendAcceptedRequest(accessoAttiId); + actionResponse.setRenderParameter("jspPage","/html/accesso_atti_fe/richiesta-inviata-success.jsp"); + } - } + + + } } - + public void visualizzaAtto(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException { - + + actionResponse.setRenderParameter("tabs1", "Visualizza Atto"); actionRequest.setAttribute("tabs1", "Visualizza Atto"); + String accessToken = ParamUtil.getString(actionRequest, "accessToken"); + RichiestaAccessoAtti atto = RichiestaAccessoAttiLocalServiceUtil.findByAccessToken(accessToken); - if (atto != null) { - if (atto.isAccettata()) { + if(atto != null){ + + if(atto.isAccettata()){ + Calendar calApp = Calendar.getInstance(); calApp.setTime(atto.getDtAccettazione()); calApp.add(Calendar.DATE, 7); + Date checkDate = calApp.getTime(); - if (new Date().before(checkDate)) { - actionResponse.setRenderParameter("accessoAttiId", "" + atto.getRichiestaAccessoAttiId()); + if(new Date().before(checkDate) ){ + + actionResponse.setRenderParameter("accessoAttiId", ""+atto.getRichiestaAccessoAttiId()); + } else { SessionErrors.add(actionRequest, "accesso-token-scaduto"); } @@ -215,5 +286,56 @@ public class AccessoAttiFEPortlet extends MVCPortlet { } else { SessionErrors.add(actionRequest, "no-atto-trovato"); } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/CreazioneAccountPortosPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/CreazioneAccountPortosPortlet.java index be1cbd9a..3d84130b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/CreazioneAccountPortosPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/CreazioneAccountPortosPortlet.java @@ -27,69 +27,85 @@ import com.liferay.util.bridges.mvc.MVCPortlet; */ public class CreazioneAccountPortosPortlet extends MVCPortlet { - public void creaAccount(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, - ParseException, PortalException { + + public void creaAccount(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException, ParseException, PortalException{ ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + String username = ParamUtil.getString(actionRequest, "codiceFiscale"); String password = ParamUtil.getString(actionRequest, "password"); String email = ParamUtil.getString(actionRequest, "indirizzoEmail"); String nome = ParamUtil.getString(actionRequest, "nome"); String cognome = ParamUtil.getString(actionRequest, "cognome"); String dataNascita = ParamUtil.getString(actionRequest, "dataNascita"); - if (username != null) { - User checkUser = UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), - username.toLowerCase()); - if (checkUser == null) { + + if(username != null){ + User checkUser = UserLocalServiceUtil.fetchUserByScreenName(themeDisplay.getCompanyId(), username.toLowerCase()); + if(checkUser == null){ + Date dateOfBirthday = sdf.parse(dataNascita); Calendar cal = Calendar.getInstance(); cal.setTime(dateOfBirthday); + int birthdayMonth = cal.get(Calendar.MONTH); - int birthdayDay = cal.get(Calendar.DAY_OF_MONTH); - ; - int birthdayYear = cal.get(Calendar.YEAR); - ; + int birthdayDay = cal.get(Calendar.DAY_OF_MONTH);; + int birthdayYear = cal.get(Calendar.YEAR);; + long creatorUserId = 0; long facebookId = 0; int prefixId = 0; int suffixId = 0; + long groupIds[] = new long[0]; long organizationIds[] = new long[0]; long roleIds[] = new long[0]; long userGroupIds[] = new long[0]; + boolean autoPassword = false; boolean autoScreenName = false; boolean male = true; boolean sendEmail = true; + String password1 = password; String password2 = password; String screenName = username; String openId = null; String middleName = null; String jobTitle = null; + Date now = new Date(); + Locale locale = themeDisplay.getLocale(); + ServiceContext serviceContext = new ServiceContext(); - User user = UserLocalServiceUtil.addUser(creatorUserId, themeDisplay.getCompanyId(), autoPassword, - password1, password2, autoScreenName, screenName, email, facebookId, openId, locale, nome, - middleName, cognome, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, - jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext); + + User user = UserLocalServiceUtil.addUser(creatorUserId, themeDisplay.getCompanyId(), autoPassword, password1, password2, + autoScreenName, screenName, email, facebookId, openId, locale, nome, middleName, cognome, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext); + long userId = user.getUserId(); + User userCreated = UserLocalServiceUtil.getUser(userId); userCreated.setLoginDate(now); userCreated.setLoginIP("127.0.0.1"); userCreated.setLastLoginDate(now); userCreated.setModifiedDate(now); + + Role roleUserNoCNS = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), "UTENTE_NO_CNS"); + UserLocalServiceUtil.addRoleUser(roleUserNoCNS.getRoleId(), userId); + UserLocalServiceUtil.updateAgreedToTermsOfUse(userId, true); UserLocalServiceUtil.updateEmailAddressVerified(userId, true); UserLocalServiceUtil.updatePasswordReset(userId, false); + } else { SessionErrors.add(actionRequest, "error-user-exist"); } } - actionResponse.setRenderParameter("jspPage", "/html/creazione_account/success.jsp"); + + actionResponse.setRenderParameter("jspPage","/html/creazione_account/success.jsp"); } -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/base/RichiestaAccessoAttiLocalServiceClpInvoker.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/base/RichiestaAccessoAttiLocalServiceClpInvoker.java index 4ea8f1bb..33b3ee50 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/base/RichiestaAccessoAttiLocalServiceClpInvoker.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/base/RichiestaAccessoAttiLocalServiceClpInvoker.java @@ -19,7 +19,7 @@ import it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServ import java.util.Arrays; /** - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting * @generated */ public class RichiestaAccessoAttiLocalServiceClpInvoker { @@ -132,13 +132,13 @@ public class RichiestaAccessoAttiLocalServiceClpInvoker { "java.lang.String" }; - _methodName44 = "findByAccessToken"; + _methodName43 = "findByAccessToken"; - _methodParameterTypes44 = new String[] { "java.lang.String" }; + _methodParameterTypes43 = new String[] { "java.lang.String" }; - _methodName45 = "findRichiesteByGroup"; + _methodName44 = "findRichiesteByGroup"; - _methodParameterTypes45 = new String[] { "long", "int", "int" }; + _methodParameterTypes44 = new String[] { "long", "int", "int" }; } public Object invokeMethod(String name, String[] parameterTypes, @@ -265,13 +265,13 @@ public class RichiestaAccessoAttiLocalServiceClpInvoker { (java.lang.String)arguments[3]); } - if (_methodName44.equals(name) && - Arrays.deepEquals(_methodParameterTypes44, parameterTypes)) { + if (_methodName43.equals(name) && + Arrays.deepEquals(_methodParameterTypes43, parameterTypes)) { return RichiestaAccessoAttiLocalServiceUtil.findByAccessToken((java.lang.String)arguments[0]); } - if (_methodName45.equals(name) && - Arrays.deepEquals(_methodParameterTypes45, parameterTypes)) { + if (_methodName44.equals(name) && + Arrays.deepEquals(_methodParameterTypes44, parameterTypes)) { return RichiestaAccessoAttiLocalServiceUtil.findRichiesteByGroup(((Long)arguments[0]).longValue(), ((Integer)arguments[1]).intValue(), ((Integer)arguments[2]).intValue()); @@ -322,8 +322,8 @@ public class RichiestaAccessoAttiLocalServiceClpInvoker { private String[] _methodParameterTypes41; private String _methodName42; private String[] _methodParameterTypes42; + private String _methodName43; + private String[] _methodParameterTypes43; private String _methodName44; private String[] _methodParameterTypes44; - private String _methodName45; - private String[] _methodParameterTypes45; } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiLocalServiceImpl.java index 3c066abe..27bdb870 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiLocalServiceImpl.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.accesso.atti.service.impl; @@ -20,125 +26,222 @@ import java.util.List; import com.liferay.portal.kernel.dao.orm.Disjunction; import com.liferay.portal.kernel.dao.orm.DynamicQuery; +import com.liferay.portal.kernel.dao.orm.Property; import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil; import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; import com.liferay.portal.kernel.exception.SystemException; -import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.model.Organization; import com.liferay.portal.service.OrganizationLocalServiceUtil; /** * The implementation of the richiesta accesso atti local service. + * *

- * 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.accesso.atti.service.RichiestaAccessoAttiLocalService} - * interface. + * 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.accesso.atti.service.RichiestaAccessoAttiLocalService} 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 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting * @see it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiLocalServiceBaseImpl * @see it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil */ -public class RichiestaAccessoAttiLocalServiceImpl extends RichiestaAccessoAttiLocalServiceBaseImpl { +public class RichiestaAccessoAttiLocalServiceImpl +extends RichiestaAccessoAttiLocalServiceBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link - * it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil} to access the richiesta accesso - * atti local service. + * NOTE FOR DEVELOPERS: + * + * Never reference this interface directly. Always use {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil} to access the richiesta accesso atti local service. */ - private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - - @Override - public List findByGestita(boolean gestita, int start, int end) throws SystemException { - + public List findByGestita(boolean gestita, int start, int end) throws SystemException{ return richiestaAccessoAttiPersistence.findByGestita(gestita, start, end); } - @SuppressWarnings("unchecked") - @Override - public List findCompletate(String numeroProgetto, String protocollo, String dataDal, - String dataAl, int start, int end) throws SystemException { + public List findCompletate(String numeroProgetto, String protocollo, String dataDal, String dataAl, int start, int end) throws SystemException, ParseException{ - return dynamicQuery(dqCompletate(numeroProgetto, protocollo, dataDal, dataAl), start, end); - } + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + + DynamicQuery dq = richiestaAccessoAttiLocalService.dynamicQuery(); + dq.add(RestrictionsFactoryUtil.eq("gestita", true)); - @Override - public int countCompletate(String numeroProgetto, String protocollo, String dataDal, String dataAl) - throws SystemException { + if(!numeroProgetto.equals("")){ + dq.add(RestrictionsFactoryUtil.eq("numeroProgetto", numeroProgetto)); + } - return dynamicQuery(dqCompletate(numeroProgetto, protocollo, dataDal, dataAl)).size(); - } + if(!protocollo.equals("")){ - private DynamicQuery dqCompletate(String numeroProgetto, String protocollo, String dataDal, String dataAl) { + Disjunction disjunction = RestrictionsFactoryUtil.disjunction(); + disjunction.add(PropertyFactoryUtil.forName("protocolloEntrata").eq(protocollo)); + disjunction.add(PropertyFactoryUtil.forName("protocolloUscita").eq(protocollo)); + dq.add(disjunction); + } + + if(!dataDal.equals("") && !dataAl.equals("")){ + + Date dateDal = sdf.parse(dataDal); + Calendar calDal = Calendar.getInstance(); + calDal.setTime(dateDal); + calDal.set(Calendar.HOUR_OF_DAY, 00); + calDal.set(Calendar.MINUTE, 00); + dateDal = calDal.getTime(); + + Date dateAl = sdf.parse(dataAl); + Calendar calAl = Calendar.getInstance(); + calAl.setTime(dateAl); + calAl.set(Calendar.HOUR_OF_DAY, 23); + calAl.set(Calendar.MINUTE, 59); + dateAl = calAl.getTime(); + + + Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione"); + dq.add(createDateProperty.between(dateDal, dateAl)); + } + + if(!dataDal.equals("") && dataAl.equals("")){ + + Date dateDal = sdf.parse(dataDal); + Calendar calDal = Calendar.getInstance(); + calDal.setTime(dateDal); + calDal.set(Calendar.HOUR_OF_DAY, 00); + calDal.set(Calendar.MINUTE, 00); + dateDal = calDal.getTime(); + + Date now = new Date(); + + Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione"); + dq.add(createDateProperty.between(dateDal, now)); + + } + + if(dataDal.equals("") && !dataAl.equals("")){ + + Date now = new Date("01/01/2018"); + + Date dateAl = sdf.parse(dataAl); + Calendar calAl = Calendar.getInstance(); + calAl.setTime(dateAl); + calAl.set(Calendar.HOUR_OF_DAY, 23); + calAl.set(Calendar.MINUTE, 59); + dateAl = calAl.getTime(); + + Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione"); + dq.add(createDateProperty.between(now, dateAl)); + + } + + return richiestaAccessoAttiLocalService.dynamicQuery(dq, start, end); + } + + public int countCompletate(String numeroProgetto, String protocollo, String dataDal, String dataAl) throws SystemException, ParseException{ - DynamicQuery dq = dynamicQuery(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + + DynamicQuery dq = richiestaAccessoAttiLocalService.dynamicQuery(); dq.add(RestrictionsFactoryUtil.eq("gestita", true)); - if (Validator.isNotNull(numeroProgetto)) { + + if(!numeroProgetto.equals("")){ dq.add(RestrictionsFactoryUtil.eq("numeroProgetto", numeroProgetto)); } - if (Validator.isNotNull(protocollo)) { + + if(!protocollo.equals("")){ + Disjunction disjunction = RestrictionsFactoryUtil.disjunction(); disjunction.add(PropertyFactoryUtil.forName("protocolloEntrata").eq(protocollo)); disjunction.add(PropertyFactoryUtil.forName("protocolloUscita").eq(protocollo)); dq.add(disjunction); } - dq.add(PropertyFactoryUtil.forName("dtAccettazione").between(parseStartDate(dataDal), parseEndDate(dataAl))); - return dq; + + if(!dataDal.equals("") && !dataAl.equals("")){ + + Date dateDal = sdf.parse(dataDal); + Calendar calDal = Calendar.getInstance(); + calDal.setTime(dateDal); + calDal.set(Calendar.HOUR_OF_DAY, 00); + calDal.set(Calendar.MINUTE, 00); + dateDal = calDal.getTime(); + + Date dateAl = sdf.parse(dataAl); + Calendar calAl = Calendar.getInstance(); + calAl.setTime(dateAl); + calAl.set(Calendar.HOUR_OF_DAY, 23); + calAl.set(Calendar.MINUTE, 59); + dateAl = calAl.getTime(); + + + Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione"); + dq.add(createDateProperty.between(dateDal, dateAl)); + } + + if(!dataDal.equals("") && dataAl.equals("")){ + + Date dateDal = sdf.parse(dataDal); + Calendar calDal = Calendar.getInstance(); + calDal.setTime(dateDal); + calDal.set(Calendar.HOUR_OF_DAY, 00); + calDal.set(Calendar.MINUTE, 00); + dateDal = calDal.getTime(); + + Date now = new Date(); + + Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione"); + dq.add(createDateProperty.between(dateDal, now)); + + } + + if(dataDal.equals("") && !dataAl.equals("")){ + + Date now = new Date("01/01/2018"); + + Date dateAl = sdf.parse(dataAl); + Calendar calAl = Calendar.getInstance(); + calAl.setTime(dateAl); + calAl.set(Calendar.HOUR_OF_DAY, 23); + calAl.set(Calendar.MINUTE, 59); + dateAl = calAl.getTime(); + + Property createDateProperty = PropertyFactoryUtil.forName("dtAccettazione"); + dq.add(createDateProperty.between(now, dateAl)); + + } + + List lista = richiestaAccessoAttiLocalService.dynamicQuery(dq); + + return lista.size(); } - @Override - public RichiestaAccessoAtti findByAccessToken(String accessToken) throws SystemException { + public RichiestaAccessoAtti findByAccessToken(String accessToken) throws SystemException{ - DynamicQuery dq = dynamicQuery(); + DynamicQuery dq = richiestaAccessoAttiLocalService.dynamicQuery(); dq.add(RestrictionsFactoryUtil.eq("accessToken", accessToken)); - @SuppressWarnings("unchecked") - List lista = dynamicQuery(dq); - return lista == null || lista.isEmpty() ? null : lista.get(0); + + List lista = richiestaAccessoAttiLocalService.dynamicQuery(dq); + if(lista != null && !lista.isEmpty()){ + return lista.get(0); + } + + return null; } - @SuppressWarnings("unchecked") - @Override - public List findRichiesteByGroup(long userId, int start, int end) throws SystemException { + public List findRichiesteByGroup(long userId, int start, int end) throws SystemException{ + + List listaLong = new ArrayList(); - List groupIds = new ArrayList<>(); List organizationList = OrganizationLocalServiceUtil.getUserOrganizations(userId); - if (Validator.isNull(organizationList)) { + if(organizationList != null && !organizationList.isEmpty()){ for (Organization organization : organizationList) { - groupIds.add(organization.getGroupId()); + listaLong.add(organization.getGroupId()); } } - DynamicQuery dq = dynamicQuery(); - dq.add(RestrictionsFactoryUtil.eq("gestita", false)); - if (!groupIds.isEmpty()) { - dq.add(RestrictionsFactoryUtil.in("groupId", groupIds)); - } - return dynamicQuery(dq, start, end); - } - - private static Date parseEndDate(String input) { - return parseDate(input, false); - } - - private static Date parseStartDate(String input) { + listaLong.add(0L); - return parseDate(input, true); - } + DynamicQuery dq = richiestaAccessoAttiLocalService.dynamicQuery(); + dq.add(RestrictionsFactoryUtil.eq("gestita", false)); + dq.add(RestrictionsFactoryUtil.in("groupId", listaLong)); - private static Date parseDate(String input, boolean isStart) { + return richiestaAccessoAttiLocalService.dynamicQuery(dq, start, end); - Calendar calendar = Calendar.getInstance(); - try { - calendar.setTime(sdf.parse(input)); - } catch (ParseException e) { - calendar.setTime(isStart ? new Date(0) : new Date()); - } - calendar.set(Calendar.HOUR_OF_DAY, isStart ? 0 : 23); - calendar.set(Calendar.MINUTE, isStart ? 0 : 59); - calendar.set(Calendar.SECOND, isStart ? 0 : 59); - return calendar.getTime(); } -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiServiceImpl.java index 1bd5b29e..1cf6862e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiServiceImpl.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.accesso.atti.service.impl; @@ -12,22 +18,23 @@ import it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiServ /** * The implementation of the richiesta accesso atti remote service. + * *

- * 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.accesso.atti.service.RichiestaAccessoAttiService} interface. + * 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.accesso.atti.service.RichiestaAccessoAttiService} interface. + * *

- * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS - * credentials because this service can be accessed remotely. + * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely. *

* - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting * @see it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiServiceBaseImpl * @see it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil */ -public class RichiestaAccessoAttiServiceImpl extends RichiestaAccessoAttiServiceBaseImpl { +public class RichiestaAccessoAttiServiceImpl + extends RichiestaAccessoAttiServiceBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link - * it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil} to access the richiesta accesso atti - * remote service. + * NOTE FOR DEVELOPERS: + * + * Never reference this interface directly. Always use {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil} to access the richiesta accesso atti remote service. */ -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java index 9f1bf01c..e69c92d6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java @@ -8,24 +8,34 @@ import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.StringPool; public class AccessoAttiAccessTokenUtil { - + private static final Log _log = LogFactoryUtil.getLog(AccessoAttiAccessTokenUtil.class); - - public static String generateAccessToken(long richiestaAccessoAttiId, String numeroProgetto, long richiedenteUserId) { - + + public static String generateAccessToken(long richiestaAccessoAttiId, String numeroProgetto, long richiedenteUserId){ + StringBuffer sb = new StringBuffer(); + try { - String concatString = String.valueOf(richiestaAccessoAttiId) + StringPool.UNDERLINE + numeroProgetto - + StringPool.UNDERLINE + richiedenteUserId; + + String concatString = String.valueOf(richiestaAccessoAttiId) + StringPool.UNDERLINE + + numeroProgetto + StringPool.UNDERLINE + richiedenteUserId; + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(concatString.getBytes()); - byte byteData[] = md.digest(); - for (int i = 0; i < byteData.length; i++) { - sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1)); - } + + byte byteData[] = md.digest(); + + for (int i = 0; i < byteData.length; i++) { + sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1)); + } + } catch (NoSuchAlgorithmException e) { - _log.error(e, e); + _log.error(e,e); } + return sb.toString(); + } + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java index e2e3e72e..1412700f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java @@ -11,57 +11,68 @@ import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.repository.model.FileEntry; import com.liferay.portal.kernel.util.FileUtil; -import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.service.ServiceContext; import com.liferay.portlet.documentlibrary.model.DLFolder; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil; public class DocumentLibraryUtil { - + public static Log _log = LogFactoryUtil.getLog(DocumentLibraryUtil.class); public static final String RICHIESTA_ATTI_FOLDER_NAME = "RICHIESTA_ATTI"; public static final String PAGAMENTO_CODEC_FILENAME = "PAGAMENTO_"; public static final String DOCUMENTO_CODEC_FILENAME = "DOCUMENTO_"; - - public static long saveFileEntryAccessoAtti(long companyGroupId, long richiestaAccessoAttiId, - String originFileName, File file, boolean pagamento) { - + + public static long saveFileEntryAccessoAtti(long companyGroupId, long richiestaAccessoAttiId, String originFileName, + File file, boolean pagamento) { + long fileEntryId = 0L; + try { DLFolder folder = getRichiestaAttiFolder(companyGroupId); - if (folder != null) { - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAttiId); - if (richiestaAccessoAtti != null) { + if(folder != null){ + + RichiestaAccessoAtti richiestaAccessoAtti = + RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId); + + if(richiestaAccessoAtti != null){ + ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(richiestaAccessoAtti.getCompanyId()); serviceContext.setUserId(richiestaAccessoAtti.getUserId()); + String mineType = FileUtil.getExtension(originFileName); - String prefixedFileName = StringPool.BLANK; - if (pagamento) { - prefixedFileName = PAGAMENTO_CODEC_FILENAME + richiestaAccessoAttiId + StringPool.PERIOD - + mineType; + + String prefixedFileName = ""; + if(pagamento){ + prefixedFileName = PAGAMENTO_CODEC_FILENAME + richiestaAccessoAttiId + "." + mineType; } else { - prefixedFileName = DOCUMENTO_CODEC_FILENAME + richiestaAccessoAttiId + StringPool.PERIOD - + mineType; + prefixedFileName = DOCUMENTO_CODEC_FILENAME + richiestaAccessoAttiId + "." + mineType; } - FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(richiestaAccessoAtti.getUserId(), - folder.getRepositoryId(), folder.getFolderId(), prefixedFileName, mineType, - prefixedFileName, StringPool.BLANK, StringPool.BLANK, file, serviceContext); + + FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry( + richiestaAccessoAtti.getUserId(), folder.getRepositoryId(), folder.getFolderId(), + prefixedFileName, mineType, prefixedFileName, "", "", file, serviceContext); + fileEntryId = fileEntry.getFileEntryId(); + } } + } catch (PortalException | SystemException e) { - _log.error(e, e); + _log.error(e,e); } + return fileEntryId; + } - - private static DLFolder getRichiestaAttiFolder(long companyGroupId) throws PortalException, SystemException { - + + private static DLFolder getRichiestaAttiFolder(long companyGroupId) throws PortalException, SystemException{ + DLFolder folder = DLFolderLocalServiceUtil.getFolder(companyGroupId, 0L, RICHIESTA_ATTI_FOLDER_NAME); + return folder; } + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/EmailSenderUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/EmailSenderUtil.java index edec147d..a6e61d06 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/EmailSenderUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/EmailSenderUtil.java @@ -12,127 +12,187 @@ import com.liferay.portal.kernel.mail.MailMessage; public class EmailSenderUtil { - public static void sendAcceptedEmail(long richiestaAccessoAttiId, String testoAggiuntivo) throws SystemException, - AddressException { - - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAttiId); - if (richiestaAccessoAtti != null) { +// private static final Log _log = LogFactoryUtil.getLog(EmailSenderUtil.class); + + public static void sendAcceptedEmail(long richiestaAccessoAttiId, String testoAggiuntivo) throws SystemException, AddressException{ + + RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId); + if(richiestaAccessoAtti != null){ + InternetAddress toAddress = new InternetAddress(richiestaAccessoAtti.getEmailRicontatto()); InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it"); + MailMessage mailMessage = new MailMessage(); - mailMessage.setTo(toAddress); - mailMessage.setFrom(fromAddress); + mailMessage.setTo(toAddress); + mailMessage.setFrom(fromAddress); + mailMessage.setSubject("Notifica Accettazione Richiesta Accesso Atti"); - mailMessage.setBody(creaCorpoMailRichiestaAccettata(richiestaAccessoAtti, testoAggiuntivo)); + mailMessage.setBody(creaCorpoMailRichiestaAccettata(richiestaAccessoAtti,testoAggiuntivo)); mailMessage.setHTMLFormat(true); + + /* + * Invio email + */ MailServiceUtil.sendEmail(mailMessage); } + } - - public static void sendDeniedEmail(long richiestaAccessoAttiId, String motivoRifiuto) throws SystemException, - AddressException { - - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAttiId); - if (richiestaAccessoAtti != null) { + + public static void sendDeniedEmail(long richiestaAccessoAttiId, String motivoRifiuto) throws SystemException, AddressException{ + + RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId); + if(richiestaAccessoAtti != null){ + InternetAddress toAddress = new InternetAddress(richiestaAccessoAtti.getEmailRicontatto()); InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it"); + MailMessage mailMessage = new MailMessage(); - mailMessage.setTo(toAddress); - mailMessage.setFrom(fromAddress); + mailMessage.setTo(toAddress); + mailMessage.setFrom(fromAddress); + mailMessage.setSubject("Notifica Rifiuto Richiesta Accesso Atti"); - mailMessage.setBody(creaCorpoMailRichiestaRifiutata(richiestaAccessoAtti, motivoRifiuto)); + mailMessage.setBody(creaCorpoMailRichiestaRifiutata(richiestaAccessoAtti, motivoRifiuto)); mailMessage.setHTMLFormat(true); + + /* + * Invio email + */ MailServiceUtil.sendEmail(mailMessage); } + } - - public static void sendAcceptedRequest(long richiestaAccessoAttiId) throws SystemException, AddressException { - - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAttiId); - if (richiestaAccessoAtti != null) { + + public static void sendAcceptedRequest(long richiestaAccessoAttiId) throws SystemException, AddressException{ + + RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId); + if(richiestaAccessoAtti != null){ + InternetAddress toAddress = new InternetAddress(richiestaAccessoAtti.getEmailRicontatto()); InternetAddress fromAddress = new InternetAddress("portos@regione.toscana.it"); + MailMessage mailMessage = new MailMessage(); - mailMessage.setTo(toAddress); - mailMessage.setFrom(fromAddress); + mailMessage.setTo(toAddress); + mailMessage.setFrom(fromAddress); + mailMessage.setSubject("Notifica Presa In Carico Richiesta"); - mailMessage.setBody(creaCorpoMailRichiestaInCarico(richiestaAccessoAtti)); + mailMessage.setBody(creaCorpoMailRichiestaInCarico(richiestaAccessoAtti)); mailMessage.setHTMLFormat(true); + + /* + * Invio email + */ MailServiceUtil.sendEmail(mailMessage); } + } - - private static String creaCorpoMailRichiestaInCarico(RichiestaAccessoAtti richiestaAccessoAtti) { - + + private static String creaCorpoMailRichiestaInCarico(RichiestaAccessoAtti richiestaAccessoAtti){ + StringBuilder sb = new StringBuilder(); + + /* + * Gestione header + */ sb.append("Notifica Presa In Carico Richiesta"); + sb.append("
"); sb.append("Salve ,"); sb.append("
"); + sb.append("
"); + sb.append("
"); - sb.append("con la seguente email le comunichiamo che la sua richiesta n. "); + sb.append("con la seguente email le comunichiamo che la sua richiesta n. "); sb.append(richiestaAccessoAtti.getProtocolloEntrata()); sb.append(" di accedere all'atto numero "); sb.append(richiestaAccessoAtti.getNumeroProgetto()); sb.append(" è stata presa in carico dai nostri funzionari. Riceverà successivamente una mail nella quale le verrà indicato l'esito della sua richiesta."); + sb.append("
"); sb.append("
"); + return sb.toString(); + } - - private static String creaCorpoMailRichiestaAccettata(RichiestaAccessoAtti richiestaAccessoAtti, String testoExtra) { - + + private static String creaCorpoMailRichiestaAccettata(RichiestaAccessoAtti richiestaAccessoAtti, String testoExtra){ + StringBuilder sb = new StringBuilder(); + + /* + * Gestione header + */ sb.append("Notifica Accettazione Richiesta Accesso Atti"); + sb.append("
"); sb.append("Salve ,"); sb.append("
"); + sb.append("
"); + sb.append("
"); - sb.append("con la seguente email le comunichiamo che la sua richiesta n. "); + sb.append("con la seguente email le comunichiamo che la sua richiesta n. "); sb.append(richiestaAccessoAtti.getProtocolloUscita()); sb.append(" di accedere all'atto numero "); sb.append(richiestaAccessoAtti.getNumeroProgetto()); sb.append(" è stata accettata."); + sb.append("
"); + sb.append("
"); sb.append("Il suo codice di accesso al fascicolo è il seguente: "); sb.append(richiestaAccessoAtti.getAccessToken()); sb.append(""); sb.append("
"); + sb.append("
"); + sb.append("
"); sb.append(testoExtra); sb.append("
"); + sb.append("
"); + sb.append("
"); sb.append("Le ricordiamo che l'accesso avrà una validità di 7 giorni."); sb.append("
"); + sb.append("
"); + return sb.toString(); } - - private static String creaCorpoMailRichiestaRifiutata(RichiestaAccessoAtti richiestaAccessoAtti, - String motivoRifiuto) { - + + public static void sendDeniedEmail(){ + + } + + private static String creaCorpoMailRichiestaRifiutata(RichiestaAccessoAtti richiestaAccessoAtti, String motivoRifiuto){ + StringBuilder sb = new StringBuilder(); + + /* + * Gestione header + */ sb.append("Notifica Rifiuto Richiesta Accesso Atti"); + sb.append("
"); sb.append("Salve ,"); sb.append("
"); + sb.append("
"); + sb.append("
"); - sb.append("con la seguente email le comunichiamo che la sua richiesta n. "); + sb.append("con la seguente email le comunichiamo che la sua richiesta n. "); sb.append(richiestaAccessoAtti.getProtocolloUscita()); sb.append(" di accedere all'atto numero "); sb.append(richiestaAccessoAtti.getNumeroProgetto()); sb.append(" è stata rifiutata per la seguente motivazione: "); sb.append(motivoRifiuto); sb.append("
"); + + return sb.toString(); } + + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp index 07d65aa8..c1456196 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp @@ -1,74 +1,80 @@ <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="init.jsp" %> -
+ +
+ - -
+ + +
- +
- - function (val, fieldNode, ruleValue) { - return fieldNode.get('disabled') || (val != null && val != ''); - } - - - function (val, fieldNode, ruleValue) { - if (fieldNode.get('disabled')) { - return true; + + function (val, fieldNode, ruleValue) { + return fieldNode.get('disabled') || (val != null && val!=''); } - var regex = '^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$'; - var regex1 = /^(?:[B-DF-HJ-NP-TV-Z](?:[AEIOU]{2}|[AEIOU]X)|[AEIOU]{2}X|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}[\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[1256LMRS][\dLMNP-V])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM])(?:[A-MZ][1-9MNP-V][\dLMNP-V]{2}|[A-M][0L](?:[\dLMNP-V][1-9MNP-V]|[1-9MNP-V][0L]))[A-Z]$/i; - var regexObj = new RegExp (regex1); - var result = regexObj.test(val); - return result; - } - - + + + + function (val, fieldNode, ruleValue) { + if(fieldNode.get('disabled')){ + return true; + } + var regex = '^[A-Za-z]{6}[0-9]{2}[A-Za-z]{1}[0-9]{2}[A-Za-z]{1}[0-9]{3}[A-Za-z]{1}$'; + var regex1 = /^(?:[B-DF-HJ-NP-TV-Z](?:[AEIOU]{2}|[AEIOU]X)|[AEIOU]{2}X|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}[\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[1256LMRS][\dLMNP-V])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM])(?:[A-MZ][1-9MNP-V][\dLMNP-V]{2}|[A-M][0L](?:[\dLMNP-V][1-9MNP-V]|[1-9MNP-V][0L]))[A-Z]$/i; + var regexObj = new RegExp (regex1); + var result = regexObj.test(val); + return result; + } + +
-
+
- +
- +
-
+
-
- +
+ function (val, fieldNode, ruleValue) { var A = AUI(); - var checkValue = true; + + var checkValue = true; + var portletNamespace = ''; - var sanatorie = A.one("#" + portletNamespace + "sanatoria").val(); - if (sanatorie == "true") { - if (val == "") { + var sanatorie = A.one("#"+portletNamespace + "sanatoria").val(); + + if(sanatorie == "true"){ + if(val == ""){ checkValue = false; } } + return checkValue; } @@ -76,97 +82,100 @@
-
+
-
Tipologia Soggetto
+
Tipologia Soggetto
- - - - - - - + + + + + + +
-
+
-
Tipologia Richiesta
+
Tipologia Richiesta
- - + +
- -
+
-
+
- +
-
+ + +
function (val, fieldNode, ruleValue) { - var A = AUI(); - var checkValue = true; - var portletNamespace = ''; - var dataVidimazione = A.one("#" + portletNamespace + "dataVidimazione").val(); - var sanatorie = A.one("#"+portletNamespace + "sanatoria").val(); - if (sanatorie == "true") { - checkValue = false; - } - if (dataVidimazione != "") { - var checkDateFixed = "01/01/2015"; - var checkDateFixed = new Date(checkDateFixed); - var vidimazioneDate = new Date(dataVidimazione); - if (vidimazioneDate <= checkDateFixed) { - checkValue = false; - } - } - if (!checkValue) { - if (val != "") { - return true; - } - } - return checkValue; + var A = AUI(); + + var checkValue = true; + var portletNamespace = ''; + var dataVidimazione = A.one("#"+portletNamespace + "dataVidimazione").val(); + var sanatorie = A.one("#"+portletNamespace + "sanatoria").val(); + + if(sanatorie == "true"){ + checkValue = false; + } + + if(dataVidimazione != ""){ + var checkDateFixed = "01/01/2015"; + var checkDateFixed = new Date(checkDateFixed); + + var vidimazioneDate = new Date(dataVidimazione); + + if(vidimazioneDate <= checkDateFixed){ + checkValue = false; + } + } + + if(!checkValue){ + if(val != ""){ + return true; + } + + } + + return checkValue; }
-
+ +
+ + + + + -YUI().use('aui-datepicker', function(Y) { - var datepicker = new Y.DatePicker({ - trigger: '.calendarDatepicker', - calendar: { - dateFormat: 'dd/MM/yyyy', - }, - mask: '%d/%m/%Y', - popover: { - toolbars: { - header: [[{ - icon: 'icon-trash', - label: Liferay.Language.get("Cancella"), - on: { - click: function() { - datepicker.clearSelection(); - } - } - }]] - }, - zIndex: 1 - } - }); -}); - \ No newline at end of file + + +YUI().use( + 'aui-datepicker', + function(Y) { + var datepicker = new Y.DatePicker( + { + trigger: '.calendarDatepicker', + calendar: { + dateFormat: 'dd/MM/yyyy', + }, + mask: '%d/%m/%Y', + popover: { + toolbars: { + header: [[ + { + icon: 'icon-trash', + label: Liferay.Language.get("Cancella"), + on: { + click: function() { + datepicker.clearSelection(); + } + } + } + ]] + }, + zIndex: 1 + } + } + ); + } +); + + diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateFunzionarioException.java b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateFunzionarioException.java index 6a9e1899..edbec43b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateFunzionarioException.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateFunzionarioException.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.portos.calendar.appointments; @@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments; import com.liferay.portal.kernel.exception.PortalException; /** - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting */ -@SuppressWarnings("serial") public class DuplicateFunzionarioException extends PortalException { public DuplicateFunzionarioException() { @@ -32,4 +37,4 @@ public class DuplicateFunzionarioException extends PortalException { super(cause); } -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicatePrenotazioneException.java b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicatePrenotazioneException.java index 8ddd98e0..ee4314e7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicatePrenotazioneException.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicatePrenotazioneException.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.portos.calendar.appointments; @@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments; import com.liferay.portal.kernel.exception.PortalException; /** - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting */ -@SuppressWarnings("serial") public class DuplicatePrenotazioneException extends PortalException { public DuplicatePrenotazioneException() { @@ -32,4 +37,4 @@ public class DuplicatePrenotazioneException extends PortalException { super(cause); } -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateProfessionistaException.java b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateProfessionistaException.java index a6ed4a53..08ab7c39 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateProfessionistaException.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/DuplicateProfessionistaException.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.portos.calendar.appointments; @@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments; import com.liferay.portal.kernel.exception.PortalException; /** - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting */ -@SuppressWarnings("serial") public class DuplicateProfessionistaException extends PortalException { public DuplicateProfessionistaException() { @@ -32,4 +37,4 @@ public class DuplicateProfessionistaException extends PortalException { super(cause); } -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchDisponibilitaException.java b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchDisponibilitaException.java index 1a9c7f25..77a32d1e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchDisponibilitaException.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchDisponibilitaException.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.portos.calendar.appointments; @@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments; import com.liferay.portal.NoSuchModelException; /** - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting */ -@SuppressWarnings("serial") public class NoSuchDisponibilitaException extends NoSuchModelException { public NoSuchDisponibilitaException() { @@ -32,4 +37,4 @@ public class NoSuchDisponibilitaException extends NoSuchModelException { super(cause); } -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchFunzionarioException.java b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchFunzionarioException.java index ca5c71de..88ff8879 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchFunzionarioException.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchFunzionarioException.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.portos.calendar.appointments; @@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments; import com.liferay.portal.NoSuchModelException; /** - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting */ -@SuppressWarnings("serial") public class NoSuchFunzionarioException extends NoSuchModelException { public NoSuchFunzionarioException() { @@ -32,4 +37,4 @@ public class NoSuchFunzionarioException extends NoSuchModelException { super(cause); } -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchPrenotazioneException.java b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchPrenotazioneException.java index 9a831064..d3f93171 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchPrenotazioneException.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchPrenotazioneException.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.portos.calendar.appointments; @@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments; import com.liferay.portal.NoSuchModelException; /** - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting */ -@SuppressWarnings("serial") public class NoSuchPrenotazioneException extends NoSuchModelException { public NoSuchPrenotazioneException() { @@ -32,4 +37,4 @@ public class NoSuchPrenotazioneException extends NoSuchModelException { super(cause); } -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchProfessionistaException.java b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchProfessionistaException.java index 24e17d50..0359bf1e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchProfessionistaException.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/NoSuchProfessionistaException.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.portos.calendar.appointments; @@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments; import com.liferay.portal.NoSuchModelException; /** - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting */ -@SuppressWarnings("serial") public class NoSuchProfessionistaException extends NoSuchModelException { public NoSuchProfessionistaException() { @@ -32,4 +37,4 @@ public class NoSuchProfessionistaException extends NoSuchModelException { super(cause); } -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/SlotNotAvailableException.java b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/SlotNotAvailableException.java index 58a65b67..a53f88f6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/SlotNotAvailableException.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-calendar-appointments-portlet/docroot/WEB-INF/service/it/tref/portos/calendar/appointments/SlotNotAvailableException.java @@ -1,9 +1,15 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.portos.calendar.appointments; @@ -11,9 +17,8 @@ package it.tref.portos.calendar.appointments; import com.liferay.portal.kernel.exception.PortalException; /** - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting */ -@SuppressWarnings("serial") public class SlotNotAvailableException extends PortalException { public SlotNotAvailableException() { @@ -32,4 +37,4 @@ public class SlotNotAvailableException extends PortalException { super(cause); } -} +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/liferay-portlet.xml b/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/liferay-portlet.xml index d90e0741..b490ffd8 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/liferay-portlet.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/liferay-portlet.xml @@ -5,14 +5,10 @@ 1 /icon.png - - configuration - + configuration 1.5 /css/main.css - - /js/main.js - + /js/main.js 1-portlet diff --git a/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/companyconfig/portlet/CompanyConfigurationPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/companyconfig/portlet/CompanyConfigurationPortlet.java index 1e36fa75..cf849e0b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/companyconfig/portlet/CompanyConfigurationPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/companyconfig/portlet/CompanyConfigurationPortlet.java @@ -1,24 +1,30 @@ package it.tref.liferay.portos.companyconfig.portlet; -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; - import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.model.Company; import com.liferay.portal.service.CompanyLocalServiceUtil; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContextFactory; import com.liferay.util.bridges.mvc.MVCPortlet; +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; + public class CompanyConfigurationPortlet extends MVCPortlet { - public void saveCustomFields(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, + public void saveCustomFields(ActionRequest actionRequest, + ActionResponse actionResponse) throws PortalException, SystemException { - ServiceContext serviceContext = ServiceContextFactory.getInstance(Company.class.getName(), actionRequest); - Company company = CompanyLocalServiceUtil.getCompany(serviceContext.getCompanyId()); + ServiceContext serviceContext = ServiceContextFactory.getInstance( + Company.class.getName(), actionRequest); + Company company = CompanyLocalServiceUtil.getCompany(serviceContext + .getCompanyId()); company.setExpandoBridgeAttributes(serviceContext); CompanyLocalServiceUtil.updateCompany(company); + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/init.jsp index 4866d541..7ab610cb 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/init.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/init.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/init.jsp" %> <%@page import="com.liferay.portal.kernel.util.ParamUtil"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/view.jsp index f13448b6..821789a6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/company_configuration/view.jsp @@ -1,25 +1,38 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="javax.portlet.PortletURL"%> <%@page import="javax.portlet.PortletRequest"%> <%@page import="com.liferay.portal.util.PortletKeys"%> <%@page import="com.liferay.portlet.PortletURLFactoryUtil"%> <%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%> -<%@include file="/html/company_configuration/init.jsp"%> +<%@include file="/html/company_configuration/init.jsp" %> + <% PortletURL companyCustomFieldsURL = PortletURLFactoryUtil.create(request, PortletKeys.EXPANDO, plid, PortletRequest.RENDER_PHASE); companyCustomFieldsURL.setWindowState(LiferayWindowState.POP_UP); companyCustomFieldsURL.setParameter("struts_action", "/expando/view_attributes"); companyCustomFieldsURL.setParameter("modelResource", Company.class.getName()); %> - - + + +
+ - + + + \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/init.jsp index 0afcda91..065d3d8b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/init.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-company-configuration-portlet/docroot/html/init.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/cookies/action/StartUpAction.java b/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/cookies/action/StartUpAction.java index 2e85f9bd..2e08553e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/cookies/action/StartUpAction.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/cookies/action/StartUpAction.java @@ -1,5 +1,6 @@ package it.tref.liferay.portos.cookies.action; + import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.events.SimpleAction; import com.liferay.portal.kernel.exception.PortalException; @@ -25,73 +26,97 @@ import com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil; public class StartUpAction extends SimpleAction { - private static final Log _log = LogFactoryUtil.getLog(StartUpAction.class); - - @Override - public void run(String[] companyIds) throws ActionException { - - for (String id : companyIds) { - try { - long companyId = GetterUtil.getLong(id); - String[] defaultActions = { ActionKeys.VIEW, ActionKeys.UPDATE }; - String[] guestActions = { ActionKeys.VIEW }; - // Organization custom fields - addExpandoColumnIfNotExists(companyId, Group.class.getName(), "cookiesJournalarticleId", - ExpandoColumnConstants.STRING, true, false, defaultActions, guestActions); - } catch (Exception e) { - _log.error("Errore nella procedura automatizzata di configurazione", e); - } - } - } - - private ExpandoColumn addExpandoColumnIfNotExists(long companyId, String className, String name, int type, - boolean indexed, boolean hidden, String[] defaultActions, String[] guestActions) throws SystemException { - - long classNameId = PortalUtil.getClassNameId(className); - ExpandoTable expandoTable = null; - try { - expandoTable = ExpandoTableLocalServiceUtil.getTable(companyId, classNameId, - ExpandoTableConstants.DEFAULT_TABLE_NAME); - } catch (PortalException e) { - try { - expandoTable = ExpandoTableLocalServiceUtil.addTable(companyId, classNameId, - ExpandoTableConstants.DEFAULT_TABLE_NAME); - } catch (PortalException e1) {} - } - ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), name); - if (expandoColumn == null) { - try { - expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), name, type); - - } catch (PortalException e) {} - } - try { - if (indexed) { - UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties(); - typeSettingsProperties.put(ExpandoColumnConstants.INDEX_TYPE, - String.valueOf(ExpandoColumnConstants.INDEX_TYPE_TEXT)); - expandoColumn.setTypeSettingsProperties(typeSettingsProperties); - expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn); - } - if (hidden) { - UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties(); - typeSettingsProperties.put(ExpandoColumnConstants.PROPERTY_HIDDEN, String.valueOf(1)); - expandoColumn.setTypeSettingsProperties(typeSettingsProperties); - expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn); - } - Role roleGuest = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST); - Role rolePowerUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.POWER_USER); - Role roleUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER); - ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), - ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), - roleGuest.getRoleId(), guestActions); - ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), - ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), - rolePowerUser.getRoleId(), defaultActions); - ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), - ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), - roleUser.getRoleId(), defaultActions); - } catch (PortalException e) {} - return expandoColumn; - } + private final static Log _log = LogFactoryUtil.getLog(StartUpAction.class); + + @Override + public void run(String[] companyIds) throws ActionException { + + for (String id : companyIds) { + try { + long companyId = GetterUtil.getLong(id); + + String[] defaultActions = {ActionKeys.VIEW, ActionKeys.UPDATE}; + String[] guestActions = {ActionKeys.VIEW}; + + // Organization custom fields + addExpandoColumnIfNotExists(companyId, Group.class.getName(), "cookiesJournalarticleId", + ExpandoColumnConstants.STRING, true, false, defaultActions, guestActions); + } catch (Exception e) { + _log.error("Errore nella procedura automatizzata di configurazione", e); + } + } + } + + private ExpandoColumn addExpandoColumnIfNotExists(long companyId, String className, String name, int type, + boolean indexed, boolean hidden, String[] defaultActions, String[] guestActions) throws SystemException { + + long classNameId = PortalUtil.getClassNameId(className); + + ExpandoTable expandoTable = null; + try { + expandoTable = + ExpandoTableLocalServiceUtil.getTable(companyId, classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME); + } catch (PortalException e) { + try { + expandoTable = + ExpandoTableLocalServiceUtil.addTable(companyId, classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME); + } catch (PortalException e1) { + } + } + + ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), name); + + if (expandoColumn == null) { + + try { + expandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), name, type); + + } catch (PortalException e) { + } + } + + try { + + if (indexed) { + + UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties(); + + typeSettingsProperties.put(ExpandoColumnConstants.INDEX_TYPE, + String.valueOf(ExpandoColumnConstants.INDEX_TYPE_TEXT)); + + expandoColumn.setTypeSettingsProperties(typeSettingsProperties); + + expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn); + } + + if (hidden) { + + UnicodeProperties typeSettingsProperties = expandoColumn.getTypeSettingsProperties(); + + typeSettingsProperties.put(ExpandoColumnConstants.PROPERTY_HIDDEN, String.valueOf(1)); + + expandoColumn.setTypeSettingsProperties(typeSettingsProperties); + + expandoColumn = ExpandoColumnLocalServiceUtil.updateExpandoColumn(expandoColumn); + } + + Role roleGuest = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST); + Role rolePowerUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.POWER_USER); + Role roleUser = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER); + + ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), + ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), roleGuest.getRoleId(), + guestActions); + ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), + ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), rolePowerUser.getRoleId(), + defaultActions); + ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, ExpandoColumn.class.getName(), + ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), roleUser.getRoleId(), + defaultActions); + } catch (PortalException e) { + } + + return expandoColumn; + } + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/init.jsp index 0deaecc7..ab7501ce 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/init.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/init.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="java.text.SimpleDateFormat"%> <%@page import="com.liferay.portlet.PortletURLUtil"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/view.jsp index 8f7517bc..492629d1 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-cookies-portlet/docroot/view.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.liferay.portal.util.PortalUtil"%> <%@page import="com.liferay.portal.kernel.util.Validator"%> <%@page import="com.liferay.portal.kernel.util.StringPool"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/portlet.xml b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/portlet.xml index ddb0f9f8..deb4c366 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/portlet.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/portlet.xml @@ -1,9 +1,6 @@ - + 1 Deploy Alert diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/action/DeployAction.java b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/action/DeployAction.java index 5297156b..22dd0302 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/action/DeployAction.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/action/DeployAction.java @@ -1,14 +1,5 @@ package it.tref.liferay.portos.deployalert.action; -import it.tref.liferay.portos.deployalert.constants.MailConstants; -import it.tref.liferay.portos.deployalert.model.NotificationMail; -import it.tref.liferay.portos.deployalert.service.NotificationLogLocalServiceUtil; -import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil; -import it.tref.liferay.portos.deployalert.util.DeployAlertUtil; -import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil; - -import java.util.List; - import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.events.SimpleAction; import com.liferay.portal.kernel.exception.PortalException; @@ -25,53 +16,78 @@ import com.liferay.portal.model.Company; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.util.PortalUtil; +import it.tref.liferay.portos.deployalert.constants.MailConstants; +import it.tref.liferay.portos.deployalert.model.NotificationMail; +import it.tref.liferay.portos.deployalert.service.NotificationLogLocalServiceUtil; +import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil; +import it.tref.liferay.portos.deployalert.util.DeployAlertUtil; +import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil; + +import java.util.List; + public class DeployAction extends SimpleAction { - private static final Log _log = LogFactoryUtil.getLog(DeployAction.class); - - @Override - public void run(final String[] ids) throws ActionException { - - MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, new MessageListener() { - - @Override - public void receive(Message message) throws MessageListenerException { - - String evento = message.getString("command"); - String nomePlugin = message.getString("servletContextName"); - if (evento.equals("undeploy") && nomePlugin.equals("portos-deploy-alert-portlet")) { - try { - NotificationLogLocalServiceUtil.addNotification(nomePlugin, evento); - } catch (PortalException | SystemException e) { - _log.error(e, e); - } - MessageBusUtil.unregisterMessageListener(DestinationNames.HOT_DEPLOY, this); - } else if (evento.equals("deploy") || evento.equals("undeploy")) { - try { - List notifications; - NotificationLogLocalServiceUtil.addNotification(nomePlugin, evento); - notifications = - NotificationMailLocalServiceUtil.findNotifications(PortalUtil.getDefaultCompanyId(), - nomePlugin); - for (int i = 0; i < notifications.size(); i++) { - String templateName = notifications.get(i).getNomeTemplate(); - if (templateName.equals(MailConstants.DEFAULT_TEMPLATE)) { - if (evento.equals("deploy")) { - templateName = MailConstants.DEFAULT_DEPLOY_TEMPLATE; - } else { - templateName = MailConstants.DEFAULT_UNDEPLOY_TEMPLATE; - } - } - JSONObject parametri = DeployAlertUtil.getParametri(nomePlugin, evento); - ServiceContext serviceContext = DeployAlertUtil.getServiceContext(); - MailManagerUtil.sendMailByTemplateName(Company.class.toString(), - serviceContext.getCompanyId(), templateName, parametri, serviceContext); - } - } catch (Exception e) { - _log.error(e, e); - } - } - } - }); - } + private final static Log _log = LogFactoryUtil.getLog(DeployAction.class); + + @Override + public void run(final String[] ids) throws ActionException { + /* + * ServiceContext serviceContext = DeployAlertUtil.getServiceContext(); try { + * PermissionThreadLocal + * .setPermissionChecker(PermissionCheckerFactoryUtil.create(UserLocalServiceUtil + * .getUser(serviceContext.getUserId()))); } catch (Exception e) { _log.error(e, e); } + * DeployAlertUtil.addDefaultDeployMailTemplate(serviceContext); + * DeployAlertUtil.addDefaultUndeployMailTemplate(serviceContext); + */ + + MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, new MessageListener() { + + @Override + public void receive(Message message) throws MessageListenerException { + + String evento = message.getString("command"); + String nomePlugin = message.getString("servletContextName"); + + if (evento.equals("undeploy") && nomePlugin.equals("portos-deploy-alert-portlet")) { + try { + NotificationLogLocalServiceUtil.addNotification(nomePlugin, evento); + } catch (PortalException | SystemException e) { + _log.error(e, e); + } + MessageBusUtil.unregisterMessageListener(DestinationNames.HOT_DEPLOY, this); + } else if (evento.equals("deploy") || evento.equals("undeploy")) { + try { + List notifications; + + NotificationLogLocalServiceUtil.addNotification(nomePlugin, evento); + + notifications = + NotificationMailLocalServiceUtil.findNotifications(PortalUtil.getDefaultCompanyId(), nomePlugin); + + for (int i = 0; i < notifications.size(); i++) { + + String templateName = notifications.get(i).getNomeTemplate(); + + if (templateName.equals(MailConstants.DEFAULT_TEMPLATE)) { + if (evento.equals("deploy")) { + templateName = MailConstants.DEFAULT_DEPLOY_TEMPLATE; + } else { + templateName = MailConstants.DEFAULT_UNDEPLOY_TEMPLATE; + } + } + + JSONObject parametri = DeployAlertUtil.getParametri(nomePlugin, evento); + + ServiceContext serviceContext = DeployAlertUtil.getServiceContext(); + MailManagerUtil.sendMailByTemplateName(Company.class.toString(), serviceContext.getCompanyId(), + templateName, parametri, serviceContext); + } + + } catch (Exception e) { + _log.error(e, e); + } + } + } + }); + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/constants/MailConstants.java b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/constants/MailConstants.java index da04b75a..fbff52dc 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/constants/MailConstants.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/constants/MailConstants.java @@ -2,7 +2,10 @@ package it.tref.liferay.portos.deployalert.constants; public class MailConstants { - public static final String DEFAULT_TEMPLATE = "default"; - public static final String DEFAULT_DEPLOY_TEMPLATE = "default-deploy"; - public static final String DEFAULT_UNDEPLOY_TEMPLATE = "default-undeploy"; + public static final String DEFAULT_TEMPLATE = "default"; + + public static final String DEFAULT_DEPLOY_TEMPLATE = "default-deploy"; + + public static final String DEFAULT_UNDEPLOY_TEMPLATE = "default-undeploy"; + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/control/DeployAlertControl.java b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/control/DeployAlertControl.java index 185ccbd7..d1255ad9 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/control/DeployAlertControl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/control/DeployAlertControl.java @@ -8,14 +8,17 @@ import com.liferay.portlet.BaseControlPanelEntry; public class DeployAlertControl extends BaseControlPanelEntry { - @Override - public boolean hasAccessPermission(PermissionChecker permissionChecker, Group group, Portlet portlet) - throws Exception { - - long companyId = PortalUtil.getDefaultCompanyId(); - if (companyId == permissionChecker.getCompanyId()) { - return true; - } - return false; - } + public boolean hasAccessPermission(PermissionChecker permissionChecker, Group group, Portlet portlet) + throws Exception { + + long companyId = PortalUtil.getDefaultCompanyId(); + + if (companyId == permissionChecker.getCompanyId()) { + return true; + } + + return false; + + } + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/portlet/NotificatorPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/portlet/NotificatorPortlet.java index 79fcadd2..62003a74 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/portlet/NotificatorPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/portlet/NotificatorPortlet.java @@ -1,11 +1,5 @@ package it.tref.liferay.portos.deployalert.portlet; -import it.tref.liferay.portos.deployalert.model.NotificationMail; -import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; - import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.servlet.SessionErrors; @@ -14,45 +8,61 @@ import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContextFactory; import com.liferay.util.bridges.mvc.MVCPortlet; +import it.tref.liferay.portos.deployalert.model.NotificationMail; +import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil; + +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; + +/** + * Portlet implementation class AdminDeployNotificatorPortlet + */ public class NotificatorPortlet extends MVCPortlet { - public void addNotification(ActionRequest request, ActionResponse response) throws PortalException, SystemException { - - ServiceContext serviceContext = ServiceContextFactory.getInstance(NotificationMail.class.getName(), request); - String nomePlugin = ParamUtil.getString(request, "nomePlugin"); - String nomeTemplate = ParamUtil.getString(request, "nomeTemplate"); - try { - NotificationMailLocalServiceUtil.addNotification(nomePlugin, nomeTemplate, serviceContext); - } catch (PortalException e) { - SessionErrors.add(request, e.getClass()); - response.setRenderParameter("mvcPath", "/html/notificator/edit_notification.jsp"); - } - } - - public void deleteNotification(ActionRequest request, ActionResponse response) throws PortalException, - SystemException { - - long notificationId = ParamUtil.getLong(request, "notificationId"); - try { - NotificationMailLocalServiceUtil.deleteNotificationMail(notificationId); - } catch (PortalException pe) { - SessionErrors.add(request, pe.getClass().getName()); - } - } - - public void updateNotification(ActionRequest request, ActionResponse response) throws PortalException, - SystemException { - - ServiceContext serviceContext = ServiceContextFactory.getInstance(NotificationMail.class.getName(), request); - String nomePlugin = ParamUtil.getString(request, "nomePlugin"); - String nomeTemplate = ParamUtil.getString(request, "nomeTemplate"); - long notificationId = ParamUtil.getLong(request, "notificationId"); - try { - NotificationMailLocalServiceUtil.updateNotification(nomePlugin, nomeTemplate, serviceContext, - notificationId); - } catch (PortalException pe) { - SessionErrors.add(request, pe.getClass()); - response.setRenderParameter("mvcPath", "/html/notificator/edit_notification.jsp"); - } - } + public void addNotification(ActionRequest request, ActionResponse response) throws PortalException, SystemException { + + ServiceContext serviceContext = ServiceContextFactory.getInstance(NotificationMail.class.getName(), request); + + String nomePlugin = ParamUtil.getString(request, "nomePlugin"); + String nomeTemplate = ParamUtil.getString(request, "nomeTemplate"); + + try { + NotificationMailLocalServiceUtil.addNotification(nomePlugin, nomeTemplate, serviceContext); + } catch (PortalException e) { + SessionErrors.add(request, e.getClass()); + + response.setRenderParameter("mvcPath", "/html/notificator/edit_notification.jsp"); + } + } + + public void deleteNotification(ActionRequest request, ActionResponse response) throws PortalException, + SystemException { + + long notificationId = ParamUtil.getLong(request, "notificationId"); + + try { + NotificationMailLocalServiceUtil.deleteNotificationMail(notificationId); + + } catch (PortalException pe) { + SessionErrors.add(request, pe.getClass().getName()); + } + } + + public void updateNotification(ActionRequest request, ActionResponse response) throws PortalException, + SystemException { + + ServiceContext serviceContext = ServiceContextFactory.getInstance(NotificationMail.class.getName(), request); + + String nomePlugin = ParamUtil.getString(request, "nomePlugin"); + String nomeTemplate = ParamUtil.getString(request, "nomeTemplate"); + long notificationId = ParamUtil.getLong(request, "notificationId"); + + try { + NotificationMailLocalServiceUtil.updateNotification(nomePlugin, nomeTemplate, serviceContext, notificationId); + } catch (PortalException pe) { + SessionErrors.add(request, pe.getClass()); + + response.setRenderParameter("mvcPath", "/html/notificator/edit_notification.jsp"); + } + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationLogLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationLogLocalServiceImpl.java index f581bdc7..de467f37 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationLogLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationLogLocalServiceImpl.java @@ -1,13 +1,23 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.deployalert.service.impl; +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.util.Validator; + import it.tref.liferay.portos.deployalert.NotificationNomePluginException; import it.tref.liferay.portos.deployalert.NotificationTipoException; import it.tref.liferay.portos.deployalert.model.NotificationLog; @@ -15,18 +25,15 @@ import it.tref.liferay.portos.deployalert.service.base.NotificationLogLocalServi import java.util.Date; -import com.liferay.portal.kernel.exception.PortalException; -import com.liferay.portal.kernel.exception.SystemException; -import com.liferay.portal.kernel.util.Validator; - /** * The implementation of the notification log local service. *

- * 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.deployalert.service.NotificationLogLocalService} interface. + * 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.deployalert.service.NotificationLogLocalService} 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 Matteo @@ -35,28 +42,33 @@ import com.liferay.portal.kernel.util.Validator; */ public class NotificationLogLocalServiceImpl extends NotificationLogLocalServiceBaseImpl { - @Override - public NotificationLog addNotification(String nomePlugin, String tipo) throws SystemException, PortalException { - - Date now = new Date(); - validate(nomePlugin, tipo); - long notificationId = counterLocalService.increment(NotificationLog.class.getName()); - NotificationLog notification = notificationLogPersistence.create(notificationId); - notification.setTipo(tipo); - notification.setNomePlugin(nomePlugin); - notification.setData(now); - notificationLogPersistence.update(notification); - return notification; - } - - private void validate(String nomePlugin, String tipo) throws NotificationTipoException, - NotificationNomePluginException { - - if (Validator.isNull(nomePlugin)) { - throw new NotificationNomePluginException(); - } - if (Validator.isNull(tipo)) { - throw new NotificationTipoException(); - } - } + public NotificationLog addNotification(String nomePlugin, String tipo) throws SystemException, PortalException { + + Date now = new Date(); + + validate(nomePlugin, tipo); + + long notificationId = counterLocalService.increment(NotificationLog.class.getName()); + + NotificationLog notification = notificationLogPersistence.create(notificationId); + + notification.setTipo(tipo); + notification.setNomePlugin(nomePlugin); + notification.setData(now); + notificationLogPersistence.update(notification); + + return notification; + } + + private void validate(String nomePlugin, String tipo) throws NotificationTipoException, + NotificationNomePluginException { + + if (Validator.isNull(nomePlugin)) { + throw new NotificationNomePluginException(); + } + if (Validator.isNull(tipo)) { + throw new NotificationTipoException(); + } + + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationMailLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationMailLocalServiceImpl.java index 1b8d384a..4103b228 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationMailLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/impl/NotificationMailLocalServiceImpl.java @@ -1,22 +1,19 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.deployalert.service.impl; -import it.tref.liferay.portos.deployalert.NotificationNomePluginException; -import it.tref.liferay.portos.deployalert.NotificationNomeTemplateException; -import it.tref.liferay.portos.deployalert.model.NotificationMail; -import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil; -import it.tref.liferay.portos.deployalert.service.base.NotificationMailLocalServiceBaseImpl; - -import java.util.Date; -import java.util.List; - import com.liferay.portal.kernel.dao.orm.Disjunction; import com.liferay.portal.kernel.dao.orm.DynamicQuery; import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; @@ -28,14 +25,24 @@ import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.model.User; import com.liferay.portal.service.ServiceContext; +import it.tref.liferay.portos.deployalert.NotificationNomePluginException; +import it.tref.liferay.portos.deployalert.NotificationNomeTemplateException; +import it.tref.liferay.portos.deployalert.model.NotificationMail; +import it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil; +import it.tref.liferay.portos.deployalert.service.base.NotificationMailLocalServiceBaseImpl; + +import java.util.Date; +import java.util.List; + /** * The implementation of the notification mail local service. *

- * 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.deployalert.service.NotificationMailLocalService} interface. + * 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.deployalert.service.NotificationMailLocalService} 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 Matteo @@ -44,91 +51,101 @@ import com.liferay.portal.service.ServiceContext; */ public class NotificationMailLocalServiceImpl extends NotificationMailLocalServiceBaseImpl { - @Override - public NotificationMail addNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext) - throws PortalException, SystemException { - - User user = userPersistence.findByPrimaryKey(serviceContext.getUserId()); - Date now = new Date(); - validate(nomePlugin, nomeTemplate); - long notificationId = counterLocalService.increment(NotificationMail.class.getName()); - NotificationMail notification = notificationMailPersistence.create(notificationId); - notification.setUserId(user.getUserId()); - notification.setCompanyId(user.getCompanyId()); - notification.setUserName(user.getFullName()); - notification.setCreateDate(serviceContext.getCreateDate(now)); - notification.setModifiedDate(serviceContext.getModifiedDate(now)); - notification.setExpandoBridgeAttributes(serviceContext); - notification.setNomePlugin(nomePlugin); - notification.setNomeTemplate(nomeTemplate); - notificationMailPersistence.update(notification); - return notification; - } - - private void validate(String nomePlugin, String nomeTemplate) throws NotificationNomePluginException, - NotificationNomeTemplateException { - - if (Validator.isNull(nomePlugin)) { - throw new NotificationNomePluginException(); - } - if (Validator.isNull(nomeTemplate)) { - throw new NotificationNomeTemplateException(); - } - } - - @Override - public NotificationMail updateNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext, - long notificationId) throws SystemException, PortalException { - - Date now = new Date(); - NotificationMail notification = getNotificationMail(notificationId); - validate(nomePlugin, nomeTemplate); - notification.setModifiedDate(serviceContext.getModifiedDate(now)); - notification.setNomePlugin(nomePlugin); - notification.setNomeTemplate(nomeTemplate); - notification.setExpandoBridgeAttributes(serviceContext); - notificationMailPersistence.update(notification); - return notification; - } - - @Override - public List findNotifications(long companyId, int start, int end) throws SystemException { - - DynamicQuery query = dynamicQuery(); - query.addOrder(OrderFactoryUtil.asc("nomePlugin")); - List notifications = null; - try { - notifications = NotificationMailLocalServiceUtil.dynamicQuery(query); - } catch (SystemException e) { - e.printStackTrace(); - } - return notifications; - } - - @Override - public List findNotifications(long companyId) throws SystemException { - - return notificationMailPersistence.findBycompanyId(companyId); - } - - @Override - public int getNotificationCount(long companyId) throws SystemException { - - return notificationMailPersistence.countBycompanyId(companyId); - } - - @Override - public List findNotifications(long companyId, String servletContextName) throws SystemException { - - DynamicQuery dynamicQuery = dynamicQuery(); - if (Validator.isNull(servletContextName)) { - Disjunction or = RestrictionsFactoryUtil.disjunction(); - or.add(RestrictionsFactoryUtil.isNull("nomePlugin")); - or.add(RestrictionsFactoryUtil.eq("nomePlugin", StringPool.BLANK)); - dynamicQuery.add(or); - } else { - dynamicQuery.add(RestrictionsFactoryUtil.eq("nomePlugin", servletContextName)); - } - return notificationMailPersistence.findWithDynamicQuery(dynamicQuery); - } + public NotificationMail addNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext) + throws PortalException, SystemException { + + User user = userPersistence.findByPrimaryKey(serviceContext.getUserId()); + + Date now = new Date(); + + validate(nomePlugin, nomeTemplate); + + long notificationId = counterLocalService.increment(NotificationMail.class.getName()); + + NotificationMail notification = notificationMailPersistence.create(notificationId); + + notification.setUserId(user.getUserId()); + notification.setCompanyId(user.getCompanyId()); + notification.setUserName(user.getFullName()); + notification.setCreateDate(serviceContext.getCreateDate(now)); + notification.setModifiedDate(serviceContext.getModifiedDate(now)); + notification.setExpandoBridgeAttributes(serviceContext); + notification.setNomePlugin(nomePlugin); + notification.setNomeTemplate(nomeTemplate); + + notificationMailPersistence.update(notification); + + return notification; + } + + private void validate(String nomePlugin, String nomeTemplate) throws NotificationNomePluginException, + NotificationNomeTemplateException { + + if (Validator.isNull(nomePlugin)) { + throw new NotificationNomePluginException(); + } + if (Validator.isNull(nomeTemplate)) { + throw new NotificationNomeTemplateException(); + } + } + + public NotificationMail updateNotification(String nomePlugin, String nomeTemplate, ServiceContext serviceContext, + long notificationId) throws SystemException, PortalException { + + Date now = new Date(); + + NotificationMail notification = getNotificationMail(notificationId); + + validate(nomePlugin, nomeTemplate); + + notification.setModifiedDate(serviceContext.getModifiedDate(now)); + notification.setNomePlugin(nomePlugin); + notification.setNomeTemplate(nomeTemplate); + notification.setExpandoBridgeAttributes(serviceContext); + + notificationMailPersistence.update(notification); + + return notification; + } + + public List findNotifications(long companyId, int start, int end) throws SystemException { + + // return notificationMailPersistence.findBycompanyId(companyId, start, end); + DynamicQuery query = notificationMailLocalService.dynamicQuery(); + query.addOrder(OrderFactoryUtil.asc("nomePlugin")); + List notifications = null; + try { + notifications = NotificationMailLocalServiceUtil.dynamicQuery(query); + } catch (SystemException e) { + e.printStackTrace(); + } + return notifications; + } + + public List findNotifications(long companyId) throws SystemException { + + return notificationMailPersistence.findBycompanyId(companyId); + } + + public int getNotificationCount(long companyId) throws SystemException { + + return notificationMailPersistence.countBycompanyId(companyId); + } + + public List findNotifications(long companyId, String servletContextName) throws SystemException { + + DynamicQuery dynamicQuery = notificationMailLocalService.dynamicQuery(); + + if (Validator.isNull(servletContextName)) { + Disjunction or = RestrictionsFactoryUtil.disjunction(); + or.add(RestrictionsFactoryUtil.isNull("nomePlugin")); + or.add(RestrictionsFactoryUtil.eq("nomePlugin", StringPool.BLANK)); + + dynamicQuery.add(or); + } else { + dynamicQuery.add(RestrictionsFactoryUtil.eq("nomePlugin", servletContextName)); + } + + return notificationMailPersistence.findWithDynamicQuery(dynamicQuery); + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationLogPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationLogPersistenceImpl.java index 78a471b1..c9c20815 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationLogPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationLogPersistenceImpl.java @@ -45,7 +45,6 @@ import it.tref.liferay.portos.deployalert.NoSuchNotificationLogException; import it.tref.liferay.portos.deployalert.model.NotificationLog; import it.tref.liferay.portos.deployalert.model.impl.NotificationLogImpl; import it.tref.liferay.portos.deployalert.model.impl.NotificationLogModelImpl; -import it.tref.liferay.portos.deployalert.service.persistence.NotificationLogPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationMailPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationMailPersistenceImpl.java index 9297ba1f..2940148c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationMailPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/service/persistence/NotificationMailPersistenceImpl.java @@ -45,7 +45,6 @@ import it.tref.liferay.portos.deployalert.NoSuchNotificationMailException; import it.tref.liferay.portos.deployalert.model.NotificationMail; import it.tref.liferay.portos.deployalert.model.impl.NotificationMailImpl; import it.tref.liferay.portos.deployalert.model.impl.NotificationMailModelImpl; -import it.tref.liferay.portos.deployalert.service.persistence.NotificationMailPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/util/DeployAlertUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/util/DeployAlertUtil.java index f8c8c287..9c630c8a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/util/DeployAlertUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/deployalert/util/DeployAlertUtil.java @@ -1,11 +1,5 @@ package it.tref.liferay.portos.deployalert.util; -import it.tref.liferay.portos.deployalert.constants.MailConstants; -import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil; - -import java.text.SimpleDateFormat; -import java.util.Date; - import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; @@ -22,76 +16,89 @@ import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.util.PortalUtil; +import it.tref.liferay.portos.deployalert.constants.MailConstants; +import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil; + +import java.text.SimpleDateFormat; +import java.util.Date; + public class DeployAlertUtil { - private static final Log _log = LogFactoryUtil.getLog(DeployAlertUtil.class); - - public static final ServiceContext getServiceContext() { - - long companyId = PortalUtil.getDefaultCompanyId(); - ServiceContext serviceContext = new ServiceContext(); - Company company; - serviceContext.setCompanyId(companyId); - try { - company = CompanyLocalServiceUtil.getCompany(companyId); - Role role = RoleLocalServiceUtil.getRole(company.getCompanyId(), RoleConstants.ADMINISTRATOR); - long userAdminId = UserLocalServiceUtil.getRoleUserIds(role.getRoleId())[0]; - serviceContext.setUserId(userAdminId); - serviceContext.setScopeGroupId(company.getGroupId()); - PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil.create(UserLocalServiceUtil - .getUser(userAdminId))); - } catch (Exception e) { - _log.error(e, e); - } - return serviceContext; - } - - public static final boolean addDefaultDeployMailTemplate(ServiceContext serviceContext) { - - boolean add = false; - String subject = "Deploy Plugin"; - String body = "E' stato effettuato il $evento del plugin $nomePlugin in data $data."; - String[] to = { "matteoguggia97@gmail.com" }; - try { - add = MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_DEPLOY_TEMPLATE, "test@3fconsulting.it", to, - null, null, subject, body, false, serviceContext); - } catch (SystemException e) { - _log.error(e, e); - } - PermissionThreadLocal.setPermissionChecker(null); - - return add; - } - - public static final boolean addDefaultUndeployMailTemplate(ServiceContext serviceContext) { - - boolean add = false; - String subject = "Undeploy Plugin"; - String body = "E' stato effettuato l'$evento del plugin $nomePlugin in data $data."; - String[] to = { "matteoguggia97@gmail.com" }; - - try { - add = MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_UNDEPLOY_TEMPLATE, "test@3fconsulting.it", to, - null, null, subject, body, false, serviceContext); - } catch (SystemException e) { - _log.error(e, e); - } - PermissionThreadLocal.setPermissionChecker(null); - - return add; - } - - public static final JSONObject getParametri(String nomePlugin, String evento) { - - JSONObject parametri = JSONFactoryUtil.createJSONObject(); - - String data = new SimpleDateFormat("dd/MM/yyyy HH:mm").format(new Date()); - - parametri.put("data", data); - parametri.put("evento", evento); - parametri.put("nomePlugin", nomePlugin); - - return parametri; - } + private final static Log _log = LogFactoryUtil.getLog(DeployAlertUtil.class); + + public static final ServiceContext getServiceContext() { + + long companyId = PortalUtil.getDefaultCompanyId(); + + ServiceContext serviceContext = new ServiceContext(); + Company company; + serviceContext.setCompanyId(companyId); + + try { + company = CompanyLocalServiceUtil.getCompany(companyId); + Role role = RoleLocalServiceUtil.getRole(company.getCompanyId(), RoleConstants.ADMINISTRATOR); + long userAdminId = UserLocalServiceUtil.getRoleUserIds(role.getRoleId())[0]; + + serviceContext.setUserId(userAdminId); + serviceContext.setScopeGroupId(company.getGroupId()); + + PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(userAdminId))); + } catch (Exception e) { + _log.error(e, e); + } + + return serviceContext; + } + + public static final boolean addDefaultDeployMailTemplate(ServiceContext serviceContext) { + + boolean add = false; + String subject = "Deploy Plugin"; + String body = "E' stato effettuato il $evento del plugin $nomePlugin in data $data."; + String[] to = {"matteoguggia97@gmail.com"}; + + try { + add = + MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_DEPLOY_TEMPLATE, "test@3fconsulting.it", to, null, + null, subject, body, false, serviceContext); + } catch (SystemException e) { + _log.error(e, e); + } + PermissionThreadLocal.setPermissionChecker(null); + + return add; + } + + public static final boolean addDefaultUndeployMailTemplate(ServiceContext serviceContext) { + + boolean add = false; + String subject = "Undeploy Plugin"; + String body = "E' stato effettuato l'$evento del plugin $nomePlugin in data $data."; + String[] to = {"matteoguggia97@gmail.com"}; + + try { + add = + MailManagerUtil.addMailTemplate(MailConstants.DEFAULT_UNDEPLOY_TEMPLATE, "test@3fconsulting.it", to, null, + null, subject, body, false, serviceContext); + } catch (SystemException e) { + _log.error(e, e); + } + PermissionThreadLocal.setPermissionChecker(null); + + return add; + } + + public static final JSONObject getParametri(String nomePlugin, String evento) { + + JSONObject parametri = JSONFactoryUtil.createJSONObject(); + + String data = new SimpleDateFormat("dd/MM/yyyy HH:mm").format(new Date()); + + parametri.put("data", data); + parametri.put("evento", evento); + parametri.put("nomePlugin", nomePlugin); + + return parametri; + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/init.jsp index 0ae60c99..bb88947c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/init.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/init.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/edit_notification.jsp b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/edit_notification.jsp index e2cef758..425e8af6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/edit_notification.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/edit_notification.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.liferay.portal.kernel.util.Validator"%> <%@page import="com.liferay.portal.kernel.util.StringUtil"%> <%@ include file="/html/notificator/init.jsp"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/init.jsp index dd526767..ea913f23 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/init.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/init.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ include file="/html/init.jsp"%> <%@ page import="it.tref.liferay.portos.deployalert.service.NotificationMailLocalServiceUtil"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/view.jsp index eb713391..78964c30 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-deploy-alert-portlet/docroot/html/notificator/view.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ include file="/html/notificator/init.jsp"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/liferay-hook.xml b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/liferay-hook.xml index 967a6059..944195a7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/liferay-hook.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-firma-portlet/docroot/WEB-INF/liferay-hook.xml @@ -1,4 +1,4 @@ - + diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/liferay-portlet.xml b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/liferay-portlet.xml index 8796c801..41b5d165 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/liferay-portlet.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/liferay-portlet.xml @@ -2,10 +2,18 @@ - 1 + + it.tref.liferay.portos.kaleo.controller.scheduler.SchedulerKaleoController + + + 240 + second + + + diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoInstanceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoInstanceImpl.java index c4208f55..5c9c7d33 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoInstanceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoInstanceImpl.java @@ -1,30 +1,34 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.kaleo.controller.model.impl; /** - * The extended model implementation for the KaleoInstance service. Represents a row in the "kaleoinstance" - * database table, with each column mapped to a property of this class. + * The extended model implementation for the KaleoInstance service. Represents a row in the "kaleoinstance" database table, with each column mapped to a property of this class. + * *

- * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun - * ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoInstance} - * interface. + * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoInstance} interface. *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC */ -@SuppressWarnings("serial") public class KaleoInstanceImpl extends KaleoInstanceBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo instance model instance - * should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoInstance} interface instead. + * NOTE FOR DEVELOPERS: + * + * Never reference this class directly. All methods that expect a kaleo instance model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoInstance} interface instead. */ - - public KaleoInstanceImpl() {} -} + public KaleoInstanceImpl() { + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoNodeImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoNodeImpl.java index 7a09744c..b1d54ad5 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoNodeImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoNodeImpl.java @@ -1,30 +1,34 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.kaleo.controller.model.impl; /** - * The extended model implementation for the KaleoNode service. Represents a row in the "kaleonode" database - * table, with each column mapped to a property of this class. + * The extended model implementation for the KaleoNode service. Represents a row in the "kaleonode" database table, with each column mapped to a property of this class. + * *

- * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun - * ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoNode} - * interface. + * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoNode} interface. *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC */ -@SuppressWarnings("serial") public class KaleoNodeImpl extends KaleoNodeBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo node model instance - * should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoNode} interface instead. + * NOTE FOR DEVELOPERS: + * + * Never reference this class directly. All methods that expect a kaleo node model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoNode} interface instead. */ - - public KaleoNodeImpl() {} -} + public KaleoNodeImpl() { + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskAssignmentInstanceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskAssignmentInstanceImpl.java index 7964dc04..285cc559 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskAssignmentInstanceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskAssignmentInstanceImpl.java @@ -1,31 +1,35 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.kaleo.controller.model.impl; /** - * The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the - * "kaleotaskassignmentinstance" database table, with each column mapped to a property of this class. + * The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the "kaleotaskassignmentinstance" database table, with each column mapped to a property of this class. + * *

- * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun - * ServiceBuilder to copy their definitions into the - * {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface. + * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface. *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC */ -@SuppressWarnings("serial") -public class KaleoTaskAssignmentInstanceImpl extends KaleoTaskAssignmentInstanceBaseImpl { +public class KaleoTaskAssignmentInstanceImpl + extends KaleoTaskAssignmentInstanceBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo task assignment - * instance model instance should use the {@link - * it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface instead. + * NOTE FOR DEVELOPERS: + * + * Never reference this class directly. All methods that expect a kaleo task assignment instance model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance} interface instead. */ - - public KaleoTaskAssignmentInstanceImpl() {} -} + public KaleoTaskAssignmentInstanceImpl() { + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskImpl.java index 75d3958d..d629269c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskImpl.java @@ -1,30 +1,34 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.kaleo.controller.model.impl; /** - * The extended model implementation for the KaleoTask service. Represents a row in the "kaleotask" database - * table, with each column mapped to a property of this class. + * The extended model implementation for the KaleoTask service. Represents a row in the "kaleotask" database table, with each column mapped to a property of this class. + * *

- * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun - * ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTask} - * interface. + * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTask} interface. *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC */ -@SuppressWarnings("serial") public class KaleoTaskImpl extends KaleoTaskBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo task model instance - * should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTask} interface instead. + * NOTE FOR DEVELOPERS: + * + * Never reference this class directly. All methods that expect a kaleo task model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTask} interface instead. */ - - public KaleoTaskImpl() {} -} + public KaleoTaskImpl() { + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskInstanceTokenImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskInstanceTokenImpl.java index d84351ee..17bdae16 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskInstanceTokenImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/model/impl/KaleoTaskInstanceTokenImpl.java @@ -1,31 +1,34 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.kaleo.controller.model.impl; /** - * The extended model implementation for the KaleoTaskInstanceToken service. Represents a row in the - * "kaleotaskinstancetoken" database table, with each column mapped to a property of this class. + * The extended model implementation for the KaleoTaskInstanceToken service. Represents a row in the "kaleotaskinstancetoken" database table, with each column mapped to a property of this class. + * *

- * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun - * ServiceBuilder to copy their definitions into the - * {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken} interface. + * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken} interface. *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC */ -@SuppressWarnings("serial") public class KaleoTaskInstanceTokenImpl extends KaleoTaskInstanceTokenBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo task instance token - * model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken} - * interface instead. + * NOTE FOR DEVELOPERS: + * + * Never reference this class directly. All methods that expect a kaleo task instance token model instance should use the {@link it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken} interface instead. */ - - public KaleoTaskInstanceTokenImpl() {} -} + public KaleoTaskInstanceTokenImpl() { + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstancePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstancePersistenceImpl.java index 28866438..f93fd729 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstancePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstancePersistenceImpl.java @@ -42,6 +42,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoInstanceException; import it.tref.liferay.portos.kaleo.controller.model.KaleoInstance; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceModelImpl; +import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoInstancePersistence; import java.io.Serializable; @@ -56,7 +57,7 @@ import java.util.List; * Caching information and settings can be found in portal.properties *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC * @see KaleoInstancePersistence * @see KaleoInstanceUtil * @generated diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstanceTokenPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstanceTokenPersistenceImpl.java index 27df2a02..2dd77050 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstanceTokenPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoInstanceTokenPersistenceImpl.java @@ -42,6 +42,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoInstanceTokenException import it.tref.liferay.portos.kaleo.controller.model.KaleoInstanceToken; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceTokenImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoInstanceTokenModelImpl; +import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoInstanceTokenPersistence; import java.io.Serializable; @@ -56,7 +57,7 @@ import java.util.List; * Caching information and settings can be found in portal.properties *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC * @see KaleoInstanceTokenPersistence * @see KaleoInstanceTokenUtil * @generated diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoLogPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoLogPersistenceImpl.java index 6974011b..817c5f9d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoLogPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoLogPersistenceImpl.java @@ -43,6 +43,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoLogException; import it.tref.liferay.portos.kaleo.controller.model.KaleoLog; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoLogImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoLogModelImpl; +import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoLogPersistence; import java.io.Serializable; @@ -58,7 +59,7 @@ import java.util.Set; * Caching information and settings can be found in portal.properties *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC * @see KaleoLogPersistence * @see KaleoLogUtil * @generated diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoNodePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoNodePersistenceImpl.java index 920a5c9a..9f907a69 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoNodePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoNodePersistenceImpl.java @@ -41,6 +41,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoNodeException; import it.tref.liferay.portos.kaleo.controller.model.KaleoNode; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoNodeImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoNodeModelImpl; +import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoNodePersistence; import java.io.Serializable; @@ -56,7 +57,7 @@ import java.util.Set; * Caching information and settings can be found in portal.properties *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC * @see KaleoNodePersistence * @see KaleoNodeUtil * @generated diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskAssignmentInstancePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskAssignmentInstancePersistenceImpl.java index 58e757b8..09958d33 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskAssignmentInstancePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskAssignmentInstancePersistenceImpl.java @@ -42,6 +42,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoTaskAssignmentInstance import it.tref.liferay.portos.kaleo.controller.model.KaleoTaskAssignmentInstance; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskAssignmentInstanceImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskAssignmentInstanceModelImpl; +import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoTaskAssignmentInstancePersistence; import java.io.Serializable; @@ -56,7 +57,7 @@ import java.util.List; * Caching information and settings can be found in portal.properties *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC * @see KaleoTaskAssignmentInstancePersistence * @see KaleoTaskAssignmentInstanceUtil * @generated diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskInstanceTokenPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskInstanceTokenPersistenceImpl.java index 581b1937..de6890dc 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskInstanceTokenPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskInstanceTokenPersistenceImpl.java @@ -42,6 +42,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoTaskInstanceTokenExcep import it.tref.liferay.portos.kaleo.controller.model.KaleoTaskInstanceToken; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskInstanceTokenImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskInstanceTokenModelImpl; +import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoTaskInstanceTokenPersistence; import java.io.Serializable; @@ -56,7 +57,7 @@ import java.util.List; * Caching information and settings can be found in portal.properties *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC * @see KaleoTaskInstanceTokenPersistence * @see KaleoTaskInstanceTokenUtil * @generated diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskPersistenceImpl.java index 641cd927..618d8192 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-controller-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/controller/service/persistence/KaleoTaskPersistenceImpl.java @@ -40,6 +40,7 @@ import it.tref.liferay.portos.kaleo.controller.NoSuchKaleoTaskException; import it.tref.liferay.portos.kaleo.controller.model.KaleoTask; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskImpl; import it.tref.liferay.portos.kaleo.controller.model.impl.KaleoTaskModelImpl; +import it.tref.liferay.portos.kaleo.controller.service.persistence.KaleoTaskPersistence; import java.io.Serializable; @@ -54,7 +55,7 @@ import java.util.List; * Caching information and settings can be found in portal.properties *

* - * @author 3FC + Manifattura Web Group s.r.l. + * @author 3FC * @see KaleoTaskPersistence * @see KaleoTaskUtil * @generated diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/liferay-hook.xml b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/liferay-hook.xml index 967a6059..944195a7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/liferay-hook.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/liferay-hook.xml @@ -1,4 +1,4 @@ - + diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/service.xml b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/service.xml index 8b9a04f4..3fcf70c9 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/service.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/service.xml @@ -1,132 +1,94 @@ - + + portos_Kaleo - - - - + - - - + - - - - - - - - - - - - - - + + + + + + + + + - - + - - - + - - - + + - - - + + - - - - + + + - - - - - + - - - + - - - - - - - - - - - - + + + + + + + + + - - + - - - + - - - - + + + - - + - - - - - - - - - - + + + + + - + - - + - - - - + + + - - FormDefinitionLinkName FormDefinitionLinkDefinitionName diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/ddm/FormDDMDisplay.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/ddm/FormDDMDisplay.java index 82d28259..35855531 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/ddm/FormDDMDisplay.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/ddm/FormDDMDisplay.java @@ -18,59 +18,58 @@ import com.liferay.portlet.dynamicdatamapping.util.BaseDDMDisplay; public class FormDDMDisplay extends BaseDDMDisplay { - public static final String RESOURCE_NAME = "com.liferay.portlet.dynamicdatalists"; + public static final String RESOURCE_NAME = "com.liferay.portlet.dynamicdatalists"; - @Override - public String getPortletId() { + @Override + public String getPortletId() { + return PortletKeys.WORKFLOW_FORM_ADMIN; + } - return PortletKeys.WORKFLOW_FORM_ADMIN; - } + @Override + public String getResourceName() { + // return DDLPermission.RESOURCE_NAME; + return RESOURCE_NAME; + } - @Override - public String getResourceName() { + @Override + public String getStorageType() { + // return PropsValues.DYNAMIC_DATA_LISTS_STORAGE_TYPE; + return PropsUtil.get(PropsKeys.DYNAMIC_DATA_LISTS_STORAGE_TYPE); + } - return RESOURCE_NAME; - } + @Override + public String getStructureName(Locale locale) { + return LanguageUtil.get(locale, "data-definition"); + } - @Override - public String getStorageType() { + @Override + public String getStructureType() { + return DDLRecordSet.class.getName(); + } - return PropsUtil.get(PropsKeys.DYNAMIC_DATA_LISTS_STORAGE_TYPE); - } + @Override + public long getTemplateHandlerClassNameId(DDMTemplate template, long classNameId) { - @Override - public String getStructureName(Locale locale) { + return PortalUtil.getClassNameId(DDLRecordSet.class); + } - return LanguageUtil.get(locale, "data-definition"); - } + @Override + public String getEditTemplateBackURL(LiferayPortletRequest liferayPortletRequest, + LiferayPortletResponse liferayPortletResponse, long classNameId, long classPK, String portletResource) + throws Exception { - @Override - public String getStructureType() { + String redirect = ParamUtil.getString(liferayPortletRequest, "redirect"); - return DDLRecordSet.class.getName(); - } + if (Validator.isNull(redirect)) { + return getViewTemplatesURL(liferayPortletRequest, liferayPortletResponse, classNameId, classPK); + } - @Override - public long getTemplateHandlerClassNameId(DDMTemplate template, long classNameId) { + return redirect; + } - return PortalUtil.getClassNameId(DDLRecordSet.class); - } + @Override + public boolean isShowAddStructureButton() { + return true; + } - @Override - public String getEditTemplateBackURL(LiferayPortletRequest liferayPortletRequest, - LiferayPortletResponse liferayPortletResponse, long classNameId, long classPK, String portletResource) - throws Exception { - - String redirect = ParamUtil.getString(liferayPortletRequest, "redirect"); - if (Validator.isNull(redirect)) { - return getViewTemplatesURL(liferayPortletRequest, liferayPortletResponse, classNameId, classPK); - } - return redirect; - } - - @Override - public boolean isShowAddStructureButton() { - - return true; - } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormLogImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormLogImpl.java index 1ba04359..2731fd4f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormLogImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormLogImpl.java @@ -1,28 +1,34 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.kaleo.model.impl; /** - * The extended model implementation for the FormLog service. Represents a row in the "portos_Kaleo_FormLog" - * database table, with each column mapped to a property of this class. + * The extended model implementation for the FormLog service. Represents a row in the "portos_Kaleo_FormLog" database table, with each column mapped to a property of this class. + * *

- * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun - * ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormLog} interface. + * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormLog} interface. *

* * @author */ -@SuppressWarnings("serial") public class FormLogImpl extends FormLogBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a form log model instance - * should use the {@link it.tref.liferay.portos.kaleo.model.FormLog} interface instead. + * NOTE FOR DEVELOPERS: + * + * Never reference this class directly. All methods that expect a form log model instance should use the {@link it.tref.liferay.portos.kaleo.model.FormLog} interface instead. */ - public FormLogImpl() {} -} + public FormLogImpl() { + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormTemplateLinkImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormTemplateLinkImpl.java index caf798c6..2134eb90 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormTemplateLinkImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/model/impl/FormTemplateLinkImpl.java @@ -1,29 +1,34 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.kaleo.model.impl; /** - * The extended model implementation for the FormTemplateLink service. Represents a row in the - * "portos_Kaleo_FormTemplateLink" database table, with each column mapped to a property of this class. + * The extended model implementation for the FormTemplateLink service. Represents a row in the "portos_Kaleo_FormTemplateLink" database table, with each column mapped to a property of this class. + * *

- * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun - * ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormTemplateLink} - * interface. + * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.kaleo.model.FormTemplateLink} interface. *

* * @author */ -@SuppressWarnings("serial") public class FormTemplateLinkImpl extends FormTemplateLinkBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a form template link model - * instance should use the {@link it.tref.liferay.portos.kaleo.model.FormTemplateLink} interface instead. + * NOTE FOR DEVELOPERS: + * + * Never reference this class directly. All methods that expect a form template link model instance should use the {@link it.tref.liferay.portos.kaleo.model.FormTemplateLink} interface instead. */ - public FormTemplateLinkImpl() {} -} + public FormTemplateLinkImpl() { + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/portlet/WorkflowFormAdminPortletControlPanelEntry.java b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/portlet/WorkflowFormAdminPortletControlPanelEntry.java index 06c048b2..e97b3239 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/portlet/WorkflowFormAdminPortletControlPanelEntry.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-kaleo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/portlet/WorkflowFormAdminPortletControlPanelEntry.java @@ -6,12 +6,21 @@ import com.liferay.portal.model.Portlet; import com.liferay.portal.security.permission.PermissionChecker; import com.liferay.portlet.BaseControlPanelEntry; + +/** + * Control panel entry class WorkflowFormAdminPortletControlPanelEntry + */ public class WorkflowFormAdminPortletControlPanelEntry extends BaseControlPanelEntry { - @Override - protected boolean hasAccessPermissionDenied(PermissionChecker permissionChecker, Group group, Portlet portlet) - throws Exception { + @Override + protected boolean hasAccessPermissionDenied(PermissionChecker permissionChecker, Group group, Portlet portlet) + throws Exception { + + if (group.isLayoutSetPrototype() || !WorkflowEngineManagerUtil.isDeployed()) { + + return true; + } - return group.isLayoutSetPrototype() || !WorkflowEngineManagerUtil.isDeployed(); - } + return false; + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/liferay-hook.xml b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/liferay-hook.xml index f4efe922..7a11d3ba 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/liferay-hook.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/liferay-hook.xml @@ -1,9 +1,7 @@ - + portal.properties - - content/Language.properties - + content/Language.properties \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogRequestPostAction.java b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogRequestPostAction.java index d9142b9e..cecb30d8 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogRequestPostAction.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogRequestPostAction.java @@ -28,9 +28,9 @@ import com.liferay.portal.util.PortalUtil; import eu.bitwalker.useragentutils.UserAgent; import it.tref.portos.liferay.log.camel.core.CamelCoreInitializer; import it.tref.portos.liferay.log.model.LogActionDetails; +import it.tref.portos.liferay.log.shared.util.Constants; import it.tref.portos.liferay.log.spring.SpringContextBeanScanner; import it.tref.portos.liferay.log.utility.ClassUtils; -import it.tref.portos.liferay.log.utility.Constants; import java.lang.reflect.Field; import java.text.ParseException; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogStartupAction.java b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogStartupAction.java index 22b7df63..6a5d6e77 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogStartupAction.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/action/LogStartupAction.java @@ -1,7 +1,5 @@ package it.tref.portos.liferay.log.action; -import it.tref.portos.liferay.log.utility.Constants; - import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.events.SimpleAction; import com.liferay.portal.kernel.exception.PortalException; @@ -26,6 +24,9 @@ import com.liferay.portlet.expando.model.ExpandoTableConstants; import com.liferay.portlet.expando.service.ExpandoColumnLocalServiceUtil; import com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil; +import it.tref.portos.liferay.log.shared.util.Constants; + + public class LogStartupAction extends SimpleAction { private static Log _log = LogFactoryUtil.getLog(LogStartupAction.class); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogConstants.java b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogConstants.java index fca1765b..5999d17c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogConstants.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogConstants.java @@ -2,13 +2,17 @@ package it.tref.portos.liferay.log.constants; public class LogConstants { - public enum LogProcessMode { - ASYNC, SYNC - } + /* + * Message + */ + public enum LogProcessMode { + ASYNC, SYNC + } - public static final String COMPANY_ID = "companyId"; - public static final String USER_ID = "userId"; - public static final String CONTENT = "payload"; + public final static String COMPANY_ID = "companyId"; + public final static String USER_ID = "userId"; + public final static String CONTENT = "payload"; + + public final static String PARAM_PROCESS_MODE = "processMode"; - public static final String PARAM_PROCESS_MODE = "processMode"; } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogDestinationNames.java b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogDestinationNames.java index 4b8f4d26..4cc8823c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogDestinationNames.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogDestinationNames.java @@ -2,9 +2,10 @@ package it.tref.portos.liferay.log.constants; public class LogDestinationNames { - public static final String SERIAL = "liferay/tref/portos/monitoring_serial"; - public static final String SYNC = "liferay/tref/portos/monitoring_sync"; - - public static final String REST_SERVICE_URL = "http://rt-saas-tc01-s2.rt.tix.it:9888/logcollector"; - public static final String REST_SERVICE_PORT = "9090"; + public final static String SERIAL = "liferay/tref/portos/monitoring_serial"; + public final static String SYNC = "liferay/tref/portos/monitoring_sync"; + + public final static String REST_SERVICE_URL = "http://rt-saas-tc01-s2.rt.tix.it:9888/logcollector"; + public final static String REST_SERVICE_PORT = "9090"; + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogFormat.java b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogFormat.java index 177633d1..455a2ebe 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogFormat.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/WEB-INF/src/it/tref/portos/liferay/log/constants/LogFormat.java @@ -3,31 +3,32 @@ package it.tref.portos.liferay.log.constants; public class LogFormat { /*** Mandatory ***/ - public static final String HOSTNAME = "host"; - public static final String IP_ADDRESS = "ipAddress"; - public static final String DATA_EVENTO = "requestDate"; - public static final String COD_PROC = "processCode"; - public static final String COD_APP = "serverId"; - public static final String ID_ISTANZA = "instanceId"; - public static final String PROG_EVENTO = "eventProgressive"; - public static final String COD_ATT = "activityCode"; - public static final String COD_ESITO_EVENTO = "status"; - public static final String TIPO_EVENTO = "eventType"; - + public final static String HOSTNAME = "host"; + public final static String IP_ADDRESS = "ipAddress"; + public final static String DATA_EVENTO = "requestDate"; + public final static String COD_PROC = "processCode"; + public final static String COD_APP = "serverId"; + public final static String ID_ISTANZA = "instanceId"; + public final static String PROG_EVENTO = "eventProgressive"; + public final static String COD_ATT = "activityCode"; + public final static String COD_ESITO_EVENTO = "status"; + public final static String TIPO_EVENTO = "eventType"; + /*** Optional ***/ - public static final String ID_OPERATORE = "userId"; - + public final static String ID_OPERATORE = "userId"; + /*** Labels ***/ - public static final String HOSTNAME_LABEL = "hostname"; - public static final String IP_ADDRESS_LABEL = "ipAddress"; - public static final String DATA_EVENTO_LABEL = "dataEvento"; - public static final String COD_PROC_LABEL = "codProc"; - public static final String COD_APP_LABEL = "codApp"; - public static final String ID_ISTANZA_LABEL = "idIstanza"; - public static final String PROG_EVENTO_LABEL = "progEvento"; - public static final String COD_ATT_LABEL = "codAtt"; - public static final String COD_ESITO_EVENTO_LABEL = "codEsitoEvento"; - public static final String TIPO_EVENTO_LABEL = "tipoEvento"; - public static final String ID_OPERATORE_LABEL = "idOperatore"; - public static final String COMPLEX_DATA_LABEL = "ComplexData"; + public final static String HOSTNAME_LABEL = "hostname"; + public final static String IP_ADDRESS_LABEL = "ipAddress"; + public final static String DATA_EVENTO_LABEL = "dataEvento"; + public final static String COD_PROC_LABEL = "codProc"; + public final static String COD_APP_LABEL = "codApp"; + public final static String ID_ISTANZA_LABEL = "idIstanza"; + public final static String PROG_EVENTO_LABEL = "progEvento"; + public final static String COD_ATT_LABEL = "codAtt"; + public final static String COD_ESITO_EVENTO_LABEL = "codEsitoEvento"; + public final static String TIPO_EVENTO_LABEL = "tipoEvento"; + public final static String ID_OPERATORE_LABEL = "idOperatore"; + public final static String COMPLEX_DATA_LABEL = "ComplexData"; + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/html/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/html/init.jsp index d43a95e8..bce00918 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/html/init.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/html/init.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/view.jsp index 27251fd3..486845c9 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-log-portlet/docroot/view.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% /** * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-display.xml b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-display.xml index a054daf8..0c5a02b0 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-display.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-display.xml @@ -3,7 +3,7 @@ - + diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-hook.xml b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-hook.xml index 01e21b2d..4bc6119b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-hook.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/liferay-hook.xml @@ -1,4 +1,4 @@ - + diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/service.xml b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/service.xml index f326de8a..a78e9513 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/service.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/service.xml @@ -1,196 +1,139 @@ - + + portos_Mail - - - - - + - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - + - - - + + - - - - + + + - - - - + + + - - - - + + + - - - - - + + + + - - - - - + + - - - + - - - - + + - - + - - + - - - - - + + - - - + - - - + - - - + - - - - - - - + + + + + - - - - - - - - - - - - - - + + + + + + + + + - - + - - - + - - - + + - - - - + + + - - - + + - - RequiredEmailFrom RequiredEmailTo diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.properties b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.properties index 4882156c..884da199 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.properties @@ -4,6 +4,7 @@ IX_58C7CF0B=portos_Mail_Email.C_G_C_C IX_489D58F=portos_Mail_Email.C_G_T IX_489D58F=portos_Mail_Email.C_T IX_73A01DF4=portos_Mail_Email.Company +IX_73A01DF4=portos_Mail_Email.G_C IX_20966470=portos_Mail_EmailAttachment.EmailId IX_CF970AA=portos_Mail_EmailAttachment.FileEntryId @@ -11,4 +12,7 @@ IX_CF970AA=portos_Mail_EmailAttachment.FileEntryId IX_59165C50=portos_Mail_EmailTemplate.C_GroupId IX_6935F329=portos_Mail_EmailTemplate.C_GroupId_Name IX_EE0B52F3=portos_Mail_EmailTemplate.C_Name -IX_28EAC59A=portos_Mail_EmailTemplate.Company \ No newline at end of file +IX_28EAC59A=portos_Mail_EmailTemplate.Company + +IX_EC38E0B0=portos_Mail_EmailTemplateAttachment.EmailTemplateId +IX_4577CF50=portos_Mail_EmailTemplateAttachment.FileEntryId \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.sql b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.sql index 8b0b33b1..d8de2fc0 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.sql +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/indexes.sql @@ -10,4 +10,7 @@ create index IX_CF970AA on portos_Mail_EmailAttachment (fileEntryId); create index IX_28EAC59A on portos_Mail_EmailTemplate (companyId); create index IX_59165C50 on portos_Mail_EmailTemplate (companyId, groupId); create unique index IX_6935F329 on portos_Mail_EmailTemplate (companyId, groupId, templateName); -create unique index IX_EE0B52F3 on portos_Mail_EmailTemplate (companyId, templateName); \ No newline at end of file +create unique index IX_EE0B52F3 on portos_Mail_EmailTemplate (companyId, templateName); + +create index IX_EC38E0B0 on portos_Mail_EmailTemplateAttachment (emailTemplateId); +create index IX_4577CF50 on portos_Mail_EmailTemplateAttachment (fileEntryId); \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/tables.sql b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/tables.sql index ab773531..f927a0c9 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/tables.sql +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/sql/tables.sql @@ -54,4 +54,10 @@ create table portos_Mail_EmailTemplate ( body TEXT null, attachmentPermitted BOOLEAN, additionalParameters VARCHAR(75) null +); + +create table portos_Mail_EmailTemplateAttachment ( + emailTemplateId LONG not null, + fileEntryId LONG not null, + primary key (emailTemplateId, fileEntryId) ); \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/messaging/MailManagerMessageListener.java b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/messaging/MailManagerMessageListener.java index c1982e22..014e7e8d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/messaging/MailManagerMessageListener.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/messaging/MailManagerMessageListener.java @@ -1,10 +1,5 @@ package it.tref.liferay.portos.mailmanager.messaging; -import it.tref.liferay.portos.mailmanager.permission.ActionKeys; -import it.tref.liferay.portos.mailmanager.permission.EmailPermission; -import it.tref.liferay.portos.mailmanager.shared.util.MailManagerConstants; -import it.tref.liferay.portos.mailmanager.util.MailManagerUtil; - import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.mail.MailMessage; @@ -18,6 +13,11 @@ import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserLocalServiceUtil; +import it.tref.liferay.portos.mailmanager.permission.ActionKeys; +import it.tref.liferay.portos.mailmanager.permission.EmailPermission; +import it.tref.liferay.portos.mailmanager.shared.util.MailManagerConstants; +import it.tref.liferay.portos.mailmanager.util.MailManagerUtil; + public class MailManagerMessageListener implements MessageListener { private static final Log _log = LogFactoryUtil.getLog(MailManagerMessageListener.class); @@ -26,30 +26,38 @@ public class MailManagerMessageListener implements MessageListener { public void receive(Message message) throws MessageListenerException { Message responseMessage = MessageBusUtil.createResponseMessage(message); + try { + String mode = (String) message.get("mode"); MailMessage mailMessage = (MailMessage) message.getPayload(); ServiceContext serviceContext = (ServiceContext) message.get("serviceContext"); - boolean checkPermission = GetterUtil.getBoolean(message.get("checkPermission"), true); + boolean checkPermission = GetterUtil.getBoolean(message.get("checkPermission"), Boolean.TRUE); + String className = GetterUtil.getString(message.get("className")); long classPK = GetterUtil.getLong(message.get("classPK")); boolean sendSync = false; + if (MailManagerConstants.MESSAGING_SEND_MODE_SYNC.equals(mode)) { sendSync = true; } + PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil .getUser(serviceContext.getUserId())); if (checkPermission) { - EmailPermission.check(permissionChecker, serviceContext.getScopeGroupId(), ActionKeys.SEND_EMAIL); + EmailPermission.check(permissionChecker, serviceContext.getScopeGroupId(), + ActionKeys.SEND_EMAIL); } + MailManagerUtil.addEmail(className, classPK, mailMessage, sendSync, serviceContext); responseMessage.setPayload(Boolean.TRUE); } catch (Exception e) { _log.error(e, e); + responseMessage.setPayload(Boolean.FALSE); responseMessage.put("exceptionMessage", e.getMessage()); } finally { MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage); } } -} \ No newline at end of file +} diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailAttachmentLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailAttachmentLocalServiceImpl.java index dcf03919..a39c4d08 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailAttachmentLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailAttachmentLocalServiceImpl.java @@ -1,21 +1,18 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. The contents of this file are subject to the terms of the - * Liferay Enterprise Subscription License ("License"). You may not use this file except in compliance with the License. - * You can obtain a copy of the License by contacting Liferay, Inc. See the License for the specific language governing - * permissions and limitations under the License, including but not limited to distribution rights of the Software. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of the Liferay Enterprise Subscription License + * ("License"). You may not use this file except in compliance with the License. You can obtain a + * copy of the License by contacting Liferay, Inc. See the License for the specific language + * governing permissions and limitations under the License, including but not limited to + * distribution rights of the Software. + * + * + * */ package it.tref.liferay.portos.mailmanager.service.impl; -import it.tref.liferay.portos.mailmanager.EmailAttachmentFileException; -import it.tref.liferay.portos.mailmanager.EmailAttachmentTitleException; -import it.tref.liferay.portos.mailmanager.NoSuchEmailException; -import it.tref.liferay.portos.mailmanager.model.EmailAttachment; -import it.tref.liferay.portos.mailmanager.service.base.EmailAttachmentLocalServiceBaseImpl; -import it.tref.liferay.portos.mailmanager.service.persistence.EmailAttachmentPK; - -import java.io.File; -import java.util.List; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; @@ -30,14 +27,27 @@ import com.liferay.portal.model.User; import com.liferay.portal.security.permission.ActionKeys; import com.liferay.portal.service.ServiceContext; +import it.tref.liferay.portos.mailmanager.EmailAttachmentFileException; +import it.tref.liferay.portos.mailmanager.EmailAttachmentTitleException; +import it.tref.liferay.portos.mailmanager.NoSuchEmailException; +import it.tref.liferay.portos.mailmanager.model.EmailAttachment; +import it.tref.liferay.portos.mailmanager.service.base.EmailAttachmentLocalServiceBaseImpl; +import it.tref.liferay.portos.mailmanager.service.persistence.EmailAttachmentPK; + +import java.io.File; +import java.util.List; + /** * The implementation of the email attachment local service. + * *

- * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy - * their definitions into the {@link it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalService} interface. + * All custom service methods should be put in this class. Whenever methods are added, rerun + * ServiceBuilder to copy their definitions into the + * {@link it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalService} 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 @@ -45,99 +55,96 @@ import com.liferay.portal.service.ServiceContext; * @see it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalServiceUtil */ public class EmailAttachmentLocalServiceImpl extends EmailAttachmentLocalServiceBaseImpl { - /* - * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link - * it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalServiceUtil} to access the email attachment local - * service. - */ - @Override - public EmailAttachment addEmailAttachment(long companyId, long emailId, long folderId, String fileName, File file) - throws PortalException, SystemException { + /* + * NOTE FOR DEVELOPERS: + * + * Never reference this interface directly. Always use {@link + * it.noovle.azimut.icf.mailmanager.service.EmailAttachmentLocalServiceUtil} to access the + * email attachment local service. + */ + public EmailAttachment addEmailAttachment(long companyId, long emailId, long folderId, String fileName, File file) + throws PortalException, SystemException { - Company company = companyLocalService.getCompany(companyId); + Company company = companyLocalService.getCompany(companyId); - User defaultUser = company.getDefaultUser(); + User defaultUser = company.getDefaultUser(); - validate(emailId, fileName, file); + validate(emailId, fileName, file); - Folder folder = dlAppLocalService.getFolder(folderId); + Folder folder = dlAppLocalService.getFolder(folderId); - String sourceFileName = file.getName(); - String mimeType = MimeTypesUtil.getContentType(sourceFileName); + String sourceFileName = file.getName(); + String mimeType = MimeTypesUtil.getContentType(sourceFileName); - String title = fileName; - if (Validator.isNull(title)) { - title = file.getName(); - } + String title = fileName; + if (Validator.isNull(title)) { + title = file.getName(); + } - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); - serviceContext.setGuestPermissions(new String[] { ActionKeys.VIEW }); + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setGroupPermissions(new String[] {ActionKeys.VIEW}); + serviceContext.setGuestPermissions(new String[] {ActionKeys.VIEW}); - FileEntry fileEntry = - dlAppLocalService.addFileEntry(defaultUser.getUserId(), folder.getRepositoryId(), folder.getFolderId(), - sourceFileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, file, serviceContext); + FileEntry fileEntry = + dlAppLocalService.addFileEntry(defaultUser.getUserId(), folder.getRepositoryId(), folder.getFolderId(), + sourceFileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, file, serviceContext); - EmailAttachment emailAttachment = - createEmailAttachment(new EmailAttachmentPK(emailId, fileEntry - .getFileEntryId())); + EmailAttachment emailAttachment = + emailAttachmentLocalService.createEmailAttachment(new EmailAttachmentPK(emailId, fileEntry.getFileEntryId())); - return addEmailAttachment(emailAttachment); - } + return emailAttachmentLocalService.addEmailAttachment(emailAttachment); + } - @Override - public EmailAttachment deleteEmailAttachment(EmailAttachmentPK emailAttachmentPK) throws PortalException, - SystemException { - EmailAttachment emailAttachment = getEmailAttachment(emailAttachmentPK); - return deleteEmailAttachment(emailAttachment); - } + @Override + public EmailAttachment deleteEmailAttachment(EmailAttachmentPK emailAttachmentPK) throws PortalException, + SystemException { + EmailAttachment emailAttachment = emailAttachmentLocalService.getEmailAttachment(emailAttachmentPK); + return deleteEmailAttachment(emailAttachment); + } - @Override - public EmailAttachment deleteEmailAttachment(EmailAttachment emailAttachment) throws SystemException { + @Override + public EmailAttachment deleteEmailAttachment(EmailAttachment emailAttachment) throws SystemException { - super.deleteEmailAttachment(emailAttachment); + super.deleteEmailAttachment(emailAttachment); - // File Entry + // File Entry - try { - dlAppLocalService.deleteFileEntry(emailAttachment.getFileEntryId()); - } catch (PortalException e) {} + try { + dlAppLocalService.deleteFileEntry(emailAttachment.getFileEntryId()); + } catch (PortalException e) { + } - return emailAttachment; - } + return emailAttachment; + } - @Override - public List findByEmailId(long emailId) throws SystemException { - return emailAttachmentPersistence.findByEmailId(emailId); - } + public List findByEmailId(long emailId) throws SystemException { + return emailAttachmentPersistence.findByEmailId(emailId); + } - @Override - public List findByEmailId(long emailId, int start, int end) throws SystemException { - return emailAttachmentPersistence.findByEmailId(emailId); - } + public List findByEmailId(long emailId, int start, int end) throws SystemException { + return emailAttachmentPersistence.findByEmailId(emailId); + } - @Override - public int countByEmailId(long emailId) throws SystemException { - return emailAttachmentPersistence.countByEmailId(emailId); - } + public int countByEmailId(long emailId) throws SystemException { + return emailAttachmentPersistence.countByEmailId(emailId); + } - @Override - public EmailAttachment fetchByFileEntryId(long fileEntryId) throws SystemException { - return emailAttachmentPersistence.fetchByFileEntryId(fileEntryId); - } + public EmailAttachment fetchByFileEntryId(long fileEntryId) throws SystemException { + return emailAttachmentPersistence.fetchByFileEntryId(fileEntryId); + } - private void validate(long emailId, String fileName, File file) throws PortalException, SystemException { + private void validate(long emailId, String fileName, File file) throws PortalException, SystemException { - if (Validator.isNull(emailId)) { - throw new NoSuchEmailException(); - } + if (Validator.isNull(emailId)) { + throw new NoSuchEmailException(); + } - if (Validator.isNull(fileName) && Validator.isNull(file)) { - throw new EmailAttachmentTitleException(); - } + if (Validator.isNull(fileName) && Validator.isNull(file)) { + throw new EmailAttachmentTitleException(); + } - if (Validator.isNull(file) || (Validator.isNotNull(file) && !FileUtil.exists(file))) { - throw new EmailAttachmentFileException(); - } - } + if (Validator.isNull(file) || (Validator.isNotNull(file) && !FileUtil.exists(file))) { + throw new EmailAttachmentFileException(); + } + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailLocalServiceImpl.java index 75c4fb19..fe61eff2 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailLocalServiceImpl.java @@ -1,12 +1,36 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. The contents of this file are subject to the terms of the - * Liferay Enterprise Subscription License ("License"). You may not use this file except in compliance with the License. - * You can obtain a copy of the License by contacting Liferay, Inc. See the License for the specific language governing - * permissions and limitations under the License, including but not limited to distribution rights of the Software. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of the Liferay Enterprise Subscription License + * ("License"). You may not use this file except in compliance with the License. You can obtain a + * copy of the License by contacting Liferay, Inc. See the License for the specific language + * governing permissions and limitations under the License, including but not limited to + * distribution rights of the Software. + * + * + * */ package it.tref.liferay.portos.mailmanager.service.impl; +import com.liferay.mail.model.FileAttachment; +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.repository.model.Folder; +import com.liferay.portal.kernel.util.FileUtil; +import com.liferay.portal.kernel.util.OrderByComparator; +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.Company; +import com.liferay.portal.model.Group; +import com.liferay.portal.model.User; +import com.liferay.portal.security.permission.ActionKeys; +import com.liferay.portal.service.ServiceContext; +import com.liferay.portlet.documentlibrary.model.DLFolderConstants; + import it.tref.liferay.portos.mailmanager.EmailBccException; import it.tref.liferay.portos.mailmanager.EmailBulkAddressesException; import it.tref.liferay.portos.mailmanager.EmailCcException; @@ -27,30 +51,18 @@ import java.util.Collections; import java.util.Date; import java.util.List; -import com.liferay.mail.model.FileAttachment; -import com.liferay.portal.kernel.exception.PortalException; -import com.liferay.portal.kernel.exception.SystemException; -import com.liferay.portal.kernel.repository.model.Folder; -import com.liferay.portal.kernel.util.FileUtil; -import com.liferay.portal.kernel.util.OrderByComparator; -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.Company; -import com.liferay.portal.model.Group; -import com.liferay.portal.model.User; -import com.liferay.portal.security.permission.ActionKeys; -import com.liferay.portal.service.ServiceContext; -import com.liferay.portlet.documentlibrary.model.DLFolderConstants; - /** * The implementation of the email local service. + * *

- * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy - * their definitions into the {@link it.noovle.azimut.icf.mailmanager.service.EmailLocalService} interface. + * All custom service methods should be put in this class. Whenever methods are + * added, rerun ServiceBuilder to copy their definitions into the + * {@link it.noovle.azimut.icf.mailmanager.service.EmailLocalService} 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 @@ -59,67 +71,70 @@ import com.liferay.portlet.documentlibrary.model.DLFolderConstants; */ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link - * it.noovle.azimut.icf.mailmanager.service.EmailLocalServiceUtil} to access the email local service. + * NOTE FOR DEVELOPERS: + * + * Never reference this interface directly. Always use {@link + * it.noovle.azimut.icf.mailmanager.service.EmailLocalServiceUtil} to access + * the email local service. */ - @Override - public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], - String subject, String body, boolean htmlFormat, ServiceContext serviceContext) throws Exception { + private final static Log _log = LogFactoryUtil.getLog(EmailLocalServiceImpl.class); - return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, null, null, - 0, false, null, null, Collections. emptyList(), serviceContext); + public Email addEmail(String className, long classPK, String from, String to[], String cc[], + String bcc[], String subject, String body, boolean htmlFormat, ServiceContext serviceContext) + throws Exception { + return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, + null, null, 0, false, null, null, Collections. emptyList(), serviceContext); } - @Override - public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], - String subject, String body, boolean htmlFormat, List fileAttachments, - ServiceContext serviceContext) throws Exception { - - return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, null, null, - 0, false, null, null, fileAttachments, false, null, serviceContext); + public Email addEmail(String className, long classPK, String from, String to[], String cc[], + String bcc[], String subject, String body, boolean htmlFormat, + List fileAttachments, ServiceContext serviceContext) throws Exception { + return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, + null, null, 0, false, null, null, fileAttachments, false, null, serviceContext); } - @Override - public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], - String[] bulkAddresses, String subject, String body, boolean htmlFormat, String[] replyTo, - String messageId, String inReplyTo, String smtpHost, int smtpPort, boolean smtpSecure, String smtpUsername, - String smtpPassword, List fileAttachments, ServiceContext serviceContext) throws Exception { - - return addEmail(className, classPK, from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat, replyTo, - messageId, inReplyTo, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword, fileAttachments, - false, null, serviceContext); + public Email addEmail(String className, long classPK, String from, String to[], String cc[], + String bcc[], String[] bulkAddresses, String subject, String body, boolean htmlFormat, + String[] replyTo, String messageId, String inReplyTo, String smtpHost, int smtpPort, + boolean smtpSecure, String smtpUsername, String smtpPassword, + List fileAttachments, ServiceContext serviceContext) throws Exception { + return addEmail(className, classPK, from, to, cc, bcc, bulkAddresses, subject, body, htmlFormat, + replyTo, messageId, inReplyTo, smtpHost, smtpPort, smtpSecure, smtpUsername, smtpPassword, + fileAttachments, false, null, serviceContext); } - @Override - public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], - String subject, String body, boolean htmlFormat, List fileAttachments, boolean sendSync, - ServiceContext serviceContext) throws Exception { - - return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, null, null, - 0, false, null, null, fileAttachments, sendSync, null, serviceContext); + public Email addEmail(String className, long classPK, String from, String to[], String cc[], + String bcc[], String subject, String body, boolean htmlFormat, + List fileAttachments, boolean sendSync, ServiceContext serviceContext) + throws Exception { + return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, + null, null, 0, false, null, null, fileAttachments, sendSync, null, serviceContext); } - @Override - public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], - String subject, String body, boolean htmlFormat, List fileAttachments, boolean sendSync, - String templateName, ServiceContext serviceContext) throws Exception { - - return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, null, null, - 0, false, null, null, fileAttachments, sendSync, templateName, serviceContext); + public Email addEmail(String className, long classPK, String from, String to[], String cc[], + String bcc[], String subject, String body, boolean htmlFormat, + List fileAttachments, boolean sendSync, String templateName, + ServiceContext serviceContext) throws Exception { + return addEmail(className, classPK, from, to, cc, bcc, null, subject, body, htmlFormat, null, null, + null, null, 0, false, null, null, fileAttachments, sendSync, templateName, serviceContext); } - @Override - public Email addEmail(String className, long classPK, String from, String to[], String cc[], String bcc[], - String[] bulkAddresses, String subject, String body, boolean htmlFormat, String[] replyTo, - String messageId, String inReplyTo, String smtpHost, int smtpPort, boolean smtpSecure, String smtpUsername, - String smtpPassword, List fileAttachments, boolean sendSync, String templateName, + public Email addEmail(String className, long classPK, String from, String to[], String cc[], + String bcc[], String[] bulkAddresses, String subject, String body, boolean htmlFormat, + String[] replyTo, String messageId, String inReplyTo, String smtpHost, int smtpPort, + boolean smtpSecure, String smtpUsername, String smtpPassword, + List fileAttachments, boolean sendSync, String templateName, ServiceContext serviceContext) throws Exception { User user = userLocalService.getUser(serviceContext.getUserId()); + Date now = new Date(); + validate(from, to, cc, bcc, bulkAddresses, subject, body, replyTo); - Email email = createEmail(counterLocalService.increment(Email.class.getName())); + + Email email = emailLocalService.createEmail(counterLocalService.increment(Email.class.getName())); + email.setGroupId(serviceContext.getScopeGroupId()); email.setCompanyId(serviceContext.getCompanyId()); email.setCreateDate(serviceContext.getCreateDate(now)); @@ -128,6 +143,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { email.setClassPK(classPK); email.setUserId(user.getUserId()); email.setUserName(user.getFullName()); + email.setFrom(from); email.setTo(StringUtil.merge(to, StringPool.COMMA)); email.setCc(StringUtil.merge(cc, StringPool.COMMA)); @@ -135,10 +151,12 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { email.setBulkAddresses(StringUtil.merge(bulkAddresses, StringPool.COMMA)); email.setSubject(subject); email.setBody(body); + email.setHtmlFormat(htmlFormat); email.setReplyTo(StringUtil.merge(replyTo, StringPool.COMMA)); email.setMessageId(messageId); email.setInReplyTo(inReplyTo); + email.setSmtpHost(smtpHost); email.setSmtpPort(smtpPort); email.setSmtpSecure(smtpSecure); @@ -146,37 +164,46 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { email.setSmtpPassword(smtpPassword); email.setCancel(false); email.setTemplateName(templateName); + email = addEmail(email); + // Email Attachments + if (fileAttachments != null && !fileAttachments.isEmpty()) { Folder folder = addEmailAttachmentsFolder(serviceContext.getCompanyId(), email.getEmailId()); for (FileAttachment fileAttachment : fileAttachments) { if (fileAttachment instanceof FileAttachment) { - ((it.tref.liferay.portos.mailmanager.shared.model.FileAttachment) fileAttachment).generateFile(); + ((it.tref.liferay.portos.mailmanager.shared.model.FileAttachment) fileAttachment) + .generateFile(); } - emailAttachmentLocalService.addEmailAttachment(serviceContext.getCompanyId(), email.getEmailId(), - folder.getFolderId(), fileAttachment.getFileName(), fileAttachment.getFile()); + emailAttachmentLocalService.addEmailAttachment(serviceContext.getCompanyId(), + email.getEmailId(), folder.getFolderId(), fileAttachment.getFileName(), + fileAttachment.getFile()); FileUtil.delete(fileAttachment.getFile()); } } - // Manifattura Web Group per Regione Siciliana - // Il valore di ritorno viene ignorato da SchedulerInvioDocumenti, le mail impostate per l'invio asincrono si - // perdono nell'abisso dell'oblio. Siccome questo è già un task asincrono, inviamo in maniera sincrona e - // festeggiamo. + + // Il valore di ritorno viene ignorato da SchedulerInvioDocumenti, le + // mail impostate per l'invio asincrono si perdono nell'abisso + // dell'oblio. Siccome questo è già un task asincrono, inviamo in + // maniera sincrona e festeggiamo. sendSync = true; + if (sendSync) { MailSenderUtil.sendMail(email); markAsSent(email.getEmailId(), new Date(), StringPool.BLANK); } + return email; } - @Override - public Email updateEmail(long emailId, String from, String to[], String cc[], String bcc[], String subject, - String body, ServiceContext serviceContext) throws Exception { + public Email updateEmail(long emailId, String from, String to[], String cc[], String bcc[], + String subject, String body, ServiceContext serviceContext) throws Exception { + + Email email = emailLocalService.getEmail(emailId); - Email email = getEmail(emailId); validate(from, to, cc, bcc, null, subject, body, null); + email.setModifiedDate(new Date()); email.setFrom(from); email.setTo(StringUtil.merge(to, StringPool.COMMA)); @@ -184,54 +211,60 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { email.setBcc(StringUtil.merge(bcc, StringPool.COMMA)); email.setSubject(subject); email.setBody(body); + return updateEmail(email); } - @Override - public Email markAsSent(long emailId, Date sentDate, String statusMessage) throws PortalException, SystemException { + public Email markAsSent(long emailId, Date sentDate, String statusMessage) throws PortalException, + SystemException { - Email email = getEmail(emailId); + Email email = emailLocalService.getEmail(emailId); email.setModifiedDate(new Date()); + email.setSent(true); email.setSentDate(sentDate); email.setStatusMessage(statusMessage); + return updateEmail(email); } - @Override - public Email updateStatusMessage(long emailId, String statusMessage) throws PortalException, SystemException { + public Email updateStatusMessage(long emailId, String statusMessage) throws PortalException, + SystemException { - Email email = getEmail(emailId); + Email email = emailLocalService.getEmail(emailId); email.setModifiedDate(new Date()); + email.setStatusMessage(statusMessage); + return updateEmail(email); } - @Override public Email resendEmail(long emailId) throws PortalException, SystemException { - Email email = getEmail(emailId); + Email email = emailLocalService.getEmail(emailId); email.setModifiedDate(new Date()); + email.setStatusMessage(""); email.setSent(false); email.setSentDate(null); email.setCancel(false); + return updateEmail(email); } - @Override public Email cancelEmail(long emailId) throws PortalException, SystemException { - Email email = getEmail(emailId); + Email email = emailLocalService.getEmail(emailId); email.setModifiedDate(new Date()); + email.setCancel(true); + return updateEmail(email); } @Override public Email deleteEmail(long emailId) throws PortalException, SystemException { - - Email email = getEmail(emailId); + Email email = emailLocalService.getEmail(emailId); return deleteEmail(email); } @@ -239,126 +272,108 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { public Email deleteEmail(Email email) throws SystemException { super.deleteEmail(email); + // Email Attachments - List emailAttachments = emailAttachmentLocalService.findByEmailId(email.getEmailId()); + + List emailAttachments = emailAttachmentLocalService + .findByEmailId(email.getEmailId()); for (EmailAttachment emailAttachment : emailAttachments) { emailAttachmentLocalService.deleteEmailAttachment(emailAttachment); } + return email; } - @Override public List findByCompany(long companyId) throws SystemException { - return emailPersistence.findByCompany(companyId); } - @Override public List findByCompany(long companyId, int start, int end) throws SystemException { - return emailPersistence.findByCompany(companyId, start, end); } - @Override public List findByCompany(long companyId, int start, int end, OrderByComparator orderByComparator) throws SystemException { - return emailPersistence.findByCompany(companyId, start, end, orderByComparator); } - @Override public int countByCompany(long companyId) throws SystemException { - return emailPersistence.countByCompany(companyId); } - @Override public List findByC_G(long companyId, long groupId) throws SystemException { - return emailPersistence.findByC_G(companyId, groupId); } - @Override public List findByC_G(long companyId, long groupId, int start, int end) throws SystemException { - return emailPersistence.findByC_G(companyId, groupId, start, end); } - @Override - public List findByC_G(long companyId, long groupId, int start, int end, OrderByComparator orderByComparator) - throws SystemException { - + public List findByC_G(long companyId, long groupId, int start, int end, + OrderByComparator orderByComparator) throws SystemException { return emailPersistence.findByC_G(companyId, groupId, start, end, orderByComparator); } - @Override public int countByC_G(long companyId, long groupId) throws SystemException { - return emailPersistence.countByC_G(companyId, groupId); } - @Override public List findByC_G_T(long companyId, long groupId, String templateName) throws SystemException { - return emailPersistence.findByC_G_T(companyId, groupId, templateName); } - @Override public List findByC_G_T(long companyId, long groupId, String templateName, int start, int end) throws SystemException { - return emailPersistence.findByC_G_T(companyId, groupId, templateName, start, end); } - @Override public int countByC_G_T(long companyId, long groupId, String templateName) throws SystemException { - return emailPersistence.countByC_G_T(companyId, groupId, templateName); } - @Override public List findByC_G_C_C(long companyId, long groupId, long classNameId, long classPK) throws SystemException { - return emailPersistence.findByC_G_C_C(companyId, groupId, classNameId, classPK); } - @Override - public List findByC_G_C_C(long companyId, long groupId, long classNameId, long classPK, int start, int end) - throws SystemException { - + public List findByC_G_C_C(long companyId, long groupId, long classNameId, long classPK, int start, + int end) throws SystemException { return emailPersistence.findByC_G_C_C(companyId, groupId, classNameId, classPK, start, end); } - @Override - public int countByC_G_C_C(long companyId, long groupId, long classNameId, long classPK) throws SystemException { - + public int countByC_G_C_C(long companyId, long groupId, long classNameId, long classPK) + throws SystemException { return emailPersistence.countByC_G_C_C(companyId, groupId, classNameId, classPK); } - private Folder addEmailAttachmentsFolder(long companyId, long emailId) throws PortalException, SystemException { + private Folder addEmailAttachmentsFolder(long companyId, long emailId) throws PortalException, + SystemException { Company company = companyLocalService.getCompany(companyId); + Group companyGroup = company.getGroup(); User defaultUser = company.getDefaultUser(); - Folder folder = - dlAppLocalService.getFolder(companyGroup.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, - EmailConstants.DEFAULT_ATTACHMENTS_FOLDER_NAME); + + Folder folder = dlAppLocalService.getFolder(companyGroup.getGroupId(), + DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, EmailConstants.DEFAULT_ATTACHMENTS_FOLDER_NAME); + ServiceContext serviceContext = new ServiceContext(); serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); serviceContext.setGuestPermissions(new String[] { ActionKeys.VIEW }); - return dlAppLocalService.addFolder(defaultUser.getUserId(), folder.getRepositoryId(), folder.getFolderId(), - String.valueOf(emailId), StringPool.BLANK, serviceContext); + + return dlAppLocalService.addFolder(defaultUser.getUserId(), folder.getRepositoryId(), + folder.getFolderId(), String.valueOf(emailId), StringPool.BLANK, serviceContext); } - private void validate(String from, String to[], String cc[], String bcc[], String[] bulkAddresses, String subject, - String body, String[] replyTo) throws PortalException { + private void validate(String from, String to[], String cc[], String bcc[], String[] bulkAddresses, + String subject, String body, String[] replyTo) throws PortalException { if (Validator.isNull(from)) { throw new RequiredEmailFromException(); } else if (!Validator.isEmailAddress(from)) { throw new EmailFromException(); } + if (to == null || (to != null && to.length == 0)) { throw new RequiredEmailToException(); } else { @@ -368,6 +383,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { } } } + if (cc != null && cc.length > 0) { for (String emailAddress : cc) { if (!Validator.isEmailAddress(emailAddress)) { @@ -375,6 +391,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { } } } + if (bcc != null && bcc.length > 0) { for (String emailAddress : bcc) { if (!Validator.isEmailAddress(emailAddress)) { @@ -382,6 +399,7 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { } } } + if (bulkAddresses != null && bulkAddresses.length > 0) { for (String emailAddress : bulkAddresses) { if (!Validator.isEmailAddress(emailAddress)) { @@ -389,12 +407,15 @@ public class EmailLocalServiceImpl extends EmailLocalServiceBaseImpl { } } } + if (Validator.isNull(subject)) { throw new RequiredEmailSubjectException(); } + if (Validator.isNull(body)) { throw new RequiredEmailBodyException(); } + if (replyTo != null && replyTo.length == 0) { for (String emailAddress : replyTo) { if (!Validator.isEmailAddress(emailAddress)) { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailTemplateLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailTemplateLocalServiceImpl.java index f929eeef..b5340703 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailTemplateLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/impl/EmailTemplateLocalServiceImpl.java @@ -1,13 +1,27 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation; either version + * 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. */ package it.tref.liferay.portos.mailmanager.service.impl; +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.util.OrderByComparator; +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.ResourceConstants; +import com.liferay.portal.model.User; +import com.liferay.portal.service.ServiceContext; + import it.tref.liferay.portos.mailmanager.EmailTemplateCcException; import it.tref.liferay.portos.mailmanager.EmailTemplateCcnException; import it.tref.liferay.portos.mailmanager.EmailTemplateFromException; @@ -23,24 +37,17 @@ import it.tref.liferay.portos.mailmanager.service.base.EmailTemplateLocalService import java.util.Date; import java.util.List; -import com.liferay.portal.kernel.exception.PortalException; -import com.liferay.portal.kernel.exception.SystemException; -import com.liferay.portal.kernel.util.OrderByComparator; -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.ResourceConstants; -import com.liferay.portal.model.User; -import com.liferay.portal.service.ServiceContext; - /** * The implementation of the email template local service. + * *

- * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy - * their definitions into the {@link it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalService} interface. + * All custom service methods should be put in this class. Whenever methods are added, rerun + * ServiceBuilder to copy their definitions into the + * {@link it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalService} 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 @@ -48,171 +55,191 @@ import com.liferay.portal.service.ServiceContext; * @see it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalServiceUtil */ public class EmailTemplateLocalServiceImpl extends EmailTemplateLocalServiceBaseImpl { - /* - * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link - * it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalServiceUtil} to access the email template local - * service. - */ - - @Override - public EmailTemplate addEmailTemplate(String templateName, String from, String[] to, String[] cc, String[] ccn, - String subject, String body, boolean attachmentPermitted, ServiceContext serviceContext) - throws SystemException, PortalException { - - User user = userLocalService.getUser(serviceContext.getUserId()); - Date now = new Date(); - validate(templateName, from, to, cc, ccn, subject, body); - EmailTemplate emailTemplate = createEmailTemplate(counterLocalService.increment(EmailTemplate.class.getName())); - emailTemplate.setCompanyId(serviceContext.getCompanyId()); - emailTemplate.setUserId(user.getUserId()); - emailTemplate.setUserName(user.getFullName()); - emailTemplate.setCreateDate(serviceContext.getCreateDate(now)); - emailTemplate.setModifiedDate(serviceContext.getModifiedDate(now)); - emailTemplate.setGroupId(serviceContext.getScopeGroupId()); - emailTemplate.setTemplateName(templateName); - emailTemplate.setFrom(from); - emailTemplate.setTo(StringUtil.merge(to, StringPool.COMMA)); - emailTemplate.setCc(StringUtil.merge(cc, StringPool.COMMA)); - emailTemplate.setCcn(StringUtil.merge(ccn, StringPool.COMMA)); - emailTemplate.setSubject(subject); - emailTemplate.setBody(body); - emailTemplate.setAttachmentPermitted(attachmentPermitted); - emailTemplate = addEmailTemplate(emailTemplate); - // Resource - resourceLocalService.addResources(emailTemplate.getCompanyId(), emailTemplate.getGroupId(), - emailTemplate.getUserId(), EmailTemplate.class.getName(), emailTemplate.getPrimaryKey(), false, true, - true); - return emailTemplate; - } - - @Override - public EmailTemplate updateEmailTemplate(long emailTemplateId, String templateName, String from, String[] to, - String[] cc, String[] ccn, String subject, String body, boolean attachmentPermitted, - ServiceContext serviceContext) throws SystemException, PortalException { - - EmailTemplate emailTemplate = getEmailTemplate(emailTemplateId); - validate(templateName, from, to, cc, ccn, subject, body); - emailTemplate.setModifiedDate(serviceContext.getModifiedDate(new Date())); - emailTemplate.setFrom(from); - emailTemplate.setTo(StringUtil.merge(to, StringPool.COMMA)); - emailTemplate.setCc(StringUtil.merge(cc, StringPool.COMMA)); - emailTemplate.setCcn(StringUtil.merge(ccn, StringPool.COMMA)); - emailTemplate.setSubject(subject); - emailTemplate.setBody(body); - emailTemplate.setAttachmentPermitted(attachmentPermitted); - emailTemplate = updateEmailTemplate(emailTemplate); - return emailTemplate; - } - - @Override - public EmailTemplate deleteEmailTemplate(long emailTemplateId) throws PortalException, SystemException { - - EmailTemplate emailTemplate = getEmailTemplate(emailTemplateId); - return deleteEmailTemplate(emailTemplate); - } - - @Override - public EmailTemplate deleteEmailTemplate(EmailTemplate emailTemplate) throws SystemException { - - super.deleteEmailTemplate(emailTemplate); - // Resource - try { - resourceLocalService.deleteResource(emailTemplate.getCompanyId(), EmailTemplate.class.getName(), - ResourceConstants.SCOPE_INDIVIDUAL, emailTemplate.getPrimaryKey()); - } catch (PortalException e) {} - return emailTemplate; - } - - @Override - public int countByC_GroupId(long companyId, long groupId) throws SystemException { - - return emailTemplatePersistence.countByC_GroupId(companyId, groupId); - } - - @Override - public List findByC_GroupId(long companyId, long groupId, int start, int end, - OrderByComparator orderBy) throws SystemException { - - return emailTemplatePersistence.findByC_GroupId(companyId, groupId, start, end, orderBy); - } - - @Override - public EmailTemplate findByC_GroupId_Name(long companyId, long groupId, String templateName) - throws NoSuchEmailTemplateException, SystemException { - - return emailTemplatePersistence.findByC_GroupId_Name(companyId, groupId, templateName); - } - - @Override - public EmailTemplate fetchByC_GroupId_Name(long companyId, long groupId, String templateName) - throws SystemException { - - return emailTemplatePersistence.fetchByC_GroupId_Name(companyId, groupId, templateName); - } - - @Override - public int countByCompany(long companyId) throws SystemException { - - return emailTemplatePersistence.countByCompany(companyId); - } - - @Override - public List findByCompany(long companyId, int start, int end, OrderByComparator orderBy) - throws SystemException { - - return emailTemplatePersistence.findByCompany(companyId, start, end, orderBy); - } - - @Override - public int countByC_Name(long companyId, String name) throws SystemException { - - return emailTemplatePersistence.countByC_Name(companyId, name); - } - - @Override - public EmailTemplate findByC_Name(long companyId, String templateName) throws SystemException, - NoSuchEmailTemplateException { - - return emailTemplatePersistence.findByC_Name(companyId, templateName); - } - - private void validate(String templateName, String from, String[] to, String[] cc, String[] ccn, String subject, - String body) throws PortalException { - - if (Validator.isNull(templateName)) { - throw new RequiredEmailTemplateNameException(); - } - if (Validator.isNull(from)) { - throw new RequiredEmailTemplateFromException(); - } else if (!Validator.isEmailAddress(from)) { - throw new EmailTemplateFromException(); - } - if (to != null && to.length > 0) { - for (String emailAddress : to) { - if (!Validator.isEmailAddress(emailAddress)) { - throw new EmailTemplateToException(); - } - } - } - if (cc != null && cc.length > 0) { - for (String emailAddress : cc) { - if (!Validator.isEmailAddress(emailAddress)) { - throw new EmailTemplateCcException(); - } - } - } - if (ccn != null && ccn.length > 0) { - for (String emailAddress : ccn) { - if (!Validator.isEmailAddress(emailAddress)) { - throw new EmailTemplateCcnException(); - } - } - } - if (Validator.isNull(subject)) { - throw new RequiredEmailTemplateSubjectException(); - } - if (Validator.isNull(body)) { - throw new RequiredEmailTemplateBodyException(); - } - } + /* + * NOTE FOR DEVELOPERS: + * + * Never reference this interface directly. Always use {@link + * it.noovle.azimut.icf.mailmanager.service.EmailTemplateLocalServiceUtil} to access the email + * template local service. + */ + + @Override + public EmailTemplate addEmailTemplate(String templateName, String from, String[] to, String[] cc, String[] ccn, + String subject, String body, boolean attachmentPermitted, ServiceContext serviceContext) throws SystemException, + PortalException { + + User user = userLocalService.getUser(serviceContext.getUserId()); + + Date now = new Date(); + + validate(templateName, from, to, cc, ccn, subject, body); + + EmailTemplate emailTemplate = + emailTemplateLocalService.createEmailTemplate(counterLocalService.increment(EmailTemplate.class.getName())); + + emailTemplate.setCompanyId(serviceContext.getCompanyId()); + emailTemplate.setUserId(user.getUserId()); + emailTemplate.setUserName(user.getFullName()); + emailTemplate.setCreateDate(serviceContext.getCreateDate(now)); + emailTemplate.setModifiedDate(serviceContext.getModifiedDate(now)); + emailTemplate.setGroupId(serviceContext.getScopeGroupId()); + + emailTemplate.setTemplateName(templateName); + + emailTemplate.setFrom(from); + emailTemplate.setTo(StringUtil.merge(to, StringPool.COMMA)); + emailTemplate.setCc(StringUtil.merge(cc, StringPool.COMMA)); + emailTemplate.setCcn(StringUtil.merge(ccn, StringPool.COMMA)); + emailTemplate.setSubject(subject); + emailTemplate.setBody(body); + + emailTemplate.setAttachmentPermitted(attachmentPermitted); + + emailTemplate = emailTemplateLocalService.addEmailTemplate(emailTemplate); + + // Resource + + resourceLocalService.addResources(emailTemplate.getCompanyId(), emailTemplate.getGroupId(), + emailTemplate.getUserId(), EmailTemplate.class.getName(), emailTemplate.getPrimaryKey(), false, true, true); + + return emailTemplate; + } + + @Override + public EmailTemplate updateEmailTemplate(long emailTemplateId, String templateName, String from, String[] to, + String[] cc, String[] ccn, String subject, String body, boolean attachmentPermitted, ServiceContext serviceContext) + throws SystemException, PortalException { + + EmailTemplate emailTemplate = emailTemplateLocalService.getEmailTemplate(emailTemplateId); + + validate(templateName, from, to, cc, ccn, subject, body); + + emailTemplate.setModifiedDate(serviceContext.getModifiedDate(new Date())); + + emailTemplate.setFrom(from); + emailTemplate.setTo(StringUtil.merge(to, StringPool.COMMA)); + emailTemplate.setCc(StringUtil.merge(cc, StringPool.COMMA)); + emailTemplate.setCcn(StringUtil.merge(ccn, StringPool.COMMA)); + emailTemplate.setSubject(subject); + emailTemplate.setBody(body); + + emailTemplate.setAttachmentPermitted(attachmentPermitted); + + emailTemplate = emailTemplateLocalService.updateEmailTemplate(emailTemplate); + + return emailTemplate; + } + + @Override + public EmailTemplate deleteEmailTemplate(long emailTemplateId) throws PortalException, SystemException { + EmailTemplate emailTemplate = emailTemplateLocalService.getEmailTemplate(emailTemplateId); + return deleteEmailTemplate(emailTemplate); + } + + @Override + public EmailTemplate deleteEmailTemplate(EmailTemplate emailTemplate) throws SystemException { + + super.deleteEmailTemplate(emailTemplate); + + // Resource + + try { + resourceLocalService.deleteResource(emailTemplate.getCompanyId(), EmailTemplate.class.getName(), + ResourceConstants.SCOPE_INDIVIDUAL, emailTemplate.getPrimaryKey()); + } catch (PortalException e) { + } + + return emailTemplate; + } + + @Override + public int countByC_GroupId(long companyId, long groupId) throws SystemException { + return emailTemplatePersistence.countByC_GroupId(companyId, groupId); + } + + @Override + public List findByC_GroupId(long companyId, long groupId, int start, int end, OrderByComparator orderBy) + throws SystemException { + return emailTemplatePersistence.findByC_GroupId(companyId, groupId, start, end, orderBy); + } + + @Override + public EmailTemplate findByC_GroupId_Name(long companyId, long groupId, String templateName) + throws NoSuchEmailTemplateException, SystemException { + return emailTemplatePersistence.findByC_GroupId_Name(companyId, groupId, templateName); + } + + @Override + public EmailTemplate fetchByC_GroupId_Name(long companyId, long groupId, String templateName) throws SystemException { + return emailTemplatePersistence.fetchByC_GroupId_Name(companyId, groupId, templateName); + } + + @Override + public int countByCompany(long companyId) throws SystemException { + return emailTemplatePersistence.countByCompany(companyId); + } + + @Override + public List findByCompany(long companyId, int start, int end, OrderByComparator orderBy) + throws SystemException { + return emailTemplatePersistence.findByCompany(companyId, start, end, orderBy); + } + + @Override + public int countByC_Name(long companyId, String name) throws SystemException { + return emailTemplatePersistence.countByC_Name(companyId, name); + } + + @Override + public EmailTemplate findByC_Name(long companyId, String templateName) throws SystemException, + NoSuchEmailTemplateException { + return emailTemplatePersistence.findByC_Name(companyId, templateName); + } + + private void validate(String templateName, String from, String[] to, String[] cc, String[] ccn, String subject, + String body) throws PortalException { + + if (Validator.isNull(templateName)) { + throw new RequiredEmailTemplateNameException(); + } + + if (Validator.isNull(from)) { + throw new RequiredEmailTemplateFromException(); + } else if (!Validator.isEmailAddress(from)) { + throw new EmailTemplateFromException(); + } + + if (to != null && to.length > 0) { + for (String emailAddress : to) { + if (!Validator.isEmailAddress(emailAddress)) { + throw new EmailTemplateToException(); + } + } + } + + if (cc != null && cc.length > 0) { + for (String emailAddress : cc) { + if (!Validator.isEmailAddress(emailAddress)) { + throw new EmailTemplateCcException(); + } + } + } + + if (ccn != null && ccn.length > 0) { + for (String emailAddress : ccn) { + if (!Validator.isEmailAddress(emailAddress)) { + throw new EmailTemplateCcnException(); + } + } + } + + if (Validator.isNull(subject)) { + throw new RequiredEmailTemplateSubjectException(); + } + + if (Validator.isNull(body)) { + throw new RequiredEmailTemplateBodyException(); + } + + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java index e22be439..5f01e625 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailEngine.java @@ -64,6 +64,8 @@ import javax.mail.internet.MimeMultipart; * @author Brett Swaim */ public class MailEngine { + + private static boolean mwgDebug = false; public static Session getSession() { return getSession(false); @@ -74,7 +76,7 @@ public class MailEngine { Session session = Session.getInstance(properties); - if (_log.isDebugEnabled()) { + if (mwgDebug || _log.isDebugEnabled()) { session.setDebug(true); session.getProperties().list(System.out); @@ -89,14 +91,14 @@ public class MailEngine { try { session = MailServiceUtil.getSession(); } catch (SystemException se) { - if (_log.isWarnEnabled()) { + if (mwgDebug || _log.isWarnEnabled()) { _log.warn(se, se); } session = InfrastructureUtil.getMailSession(); } - if (_log.isDebugEnabled()) { + if (mwgDebug || _log.isDebugEnabled()) { session.setDebug(true); session.getProperties().list(System.out); @@ -151,7 +153,7 @@ public class MailEngine { long startTime = System.currentTimeMillis(); - if (_log.isDebugEnabled()) { + if (mwgDebug || _log.isDebugEnabled()) { _log.debug("From: " + from); _log.debug("To: " + Arrays.toString(to)); _log.debug("CC: " + Arrays.toString(cc)); @@ -164,7 +166,7 @@ public class MailEngine { _log.debug("Message ID: " + messageId); _log.debug("In Reply To: " + inReplyTo); - if ((fileAttachments != null) && _log.isDebugEnabled()) { + if ((fileAttachments != null) && (mwgDebug || _log.isDebugEnabled())) { for (int i = 0; i < fileAttachments.size(); i++) { FileAttachment fileAttachment = fileAttachments.get(i); @@ -326,7 +328,7 @@ public class MailEngine { throw new MailEngineException(e); } - if (_log.isDebugEnabled()) { + if (mwgDebug || _log.isDebugEnabled()) { _log.debug("Sending mail takes " + (System.currentTimeMillis() - startTime) + " ms"); } } @@ -503,7 +505,7 @@ public class MailEngine { } } catch (MessagingException me) { if (me.getNextException() instanceof SocketException) { - if (_log.isWarnEnabled()) { + if (mwgDebug || _log.isWarnEnabled()) { _log.warn("Failed to connect to a valid mail server. Please " + "make sure one is properly configured. " + me.getMessage()); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailManagerUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailManagerUtil.java index e0aeda5b..1d65582c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailManagerUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/util/MailManagerUtil.java @@ -24,6 +24,8 @@ import java.util.List; public class MailManagerUtil { + private final static Log _log = LogFactoryUtil.getLog(MailManagerUtil.class); + public static Email addEmailByTemplate(String className, long classPK, long emailTemplateId, JSONObject templateParamJSON, List fileAttachments, ServiceContext serviceContext) throws Exception { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/common/email_dialog_attachment.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/common/email_dialog_attachment.jsp index 39f77085..a4859bbe 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/common/email_dialog_attachment.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/common/email_dialog_attachment.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/init.jsp" %> <% diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/edit.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/edit.jsp index 114d25d0..fdde85d0 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/edit.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/edit.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/email_templates/init.jsp" %> <% diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_send_popup_button.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_send_popup_button.jsp index 25082e4d..7e89ec84 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_send_popup_button.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_send_popup_button.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/email_templates/init.jsp" %> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_template_action.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_template_action.jsp index f69c6d61..d451e1e9 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_template_action.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/email_template_action.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/email_templates/init.jsp" %> <% diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/init.jsp index 79168c4b..291e245a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/init.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/init.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/init.jsp" %> <%@page import="org.apache.log4j.Logger"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/close_popup.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/close_popup.jsp index 67111b66..73bfc8be 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/close_popup.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/close_popup.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/email_templates/send_popup/init.jsp" %> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/init.jsp index 5ce28676..ea4e3093 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/init.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/init.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/email_templates/init.jsp" %> <% String className = ParamUtil.getString(request, "className"); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/view.jsp index 0450532b..e84a3723 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/send_popup/view.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/email_templates/send_popup/init.jsp" %> <% diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/toolbar.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/toolbar.jsp index 57316f64..490715d3 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/toolbar.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/toolbar.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/email_templates/init.jsp"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/view.jsp index f513b796..ca92fe43 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/email_templates/view.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/email_templates/init.jsp" %> <%@page import="it.tref.liferay.portos.mailmanager.service.EmailTemplateLocalServiceUtil"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/init.jsp index f7a89418..191d09e8 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/init.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/init.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.liferay.portal.util.PortalUtil"%> <%@page import="com.liferay.portlet.PortletURLUtil"%> @@ -28,6 +27,8 @@ <%@page import="it.tref.liferay.portos.mailmanager.shared.util.MailManagerConstants"%> +<%@ page contentType="text/html; charset=UTF-8" %> + <%@page import="com.liferay.portal.kernel.util.GetterUtil"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/edit.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/edit.jsp index 89ef8581..72c4f394 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/edit.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/edit.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/mail_manager/init.jsp" %> <% diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_action.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_action.jsp index 43de79f2..03f22413 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_action.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_action.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/mail_manager/init.jsp" %> <% diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_history_popup_button.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_history_popup_button.jsp index 08210e78..96e85b6f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_history_popup_button.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/email_history_popup_button.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/mail_manager/init.jsp" %> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/init.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/init.jsp index e1014604..8936f925 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/init.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/init.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/init.jsp" %> <%@page import="com.liferay.portal.kernel.util.TextFormatter"%> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/view.jsp index 5a3f7523..8057dbba 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/html/mail_manager/view.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/mail_manager/init.jsp" %> <% diff --git a/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/liferay-display.xml b/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/liferay-display.xml index d92a3f40..fe611ecc 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/liferay-display.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/liferay-display.xml @@ -3,11 +3,11 @@ - + - + \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/service.xml b/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/service.xml index 88c74249..b84d5657 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/service.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/service.xml @@ -1,64 +1,48 @@ - + + portos_maintenance - - - + - - - + - - - - - - - + + + + + - - - - - - - + + + + + + - - - + + - - + - - - + - - - + + - - + - - + - - RequiredMaintenanceType RequiredMaintenanceReason diff --git a/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/maintenance/portlet/AdminMaintenancePortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/maintenance/portlet/AdminMaintenancePortlet.java index 56360468..18d61763 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/maintenance/portlet/AdminMaintenancePortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/maintenance/portlet/AdminMaintenancePortlet.java @@ -1,14 +1,5 @@ package it.tref.liferay.portos.maintenance.portlet; -import it.tref.liferay.portos.maintenance.model.MaintenanceSchedule; -import it.tref.liferay.portos.maintenance.service.MaintenanceScheduleServiceUtil; - -import java.util.Calendar; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletSession; - import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.log.Log; @@ -26,73 +17,105 @@ import com.liferay.portal.service.ServiceContextFactory; import com.liferay.portal.util.PortalUtil; import com.liferay.util.bridges.mvc.MVCPortlet; +import it.tref.liferay.portos.maintenance.model.MaintenanceSchedule; +import it.tref.liferay.portos.maintenance.service.MaintenanceScheduleServiceUtil; + +import java.util.Calendar; + +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; +import javax.portlet.PortletSession; + +/** + * Portlet implementation class AdminMaintenancePortlet + */ public class AdminMaintenancePortlet extends MVCPortlet { - private static final Log _log = LogFactoryUtil.getLog(AdminMaintenancePortlet.class); - - public void maintain(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { - - PortletSession portletSession = actionRequest.getPortletSession(); - String message = ParamUtil.getString(actionRequest, "message"); - String className = LanguageUtil - .get(LocaleUtil.getDefault(), - "the-sign-in-process-is-temporarily-disabled-because-the-portal-is-undergoing-a-routine-maintenance-upgrade"); - if (Validator.isNotNull(message)) { - className = message; - } - Class clazz = ClassResolverUtil.resolve("com.liferay.portal.util.MaintenanceUtil", - PortalClassLoaderUtil.getClassLoader()); - ReflectionUtil.getDeclaredMethod(clazz, "maintain", String.class, String.class).invoke(null, - portletSession.getId(), className); - _log.info("Maintenance session id: " + portletSession.getId()); - } - - public void deleteMaintenanceSchedule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { - - _log.info("deleteMaintenanceSchedule - Inizio metodo"); - ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); - long maintenanceScheduleId = ParamUtil.getLong(actionRequest, "maintenanceScheduleId"); - MaintenanceScheduleServiceUtil.deleteMaintenanceSchedule(maintenanceScheduleId, serviceContext); - } - - public void editMaintenanceSchedule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { - - _log.info("editMaintenanceSchedule - Inizio metodo"); - String cmd = ParamUtil.getString(actionRequest, Constants.CMD); - ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); - long maintenanceScheduleId = ParamUtil.getLong(actionRequest, "maintenanceScheduleId"); - String type = ParamUtil.getString(actionRequest, "type"); - String reason = ParamUtil.getString(actionRequest, "reason"); - String portalMessage = ParamUtil.getString(actionRequest, "portalMessage"); - long after = ParamUtil.getLong(actionRequest, "after"); - String onreboot = ParamUtil.getString(actionRequest, "onreboot"); - String status = ParamUtil.getString(actionRequest, "status"); - String statusMessage = ParamUtil.getString(actionRequest, "statusMessage"); - Calendar calendarEnd = Calendar.getInstance(); - calendarEnd.set(ParamUtil.getInteger(actionRequest, "endYear"), - ParamUtil.getInteger(actionRequest, "endMonth") + 1, ParamUtil.getInteger(actionRequest, "endDay"), - ParamUtil.getInteger(actionRequest, "endHour"), ParamUtil.getInteger(actionRequest, "endMinute")); - MaintenanceSchedule maintenanceSchedule = null; - try { - if (cmd.equals(Constants.ADD)) { - maintenanceSchedule = MaintenanceScheduleServiceUtil.addMaintenanceSchedule(type, reason, - portalMessage, after, calendarEnd.getTime(), onreboot, serviceContext); - } else if (cmd.equals(Constants.UPDATE)) { - maintenanceSchedule = MaintenanceScheduleServiceUtil.updateMaintenanceSchedule(maintenanceScheduleId, - type, reason, portalMessage, after, calendarEnd.getTime(), onreboot, status, statusMessage, - serviceContext); - } - } catch (PortalException e) { - _log.error(e); - SessionErrors.add(actionRequest, e.getClass()); - } - if (SessionErrors.isEmpty(actionRequest)) { - actionResponse.setRenderParameter("maintenanceScheduleId", - String.valueOf(maintenanceSchedule.getMaintenanceScheduleId())); - actionResponse.setRenderParameter("mvcPath", "/html/admin_maintenance/edit.jsp"); - } else { - actionResponse.setRenderParameter("mvcPath", "/html/admin_maintenance/edit.jsp"); - PortalUtil.copyRequestParameters(actionRequest, actionResponse); - } - } + private final static Log _log = LogFactoryUtil.getLog(AdminMaintenancePortlet.class); + + public void maintain(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { + + PortletSession portletSession = actionRequest.getPortletSession(); + + String message = ParamUtil.getString(actionRequest, "message"); + + String className = + LanguageUtil + .get(LocaleUtil.getDefault(), + "the-sign-in-process-is-temporarily-disabled-because-the-portal-is-undergoing-a-routine-maintenance-upgrade"); + + if (Validator.isNotNull(message)) { + className = message; + } + + Class clazz = + ClassResolverUtil.resolve("com.liferay.portal.util.MaintenanceUtil", PortalClassLoaderUtil.getClassLoader()); + ReflectionUtil.getDeclaredMethod(clazz, "maintain", String.class, String.class).invoke(null, + portletSession.getId(), className); + + _log.info("Maintenance session id: " + portletSession.getId()); + + + } + + public void deleteMaintenanceSchedule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { + _log.info("deleteMaintenanceSchedule - Inizio metodo"); + + ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); + long maintenanceScheduleId = ParamUtil.getLong(actionRequest, "maintenanceScheduleId"); + + MaintenanceScheduleServiceUtil.deleteMaintenanceSchedule(maintenanceScheduleId, serviceContext); + + } + + public void editMaintenanceSchedule(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { + _log.info("editMaintenanceSchedule - Inizio metodo"); + + String cmd = ParamUtil.getString(actionRequest, Constants.CMD); + + ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); + + long maintenanceScheduleId = ParamUtil.getLong(actionRequest, "maintenanceScheduleId"); + String type = ParamUtil.getString(actionRequest, "type"); + String reason = ParamUtil.getString(actionRequest, "reason"); + String portalMessage = ParamUtil.getString(actionRequest, "portalMessage"); + long after = ParamUtil.getLong(actionRequest, "after"); + String onreboot = ParamUtil.getString(actionRequest, "onreboot"); + String status = ParamUtil.getString(actionRequest, "status"); + String statusMessage = ParamUtil.getString(actionRequest, "statusMessage"); + + Calendar calendarEnd = Calendar.getInstance(); + calendarEnd.set(ParamUtil.getInteger(actionRequest, "endYear"), + ParamUtil.getInteger(actionRequest, "endMonth") + 1, ParamUtil.getInteger(actionRequest, "endDay"), + ParamUtil.getInteger(actionRequest, "endHour"), ParamUtil.getInteger(actionRequest, "endMinute")); + + MaintenanceSchedule maintenanceSchedule = null; + + try { + + if (cmd.equals(Constants.ADD)) { + maintenanceSchedule = + MaintenanceScheduleServiceUtil.addMaintenanceSchedule(type, reason, portalMessage, after, + calendarEnd.getTime(), onreboot, serviceContext); + } else if (cmd.equals(Constants.UPDATE)) { + maintenanceSchedule = + MaintenanceScheduleServiceUtil.updateMaintenanceSchedule(maintenanceScheduleId, type, reason, + portalMessage, after, calendarEnd.getTime(), onreboot, status, statusMessage, serviceContext); + } + + } catch (PortalException e) { + _log.error(e); + SessionErrors.add(actionRequest, e.getClass()); + } + + if (SessionErrors.isEmpty(actionRequest)) { + actionResponse.setRenderParameter("maintenanceScheduleId", + String.valueOf(maintenanceSchedule.getMaintenanceScheduleId())); + actionResponse.setRenderParameter("mvcPath", "/html/admin_maintenance/edit.jsp"); + } else { + actionResponse.setRenderParameter("mvcPath", "/html/admin_maintenance/edit.jsp"); + PortalUtil.copyRequestParameters(actionRequest, actionResponse); + } + + } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/maintenance/service/persistence/MaintenanceSchedulePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/maintenance/service/persistence/MaintenanceSchedulePersistenceImpl.java index efe4a7f2..2d43c614 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/maintenance/service/persistence/MaintenanceSchedulePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-maintenance-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/maintenance/service/persistence/MaintenanceSchedulePersistenceImpl.java @@ -46,7 +46,6 @@ import it.tref.liferay.portos.maintenance.NoSuchMaintenanceScheduleException; import it.tref.liferay.portos.maintenance.model.MaintenanceSchedule; import it.tref.liferay.portos.maintenance.model.impl.MaintenanceScheduleImpl; import it.tref.liferay.portos.maintenance.model.impl.MaintenanceScheduleModelImpl; -import it.tref.liferay.portos.maintenance.service.persistence.MaintenanceSchedulePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mapit-plugin-portlet/docroot/html/plugin/top.jsp b/liferay-plugins-sdk-6.2/portlets/portos-mapit-plugin-portlet/docroot/html/plugin/top.jsp index aa1f367c..ede5da6a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mapit-plugin-portlet/docroot/html/plugin/top.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-mapit-plugin-portlet/docroot/html/plugin/top.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.liferay.portal.security.permission.ResourceActionsUtil"%> <%@page import="com.liferay.portal.util.PortalUtil"%> <%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%> @@ -6,15 +5,27 @@ <%@page import="com.liferay.portal.util.PortletKeys"%> <%@page import="com.liferay.portlet.PortletURLFactoryUtil"%> <%@include file="/html/plugin/init.jsp" %> + + <% -String contextName = getServletContext().getServletContextName(); -String portletNamespace = ParamUtil.getString(request, "mapitNamespace", "_1_WAR_portosfeportlet_"); -String verifyComune = ParamUtil.getString(request, "verifyComune", "true"); + String contextName = getServletContext().getServletContextName(); + String portletNamespace = ParamUtil.getString(request, "mapitNamespace", "_1_WAR_portosfeportlet_"); %> - + + +<% +/* PortletURL popupURL = PortletURLFactoryUtil.create(request, "1_WAR_portosmapitplugin", + plid, PortletRequest.RENDER_PHASE); */ + +/* popupURL.setParameter("mvcPath", "/html/move_asset/popup.jsp"); +popupURL.setWindowState(LiferayWindowState.POP_UP); +popupURL.setPortletMode(PortletMode.VIEW); */ +%> + +
- +
@@ -81,7 +94,7 @@ String verifyComune = ParamUtil.getString(request, "verifyComune", "true"); var portletNamespace = "<%= portletNamespace %>", mapItMap; -var verifyComune = <%= verifyComune %>; + Liferay.on('<%= "mapItMapReady" + StringPool.PERIOD + getServletContext().getServletContextName() %>', function(event) { AUI().use('liferay-mapit-map', 'aui-io-request', function(A) { @@ -93,27 +106,106 @@ Liferay.on('<%= "mapItMapReady" + StringPool.PERIOD + getServletContext().getSer mapItMap = Liferay.MapItMap.get(portletId); var latitude = AUI().one("#"+portletNamespace+"lat"), - longitude = AUI().one("#"+portletNamespace+"long"); - var isEditable = AUI().one("#"+portletNamespace+"geoIsEditable"); - isEditable = (undefined == isEditable) || (isEditable.val() == "true"); + longitude = AUI().one("#"+portletNamespace+"long"), + isEditable = AUI().one("#"+portletNamespace+"geoIsEditable").val() == "true"; var editableLatitude = AUI().one("#"+portletNamespace+"lat_hidden"), editableLongitude = AUI().one("#"+portletNamespace+"long_hidden"), - editableZoom = AUI().one("#"+portletNamespace+"zoom"); + editableZoom = AUI().one("#"+portletNamespace+"zoom"); - var extent = new OpenLayers.Bounds(); - extent.extend(new OpenLayers.LonLat(9.6771486410157, 44.486291328126)); - extent.extend(new OpenLayers.LonLat(12.431970418358, 42.214181342774)); + var extent = new OpenLayers.Bounds(); + extent.extend(new OpenLayers.LonLat(9.6771486410157, 44.486291328126)); + extent.extend(new OpenLayers.LonLat(12.431970418358, 42.214181342774)); - var geographic = new OpenLayers.Projection("EPSG:4326"); + var geographic = new OpenLayers.Projection("EPSG:4326"); var mercator = new OpenLayers.Projection( "EPSG:3857"); extent.transform(geographic,mercator ); + //mapItMap.addOption({restrictedExtent: extent}); + + /* var boxes = new OpenLayers.Layer.Boxes("boxes"); + var box = new OpenLayers.Marker.Box(extent); + boxes.addMarker(box); + mapItMap.addWMSLayer(boxes); */ + + + var civici = new OpenLayers.Layer.WMS( + 'Numeri Civici', + 'http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsosm_d&map_resolution=91&', { + styles: 'etichette_blu', + layers: 'rt_osm.civici.point', transparent: true}, + {isBaseLayer: false, visibility : false} + ); + //mapItMap.addWMSLayer(civici); + + var comuni = new OpenLayers.Layer.WMS( + 'Comuni', + 'http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsambamm&map_resolution=91', { + styles: 'contorno_senza_etichette', + layers: 'rt_ambamm.idcomuni.rt.poly', transparent: true}, + {isBaseLayer: false} + ); + //mapItMap.addWMSLayer(comuni); + + var topografico = new OpenLayers.Layer.WMS( + 'Topografico', + 'http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmscartoteca&map_resolution=91&', { + styles: 'senza_etichette', + layers: 'rt_cartoteca.dbt.2k', transparent: true}, + {isBaseLayer: false, visibility : false} + ); + //mapItMap.addWMSLayer(topografico); + + var rischio_bacini_regionali = new OpenLayers.Layer.WMS( + 'Rischio Idrogeologico', + 'http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsperidr&map_resolution=91&language=ita&', { + styles: 'default', + layers: 'rt_peridr.rischio_bacini_regionali', transparent: true}, + {isBaseLayer: false, visibility : false} + ); + //mapItMap.addWMSLayer(rischio_bacini_regionali); + + var catasto_strade = new OpenLayers.Layer.WMS( + 'Strade', + 'http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmscatasto&map_resolution=91&language=ita&', { + styles: 'terra_di_siena_bruciata', + layers: 'rt_cat.idcatstrade.rt', transparent: true}, + {isBaseLayer: false, visibility : false} + ); + //mapItMap.addWMSLayer(catasto_strade); + + var catasto_fabbricati = new OpenLayers.Layer.WMS( + 'Fabbricati', + 'http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmscatasto&map_resolution=91&language=ita&', { + styles: 'carminio_chiaro', + layers: 'rt_cat.idcatfabbr.rt', transparent: true}, + {isBaseLayer: false, visibility : false} + ); + //mapItMap.addWMSLayer(catasto_fabbricati); + + var catasto_fogli = new OpenLayers.Layer.WMS( + 'Fogli Catastali', + 'http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmscatasto&map_resolution=91&language=ita&', { + styles: 'solo_contorno_viola_fine_con_etichette', + layers: 'rt_cat.idcatbdfog.rt', transparent: true}, + {isBaseLayer: false, visibility : false} + ); + //mapItMap.addWMSLayer(catasto_fogli); + + var catasto_particelle = new OpenLayers.Layer.WMS( + 'Particelle Catastali', + 'http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmscatasto&map_resolution=91&language=ita&', { + styles: 'contorno_rosso_mattone_con_etichette', + layers: 'rt_cat.idcatpart.rt', transparent: true}, + {isBaseLayer: false, visibility : false} + ); + //mapItMap.addWMSLayer(catasto_particelle); + var markerStyle = { - graphicHeight: 29, - graphicWidth: 22, - externalGraphic: '<%= getServletContext().getContextPath() + "/images/marker.png" %>' - }; + graphicHeight: 29, + graphicWidth: 22, + externalGraphic: '<%= getServletContext().getContextPath() + "/images/marker.png" %>' + }; var layerName = ''; if(latitude.val()!="" && longitude.val()!=""){ @@ -123,6 +215,7 @@ Liferay.on('<%= "mapItMapReady" + StringPool.PERIOD + getServletContext().getSer style: markerStyle }]; mapItMap.addLayerPoints(layerName, point, true, {selectable: true, displayInLayerSwitcher: false}); + /* mapItMap.moveMap(longitude , latitude , mapItMap.getCurrentZoom()); */ var secureZoom = "8"; if(editableZoom != undefined && editableZoom != null){ var secureZoom =editableZoom.val() @@ -131,40 +224,54 @@ Liferay.on('<%= "mapItMapReady" + StringPool.PERIOD + getServletContext().getSer } - if (isEditable) { + if(isEditable){ + mapItMap.registerFunctionOnEvent("click", function (e) { - var position = mapItMap.getPositionOnClick(e); - var point_lat = position.lat; - var point_long = position.lon; - var zoom = mapItMap.getCurrentZoom(); - var newPoint = [ { - lat: point_lat, - lon: point_long, - style: markerStyle - }]; - mapItMap.addLayerPoints(layerName, newPoint, true, {}); - if (confirm("Vuoi aggiornare automaticamente i dati della localizzazione?")) { - updateCoords(point_lat, point_long, zoom, true); - } - }); + var position = mapItMap.getPositionOnClick(e); + var point_lat = position.lat; + var point_long = position.lon; + var zoom = mapItMap.getCurrentZoom(); + var newPoint = [ { + lat: point_lat, + lon: point_long, + style: markerStyle + }]; + + mapItMap.addLayerPoints(layerName, newPoint, true, {}); + if (confirm("Vuoi aggiornare automaticamente i dati della localizzazione?") == true) { + updateCoords(point_lat, point_long, zoom, true); + } + /* confirm("Vuoi aggiornare automaticamente i dati della localizzazione?", + {x : point_lat, y : point_long, z : true} + ) */ + + }); mapItMap.attachDrag(layerName, { on: { complete: function(event) { - var point_lat = event.latitude; - var point_long = event.longitude; - var zoom = mapItMap.getCurrentZoom(); + /* console.log(mapItMap); + console.log(event); + console.log(mapItMap.getPositionOnClick(event)); */ - if (confirm("Vuoi aggiornare automaticamente i dati della localizzazione?")) { - updateCoords(point_lat, point_long, zoom, true); - } + var point_lat = event.latitude; + var point_long = event.longitude; + var zoom = mapItMap.getCurrentZoom(); + + + if (confirm("Vuoi aggiornare automaticamente i dati della localizzazione?") == true) { + updateCoords(point_lat, point_long, zoom, true); + } + /* confirm("Vuoi aggiornare automaticamente i dati della localizzazione?", + {x : point_lat, y : point_long, z : true} + ) */ } } }); mapItMap.activateDrag("Pratica"); - var zoomEvent = function() { - if (editableLatitude.val() != "" && editableLongitude.val() != "") { + var zoomEvent = function(){ + if(editableLatitude.val()!="" && editableLongitude.val()!=""){ editableZoom.val(mapItMap.getCurrentZoom()); } }; @@ -173,37 +280,63 @@ Liferay.on('<%= "mapItMapReady" + StringPool.PERIOD + getServletContext().getSer } Liferay.fire('mapIt-ready'); + + + /* featurePicker = new OpenLayers.Control.WMSGetFeatureInfo({ + url: 'http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmscatasto&map_resolution=91&language=ita&', + title: 'Identify features by clicking', + layers: [catasto_particelle, catasto_fogli], + queryVisible: false, + output:'features', - A.one("#map").append('
'); - var lockButton = A.one('#container_btn .bloccamap'), - lockLayer = A.one('#map .layermap'), - latValue = editableLatitude != null ? editableLatitude.val() : latitude.val(), - longValue = editableLongitude != null ? editableLongitude.val() : longitude.val(), - locked = latValue != "" && longValue != ""; - lockMap(lockButton, lockLayer, latValue, longValue, !locked) - - A.one('#container_btn .bloccamap').on('click', function(event) { - var nodeObject = event.currentTarget, - locked = event.currentTarget.hasClass('fa-lock'); - lockMap(lockButton, lockLayer, latValue, longValue, locked); - }); + eventListeners: { + getfeatureinfo: function(event) { + console.log(event); + console.log(event.features); + console.log(event.text); + }, + nogetfeatureinfo: function(event) { + console.err("No queriable layers found"); + } + + } + }); + + mapItMap.insertControl(featurePicker); + featurePicker.activate(); + console.log("Activated"); */ + + A.one("#map").append('
'); + var lockButton = A.one('#container_btn .bloccamap'), + lockLayer = A.one('#map .layermap'), + latValue = editableLatitude != null ? editableLatitude.val() : latitude.val(), + longValue = editableLongitude != null ? editableLongitude.val() : longitude.val(), + locked = latValue!="" && longValue!=""; + lockMap(lockButton, lockLayer, latValue, longValue, !locked) + + A.one('#container_btn .bloccamap').on('click', function(event){ + var nodeObject = event.currentTarget, + locked = event.currentTarget.hasClass('fa-lock'); + lockMap(lockButton, lockLayer, latValue, longValue, locked); + }); } }); }); -function lockMap(lockButton, lockLayer, latitude, longitude, locked) { - if (locked) { +function lockMap(lockButton, lockLayer, latitude, longitude, locked){ + if(locked){ lockButton.replaceClass('fa-lock', 'fa-unlock'); lockLayer.removeClass('activelayer'); } else { lockButton.replaceClass('fa-unlock', 'fa-lock'); lockLayer.addClass('activelayer'); } - if (latitude != "" && longitude != "") { + if(latitude!="" && longitude!=""){ mapItMap.moveMap(longitude, latitude, mapItMap.getCurrentZoom()); + //updateCoords(latitude, longitude, mapItMap.getCurrentZoom(), false); var editableZoom = AUI().one("#"+portletNamespace+"zoom"); - if (editableZoom != null) { + if(editableZoom!=null){ editableZoom.val(mapItMap.getCurrentZoom()); } } @@ -217,14 +350,16 @@ Liferay.on('geolocation-ready',function(event) { longitude = event.longitude, full = event.fullAddress; - if (latitude != "" && longitude != "") { + if(latitude!="" && longitude!=""){ var zoom = mapItMap.getCurrentZoom() > 8 ? mapItMap.getCurrentZoom() : 12; - if (full) { + console.log(full); + if(full){ + //zoom = 14; var markerStyle = { - graphicHeight: 29, - graphicWidth: 22, - externalGraphic: '<%= getServletContext().getContextPath() + "/images/marker.png" %>' - }; + graphicHeight: 29, + graphicWidth: 22, + externalGraphic: '<%= getServletContext().getContextPath() + "/images/marker.png" %>' + }; var layerName = ''; var newlonLat = new OpenLayers.LonLat(longitude, latitude).transform( new OpenLayers.Projection("EPSG:3857") , new OpenLayers.Projection("EPSG:4326")); @@ -237,118 +372,155 @@ Liferay.on('geolocation-ready',function(event) { mapItMap.addLayerPoints(layerName, search_point, true, {}); updateCoords(latitude, longitude, zoom, false); } + mapItMap.moveMap(longitude, latitude, zoom); + } }); }); function updateCoords(lat_coord, long_coord, zoom_coord, fullUpdate, noTransform){ AUI().use('aui-io-request', function(A) { - var latitude = AUI().one("#" + portletNamespace + "lat"), - longitude = AUI().one("#" + portletNamespace + "long"), - editableLatitude = AUI().one("#" + portletNamespace + "lat_hidden"), - editableLongitude = AUI().one("#" + portletNamespace + "long_hidden"), - editableZoom = AUI().one("#" + portletNamespace + "zoom"), - city = AUI().one("#" + portletNamespace + "comune"); - address = AUI().one("#" + portletNamespace + "via"); + var latitude = AUI().one("#"+portletNamespace+"lat"), + longitude = AUI().one("#"+portletNamespace+"long"), + editableLatitude = AUI().one("#"+portletNamespace+"lat_hidden"), + editableLongitude = AUI().one("#"+portletNamespace+"long_hidden"), + editableZoom = AUI().one("#"+portletNamespace+"zoom"), + city = AUI().one("#"+portletNamespace+"comune"); + address = AUI().one("#"+portletNamespace+"via"); var newlonLat; - if (fullUpdate) { - if (!noTransform) { + if(fullUpdate){ + if(!noTransform) newlonLat = new OpenLayers.LonLat(long_coord, lat_coord).transform( new OpenLayers.Projection("EPSG:3857") , new OpenLayers.Projection("EPSG:4326")); - } else { + else newlonLat = new OpenLayers.LonLat(long_coord, lat_coord); - } var markerStyle = { - graphicHeight: 29, - graphicWidth: 22, - externalGraphic: '<%= getServletContext().getContextPath() + "/images/marker.png" %>' - }; - var layerName = ''; + graphicHeight: 29, + graphicWidth: 22, + externalGraphic: '<%= getServletContext().getContextPath() + "/images/marker.png" %>' + }; + var layerName = ''; + + var search_point = [ { + lat: newlonLat.lat, + lon: newlonLat.lon, + style: markerStyle + }]; + mapItMap.addLayerPoints(layerName, search_point, true, {}); - var search_point = [ { - lat: newlonLat.lat, - lon: newlonLat.lon, - style: markerStyle - }]; - mapItMap.addLayerPoints(layerName, search_point, true, {}); - } else { - newlonLat = new OpenLayers.LonLat(long_coord, lat_coord); + }else{ + newlonLat=new OpenLayers.LonLat(long_coord, lat_coord); } - + var url = "https://nominatim.openstreetmap.org/reverse?format=json&zoom=18&addressdetails=1" +"&lat="+(newlonLat.lat)+"&lon="+(newlonLat.lon); - if (fullUpdate) { + if(fullUpdate){ A.io.request(url, { - dataType: 'json', - on: { - success: function() { - var response = this.get('responseData'), - town = response.address.city != undefined - ? response.address.city - : (response.address.town != undefined - ? response.address.town - : response.address.village) - .replaceAll(' ', '-') - .toLowerCase(); + dataType: 'json', + on: { + success: function() { - if (verifyComune && city.val().toLowerCase().split(" ").join("-") != town) { - alert("Attenzione!\nHai selezionato un punto esterno al comune di riferimento..."); - address.val(""); - } else { - var fullAddress = ''; - if(response.address.road != undefined) { - fullAddress += response.address.road; - } else if (response.address.pedestrian != undefined) { - fullAddress += response.address.pedestrian; - } - if (fullAddress != '') { - fullAddress += (response.address.house_number != undefined ? " " + response.address.house_number : ""); - } - address.val(fullAddress); - if (!verifyComune) { - var provincia = response.address.county.replaceAll(' ', '-').toLowerCase(); - var province = window[portletNamespace + 'province']; - if (undefined != province[provincia]) { - AUI().use('event', 'node-event-simulate', function(A) { - A.one('#' + portletNamespace + 'provincia') - .set('value', province[provincia]) - .simulate('change'); - window[portletNamespace + 'comuneSelezionato'] = town.replaceAll(' ', '-').toLowerCase(); - }); - } - } - } - } + var response = this.get('responseData'), + town = response.address.city!=undefined ? response.address.city : (response.address.town!=undefined ? response.address.town : response.address.village); + + if(city.val().toLowerCase().split(" ").join("_") != town.toLowerCase().split(" ").join("_")){ + alert("Attenzione!\nHai selezionato un punto esterno al comune di riferimento..."); + address.val(""); + } else { + + var fullAddress = ''; + if(response.address.road != undefined) + fullAddress += response.address.road; + else if(response.address.pedestrian != undefined) + fullAddress += response.address.pedestrian; + + if(fullAddress != '') + fullAddress += (response.address.house_number != undefined ? " " + response.address.house_number : ""); + + address.val(fullAddress); + } + } + } }); } + + /*editableLatitude.val(lat_coord); + latitude.val(lat_coord); + editableLongitude.val(long_coord); + editableZoom.val(zoom_coord); + longitude.val(long_coord);*/ editableLatitude.val(newlonLat.lat); - latitude.val(newlonLat.lat); - editableLongitude.val(newlonLat.lon); - longitude.val(newlonLat.lon); - editableZoom.val(zoom_coord); + latitude.val(newlonLat.lat); + editableLongitude.val(newlonLat.lon); + editableZoom.val(zoom_coord); + longitude.val(newlonLat.lon); + }); } window.alert = function(msg){ - $('.customAlertMessage').text(msg); - $('.customAlert').css('animation', 'fadeIn 0.3s linear'); - $('.customAlert').css('display', 'inline'); - setTimeout(function(){ - $('.customAlert').css('animation', 'none'); - }, 100); + $('.customAlertMessage').text(msg); + $('.customAlert').css('animation', 'fadeIn 0.3s linear'); + $('.customAlert').css('display', 'inline'); + setTimeout(function(){ + $('.customAlert').css('animation', 'none'); + }, 100); }; -$(function() { - $('.confirmButton').click(function() { - $('.customAlert').css('animation', 'fadeOut 0.3s linear'); - setTimeout(function() { - $('.customAlert').css('animation', 'none'); +$(function(){ + $('.confirmButton').click(function(){ + $('.customAlert').css('animation', 'fadeOut 0.3s linear'); + setTimeout(function(){ + $('.customAlert').css('animation', 'none'); $('.customAlert').css('display', 'none'); - }, 100); - }); + }, 100); + }); }); + +/* +var globalGeolocationParams; +window.confirm = function(msg, callback){ + $('.message').text(msg); + $('.customConfirm').css('animation', 'fadeIn 0.3s linear'); + $('.customConfirm').css('display', 'inline'); + setTimeout(function(){ + $('.customConfirm').css('animation', 'none'); + }, 100); + + globalGeolocationParams = callback; +}; + +$(function(){ + $('.confirmButton').click(function(){ + $('.customAlert').css('animation', 'fadeOut 0.3s linear'); + setTimeout(function(){ + $('.customAlert').css('animation', 'none'); + $('.customAlert').css('display', 'none'); + }, 100); + }); + $('.agreeButton').click(function(){ + console.log('agree'); + $('.customConfirm').css('animation', 'fadeOut 0.3s linear'); + setTimeout(function(){ + $('.customConfirm').css('animation', 'none'); + $('.customConfirm').css('display', 'none'); + }, 100); + + updateCoords(globalGeolocationParams.x, globalGeolocationParams.y, globalGeolocationParams.z); + + }); + $('.refuseButton').click(function(){ + console.log('refused'); + $('.customConfirm').css('animation', 'fadeOut 0.3s linear'); + setTimeout(function(){ + $('.customConfirm').css('animation', 'none'); + $('.customConfirm').css('display', 'none'); + }, 100); + return; + }); +}); */ \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/model/impl/KaleoTaskAssignmentInstanceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/model/impl/KaleoTaskAssignmentInstanceImpl.java index 29882b7a..63c367e1 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/model/impl/KaleoTaskAssignmentInstanceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/model/impl/KaleoTaskAssignmentInstanceImpl.java @@ -1,31 +1,35 @@ /** - * Copyright (c) 2000-present Liferay, Inc. All rights reserved. This library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. */ package it.tref.liferay.portos.report.model.impl; /** - * The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the - * "kaleotaskassignmentinstance" database table, with each column mapped to a property of this class. + * The extended model implementation for the KaleoTaskAssignmentInstance service. Represents a row in the "kaleotaskassignmentinstance" database table, with each column mapped to a property of this class. + * *

- * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun - * ServiceBuilder to copy their definitions into the - * {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} interface. + * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} interface. *

* - * @author 3F Consulting + Manifattura Web Group s.r.l. + * @author 3F Consulting */ -@SuppressWarnings("serial") -public class KaleoTaskAssignmentInstanceImpl extends KaleoTaskAssignmentInstanceBaseImpl { +public class KaleoTaskAssignmentInstanceImpl + extends KaleoTaskAssignmentInstanceBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a kaleo task assignment - * instance model instance should use the {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} - * interface instead. + * NOTE FOR DEVELOPERS: + * + * Never reference this class directly. All methods that expect a kaleo task assignment instance model instance should use the {@link it.tref.liferay.portos.report.model.KaleoTaskAssignmentInstance} interface instead. */ - - public KaleoTaskAssignmentInstanceImpl() {} -} + public KaleoTaskAssignmentInstanceImpl() { + } +} \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/persistence/KaleoTaskAssignmentInstanceFinderImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/persistence/KaleoTaskAssignmentInstanceFinderImpl.java index c4b09bab..a478789a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/persistence/KaleoTaskAssignmentInstanceFinderImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/persistence/KaleoTaskAssignmentInstanceFinderImpl.java @@ -16,55 +16,76 @@ import com.liferay.portal.service.persistence.impl.BasePersistenceImpl; import com.liferay.util.dao.orm.CustomSQLUtil; public class KaleoTaskAssignmentInstanceFinderImpl extends BasePersistenceImpl implements - KaleoTaskAssignmentInstanceFinder { - - private static final Log _log = LogFactoryUtil.getLog(KaleoTaskAssignmentInstanceFinderImpl.class); - - private static final String DISTINCT_ASSIGNEE_USER = "Report.distinctKaleoAssigneeUser"; - private static final String DISTINCT_ASSIGNEE_ID = "Report.distinctKaleoAssigneeId"; - - @Override - public List distinctKaleoAssignee() throws SystemException { - - Session session = null; - try { - session = openSession(); - String sql = CustomSQLUtil.get(DISTINCT_ASSIGNEE_USER); - SQLQuery query = session.createSQLQuery(sql); - query.setCacheable(false); - QueryPos qPos = QueryPos.getInstance(query); - List list = query.list(); - return list; - } catch (ORMException e) { - _log.error("Errore", e); - throw new SystemException(e); - } finally { - if (session != null) { - closeSession(session); - } - } - } - - @Override - public List distinctKaleoAssigneeId(long userId) throws SystemException { - - Session session = null; - try { - session = openSession(); - String sql = CustomSQLUtil.get(DISTINCT_ASSIGNEE_ID); - SQLQuery query = session.createSQLQuery(sql); - query.setCacheable(false); - QueryPos qPos = QueryPos.getInstance(query); - qPos.add(userId); - List list = query.list(); - return list; - } catch (ORMException e) { - _log.error("Errore", e); - throw new SystemException(e); - } finally { - if (session != null) { - closeSession(session); - } - } - } + KaleoTaskAssignmentInstanceFinder { + + private final static Log _log = LogFactoryUtil.getLog(KaleoTaskAssignmentInstanceFinderImpl.class); + + private final String DISTINCT_ASSIGNEE_USER = "Report.distinctKaleoAssigneeUser"; + private final String DISTINCT_ASSIGNEE_ID = "Report.distinctKaleoAssigneeId"; + + public List distinctKaleoAssignee() throws SystemException { + + Session session = null; + + try { + + session = openSession(); + + String sql = CustomSQLUtil.get(DISTINCT_ASSIGNEE_USER); + // sql = StringUtil.replace(sql, "[$GROUP_ID$]", "" + groupId); + // sql = StringUtil.replace(sql, "[$GROUP_ID$]", StringUtil.merge(territorioIds)); + // sql = StringUtil.replace(sql, "[$TIPOPRATICA$]", "02"); + + SQLQuery query = session.createSQLQuery(sql); + query.setCacheable(false); + + QueryPos qPos = QueryPos.getInstance(query); + + List list = query.list(); + + return list; + + } catch (ORMException e) { + _log.error("Errore", e); + throw new SystemException(e); + } finally { + if (session != null) { + closeSession(session); + } + } + } + + public List distinctKaleoAssigneeId(long userId) throws SystemException { + + Session session = null; + + try { + + session = openSession(); + + String sql = CustomSQLUtil.get(DISTINCT_ASSIGNEE_ID); + // sql = StringUtil.replace(sql, "[$GROUP_ID$]", "" + groupId); + // sql = StringUtil.replace(sql, "[$GROUP_ID$]", StringUtil.merge(territorioIds)); + // sql = StringUtil.replace(sql, "[$TIPOPRATICA$]", "02"); + + SQLQuery query = session.createSQLQuery(sql); + query.setCacheable(false); + + QueryPos qPos = QueryPos.getInstance(query); + qPos.add(userId); + + List list = query.list(); + + return list; + + } catch (ORMException e) { + _log.error("Errore", e); + throw new SystemException(e); + } finally { + if (session != null) { + closeSession(session); + } + } + } + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportScadenzarioIstruttorie.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportScadenzarioIstruttorie.java index fe3c0cad..d6341c7e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportScadenzarioIstruttorie.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportScadenzarioIstruttorie.java @@ -31,7 +31,6 @@ import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.model.Organization; import com.liferay.portal.service.OrganizationLocalServiceUtil; @@ -42,102 +41,103 @@ public class ReportScadenzarioIstruttorie implements PortosReportInterface { @Override public String generateHTML(HttpServletRequest httpServletRequest) { + String html = ""; - String html = StringPool.BLANK; try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + JasperHtmlExporterBuilder htmlExporter = DynamicReports.export.htmlExporter(bos).setIgnoreHyperLink(true); + JasperReportBuilder builder = generateReport(httpServletRequest); builder.pageFooter(DynamicReports.cmp.pageNumber().setStyle(TemplatesADV.boldCenteredStyle)); builder.toHtml(htmlExporter); + byte[] byteArray = bos.toByteArray(); html = new String(byteArray); + } catch (DRException e) { _log.error(e, e); } + return html; } @Override public JasperReportBuilder generateReport(HttpServletRequest request) { - String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null); - TextColumnBuilder presidioColumn = DynamicReports.col.column("Ufficio", "presidioColumn", - DynamicReports.type.stringType()); - TextColumnBuilder numeroPraticheDaAssegnareColumn = DynamicReports.col.column( - "N° pratiche da assegnare da parte delle PO", "numeroPraticheDaAssegnareColumn", - DynamicReports.type.integerType()); - TextColumnBuilder numeroPraticheDaApprovareColumn = DynamicReports.col.column( - "N° pratiche da approvare da parte delle PO", "numeroPraticheDaApprovareColumn", - DynamicReports.type.integerType()); - TextColumnBuilder numeroPraticheInIstruttoriaOrdinarieColumn = DynamicReports.col.column( - "N° pratiche In Istruttoria", "numeroPraticheInIstruttoriaOrdinarieColumn", - DynamicReports.type.integerType()); - TextColumnBuilder numeroPraticheConIntegrazOrdinarieColumn = DynamicReports.col.column( - "N° pratiche con Int.Richieste", "numeroPraticheConIntegrazOrdinarieColumn", - DynamicReports.type.integerType()); - TextColumnBuilder numeroPraticheInIstruttoriaInScadenzaColumn = DynamicReports.col.column( - "N° pratiche In Istruttoria", "numeroPraticheInIstruttoriaInScadenzaColumn", - DynamicReports.type.integerType()); - TextColumnBuilder numeroPraticheConIntegrazInScadenzaColumn = DynamicReports.col.column( - "N° pratiche con Int.Richieste", "numeroPraticheConIntegrazInScadenzaColumn", - DynamicReports.type.integerType()); - TextColumnBuilder numeroPraticheInIstruttoriaScaduteColumn = DynamicReports.col.column( - "N° pratiche In Istruttoria", "numeroPraticheInIstruttoriaScaduteColumn", - DynamicReports.type.integerType()); - TextColumnBuilder numeroPraticheConIntegrazScaduteColumn = DynamicReports.col.column( - "N° pratiche con Int.Richieste", "numeroPraticheConIntegrazScaduteColumn", - DynamicReports.type.integerType()); - ColumnTitleGroupBuilder titleGroupOrdinarie = DynamicReports.grid.titleGroup(tipoPraticaSelected - + " Ordinarie ( 0-39 gg) ", numeroPraticheInIstruttoriaOrdinarieColumn, - numeroPraticheConIntegrazOrdinarieColumn); - ColumnTitleGroupBuilder titleGroupInScadenza = DynamicReports.grid.titleGroup(tipoPraticaSelected - + " In Scadenza ( 40-60 gg) ", numeroPraticheInIstruttoriaInScadenzaColumn, - numeroPraticheConIntegrazInScadenzaColumn); - ColumnTitleGroupBuilder titleGroupScadute = DynamicReports.grid.titleGroup(tipoPraticaSelected - + " Scadute ( oltre 60 gg) ", numeroPraticheInIstruttoriaScaduteColumn, - numeroPraticheConIntegrazScaduteColumn); + + TextColumnBuilder presidioColumn = DynamicReports.col.column("Ufficio", "presidioColumn", DynamicReports.type.stringType()); + TextColumnBuilder numeroPraticheDaAssegnareColumn = DynamicReports.col.column("N�pratiche da assegnare da parte delle PO", "numeroPraticheDaAssegnareColumn", DynamicReports.type.integerType()); + + TextColumnBuilder numeroPraticheDaApprovareColumn = DynamicReports.col.column("N� pratiche da approvare da parte delle PO", "numeroPraticheDaApprovareColumn", DynamicReports.type.integerType()); + + // + TextColumnBuilder numeroPraticheInIstruttoriaOrdinarieColumn = DynamicReports.col.column("N�pratiche In Istruttoria", "numeroPraticheInIstruttoriaOrdinarieColumn", DynamicReports.type.integerType()); + + TextColumnBuilder numeroPraticheConIntegrazOrdinarieColumn = DynamicReports.col.column("N� pratiche con Int.Richieste", "numeroPraticheConIntegrazOrdinarieColumn", DynamicReports.type.integerType()); + + // + TextColumnBuilder numeroPraticheInIstruttoriaInScadenzaColumn = DynamicReports.col.column("N� pratiche In Istruttoria", "numeroPraticheInIstruttoriaInScadenzaColumn", DynamicReports.type.integerType()); + + TextColumnBuilder numeroPraticheConIntegrazInScadenzaColumn = DynamicReports.col.column("N� pratiche con Int.Richieste", "numeroPraticheConIntegrazInScadenzaColumn", DynamicReports.type.integerType()); + // + TextColumnBuilder numeroPraticheInIstruttoriaScaduteColumn = DynamicReports.col.column("N� pratiche In Istruttoria", "numeroPraticheInIstruttoriaScaduteColumn", DynamicReports.type.integerType()); + TextColumnBuilder numeroPraticheConIntegrazScaduteColumn = DynamicReports.col.column("N� pratiche con Int.Richieste", "numeroPraticheConIntegrazScaduteColumn", DynamicReports.type.integerType()); + + ColumnTitleGroupBuilder titleGroupOrdinarie = DynamicReports.grid.titleGroup(tipoPraticaSelected + " Ordinarie ( 0-39gg) ", numeroPraticheInIstruttoriaOrdinarieColumn, numeroPraticheConIntegrazOrdinarieColumn); + + ColumnTitleGroupBuilder titleGroupInScadenza = DynamicReports.grid.titleGroup(tipoPraticaSelected + " In Scadenza ( 40-60 gg) ", numeroPraticheInIstruttoriaInScadenzaColumn, numeroPraticheConIntegrazInScadenzaColumn); + + ColumnTitleGroupBuilder titleGroupScadute = DynamicReports.grid.titleGroup(tipoPraticaSelected + " Scadute ( oltre 60 gg) ", numeroPraticheInIstruttoriaScaduteColumn, numeroPraticheConIntegrazScaduteColumn); + JasperReportBuilder builder = DynamicReports .report() .setTemplate(TemplatesADV.reportTemplate) - .columnGrid(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, - titleGroupOrdinarie, titleGroupInScadenza, titleGroupScadute) - .columns(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, - numeroPraticheInIstruttoriaOrdinarieColumn, numeroPraticheConIntegrazOrdinarieColumn, - numeroPraticheInIstruttoriaInScadenzaColumn, numeroPraticheConIntegrazInScadenzaColumn, - numeroPraticheInIstruttoriaScaduteColumn, numeroPraticheConIntegrazScaduteColumn) - .setDataSource(createDataSource(request)) + .columnGrid(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, titleGroupOrdinarie, titleGroupInScadenza, titleGroupScadute) + .columns(presidioColumn, numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, numeroPraticheInIstruttoriaOrdinarieColumn, numeroPraticheConIntegrazOrdinarieColumn, numeroPraticheInIstruttoriaInScadenzaColumn, + numeroPraticheConIntegrazInScadenzaColumn, numeroPraticheInIstruttoriaScaduteColumn, numeroPraticheConIntegrazScaduteColumn).setDataSource(createDataSource(request)) .addProperty("net.sf.jasperreports.export.xls.detect.cell.type", "true"); + ; + return builder; } private JRDataSource createDataSource(HttpServletRequest request) { + DRDataSource dataSource = new DRDataSource("presidioColumn", "numeroPraticheDaAssegnareColumn", "numeroPraticheDaApprovareColumn", "numeroPraticheInIstruttoriaOrdinarieColumn", "numeroPraticheConIntegrazOrdinarieColumn", + "numeroPraticheInIstruttoriaInScadenzaColumn", "numeroPraticheConIntegrazInScadenzaColumn", "numeroPraticheInIstruttoriaScaduteColumn", "numeroPraticheConIntegrazScaduteColumn"); - DRDataSource dataSource = new DRDataSource("presidioColumn", "numeroPraticheDaAssegnareColumn", - "numeroPraticheDaApprovareColumn", "numeroPraticheInIstruttoriaOrdinarieColumn", - "numeroPraticheConIntegrazOrdinarieColumn", "numeroPraticheInIstruttoriaInScadenzaColumn", - "numeroPraticheConIntegrazInScadenzaColumn", "numeroPraticheInIstruttoriaScaduteColumn", - "numeroPraticheConIntegrazScaduteColumn"); try { String dateMaxString = ParamUtil.getString(request, "dateMax", null); String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null); + if (dateMaxString != null && tipoPraticaSelected != null) { + Date dateMax = SDF.parse(dateMaxString); + + Calendar calendarMax = Calendar.getInstance(); calendarMax.setTime(dateMax); calendarMax.set(Calendar.HOUR_OF_DAY, 23); dateMax = calendarMax.getTime(); + List orgs = new ArrayList(); orgs = OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS); + int numeroPraticheDaAssegnareColumn = 0; int numeroPraticheDaApprovareColumn = 0; + + int numPraticheOrdInIstruttoriaTecnico = 0; int numPraticheOrdInAttesaIntegrazione = 0; + + int numPraticheInScadenzaInIstruttoriaTecnico = 0; int numPraticheInScadenzaInAttesaIntegrazione = 0; + int numPraticheScaduteInIstruttoriaTecnico = 0; int numPraticheScaduteInAttesaIntegrazione = 0; - int totPraticheAperteFinePeriodo = 0; + int totPraticheAperteFinePeriodo=0; int numeroPraticheDaAssegnareColumnTOTALE = 0; int numeroPraticheDaApprovareColumnTOTALE = 0; int numPraticheOrdInIstruttoriaTecnicoTOTALE = 0; @@ -146,44 +146,71 @@ public class ReportScadenzarioIstruttorie implements PortosReportInterface { int numPraticheInScadenzaInAttesaIntegrazioneTOTALE = 0; int numPraticheScaduteInIstruttoriaTecnicoTOTALE = 0; int numPraticheScaduteInAttesaIntegrazioneTOTALE = 0; + for (Organization org : orgs) { if (org.getParentOrganization() != null) { long groupId = org.getGroup().getGroupId(); - Map dbResult = ReportEngineServiceUtil.praticheAperte(dateMax, groupId, - tipoPraticaSelected); - numPraticheOrdInIstruttoriaTecnico = dbResult.get("numPraticheOrdInIstruttoriaTecnico"); - numPraticheOrdInAttesaIntegrazione = dbResult.get("numPraticheOrdInAttesaIntegrazione"); - numPraticheInScadenzaInIstruttoriaTecnico = dbResult - .get("numPraticheInScadenzaInIstruttoriaTecnico"); - numPraticheInScadenzaInAttesaIntegrazione = dbResult - .get("numPraticheInScadenzaInAttesaIntegrazione"); - numPraticheScaduteInIstruttoriaTecnico = dbResult.get("numPraticheScaduteInIstruttoriaTecnico"); - numPraticheScaduteInAttesaIntegrazione = dbResult.get("numPraticheScaduteInAttesaIntegrazione"); + + Map dbResult=ReportEngineServiceUtil.praticheAperte(dateMax,groupId,tipoPraticaSelected); + + numPraticheOrdInIstruttoriaTecnico=dbResult.get("numPraticheOrdInIstruttoriaTecnico"); + numPraticheOrdInAttesaIntegrazione=dbResult.get("numPraticheOrdInAttesaIntegrazione"); + + numPraticheInScadenzaInIstruttoriaTecnico=dbResult.get("numPraticheInScadenzaInIstruttoriaTecnico"); + numPraticheInScadenzaInAttesaIntegrazione=dbResult.get("numPraticheInScadenzaInAttesaIntegrazione"); + + numPraticheScaduteInIstruttoriaTecnico=dbResult.get("numPraticheScaduteInIstruttoriaTecnico"); + numPraticheScaduteInAttesaIntegrazione=dbResult.get("numPraticheScaduteInAttesaIntegrazione"); + + totPraticheAperteFinePeriodo += dbResult.get("totPraticheAperteFinePeriodo"); + numeroPraticheDaAssegnareColumnTOTALE += numeroPraticheDaAssegnareColumn; numeroPraticheDaApprovareColumnTOTALE += numeroPraticheDaApprovareColumn; + numPraticheOrdInIstruttoriaTecnicoTOTALE += numPraticheOrdInIstruttoriaTecnico; numPraticheOrdInAttesaIntegrazioneTOTALE += numPraticheOrdInAttesaIntegrazione; numPraticheInScadenzaInIstruttoriaTecnicoTOTALE += numPraticheInScadenzaInIstruttoriaTecnico; numPraticheInScadenzaInAttesaIntegrazioneTOTALE += numPraticheInScadenzaInAttesaIntegrazione; numPraticheScaduteInIstruttoriaTecnicoTOTALE += numPraticheScaduteInIstruttoriaTecnico; numPraticheScaduteInAttesaIntegrazioneTOTALE += numPraticheScaduteInAttesaIntegrazione; - dataSource.add(org.getName(), numeroPraticheDaAssegnareColumn, numeroPraticheDaApprovareColumn, - numPraticheOrdInIstruttoriaTecnico, numPraticheOrdInAttesaIntegrazione, - numPraticheInScadenzaInIstruttoriaTecnico, numPraticheInScadenzaInAttesaIntegrazione, - numPraticheScaduteInIstruttoriaTecnico, numPraticheScaduteInAttesaIntegrazione); + + dataSource.add(org.getName(), + numeroPraticheDaAssegnareColumn, + numeroPraticheDaApprovareColumn, + + numPraticheOrdInIstruttoriaTecnico, + numPraticheOrdInAttesaIntegrazione, + + numPraticheInScadenzaInIstruttoriaTecnico, + numPraticheInScadenzaInAttesaIntegrazione, + numPraticheScaduteInIstruttoriaTecnico, + numPraticheScaduteInAttesaIntegrazione); + } } + + _log.info("totPraticheAperteFinePeriodo= " + totPraticheAperteFinePeriodo); - dataSource.add("TOTALI", numeroPraticheDaAssegnareColumnTOTALE, numeroPraticheDaApprovareColumnTOTALE, - numPraticheOrdInIstruttoriaTecnicoTOTALE, numPraticheOrdInAttesaIntegrazioneTOTALE, + dataSource.add("TOTALI", + numeroPraticheDaAssegnareColumnTOTALE, + numeroPraticheDaApprovareColumnTOTALE, + numPraticheOrdInIstruttoriaTecnicoTOTALE, + numPraticheOrdInAttesaIntegrazioneTOTALE, numPraticheInScadenzaInIstruttoriaTecnicoTOTALE, - numPraticheInScadenzaInAttesaIntegrazioneTOTALE, numPraticheScaduteInIstruttoriaTecnicoTOTALE, - numPraticheScaduteInAttesaIntegrazioneTOTALE); + numPraticheInScadenzaInAttesaIntegrazioneTOTALE, + numPraticheScaduteInIstruttoriaTecnicoTOTALE, + numPraticheScaduteInAttesaIntegrazioneTOTALE + ); } - } catch (ParseException | PortalException | SystemException e) { + } catch (SystemException e) { + _log.error(e, e); + } catch (PortalException e) { + _log.error(e, e); + } catch (ParseException e) { _log.error(e, e); } + return dataSource; } @@ -194,38 +221,41 @@ public class ReportScadenzarioIstruttorie implements PortosReportInterface { @Override public List getSearchFields() { - List listaFields = new ArrayList(); + listaFields.add(new PortosSearchTermsReport(1, FieldType.DATE, "dateMax")); + List lista = new ArrayList<>(); lista.add("Autorizzazioni"); lista.add("Depositi a controllo obbligatorio"); lista.add("Sanatorie"); + listaFields.add(new PortosSearchTermsReport(3, FieldType.SELECT, "tipologiaPratica", lista)); + return listaFields; } @Override public boolean isCVSEnabled() { - return true; } @Override public boolean isPDFEnabled() { - return false; } @Override public boolean isExcelEnabled() { - return true; } @Override public boolean isWordEnabled() { - return false; } -} \ No newline at end of file + + // + + +} diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportTempisticheIstruttorie.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportTempisticheIstruttorie.java index 4948b61f..3ef14288 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportTempisticheIstruttorie.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/ReportTempisticheIstruttorie.java @@ -1,9 +1,11 @@ package it.tref.portos.report.engine; +import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.portos.report.engine.PortosSearchTermsReport.FieldType; import it.tref.portos.report.engine.annotation.PortosReport; import it.tref.portos.report.engine.template.TemplatesADV; import it.tref.portos.report.engine.util.ReportEngineServiceUtil; +import it.tref.portos.report.engine.util.ReportTempisticheBean; import java.io.ByteArrayOutputStream; import java.text.ParseException; @@ -11,8 +13,10 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletRequest; @@ -32,166 +36,193 @@ import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.model.Organization; import com.liferay.portal.service.OrganizationLocalServiceUtil; +//Task 33557 @PortosReport public class ReportTempisticheIstruttorie implements PortosReportInterface { private static Log _log = LogFactoryUtil.getLog(ReportTempisticheIstruttorie.class); - private static final SimpleDateFormat SDF = new SimpleDateFormat("dd/MM/yyyy"); - + private static final SimpleDateFormat SDF = new SimpleDateFormat("dd/MM/yyyy"); + private static final String nota1 = "(1): somma dei tempi di istruttoria della pratica da parte dei tecnici della sismica (prima istruttoria e istruttoria delle integrazioni)"; private static final String nota2 = "(2): durata in giorni, tra l'inizio del procedimento e la conclusione del procedimento, ovvero durata dell'istruttoria e dei tempi di trasmissione delle integrazioni richieste"; - + @Override public String generateHTML(HttpServletRequest httpServletRequest) { + String html = ""; - String html = StringPool.BLANK; - try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - JasperHtmlExporterBuilder htmlExporter = DynamicReports.export.htmlExporter(bos).setIgnoreHyperLink(true); - JasperReportBuilder builder = generateReport(httpServletRequest); - builder.pageFooter(DynamicReports.cmp.pageNumber().setStyle(TemplatesADV.boldCenteredStyle)); - builder.toHtml(htmlExporter); - byte[] byteArray = bos.toByteArray(); - html = new String(byteArray); - } catch (DRException e) { - _log.error(e, e); - } - return html; + try { + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + JasperHtmlExporterBuilder htmlExporter = DynamicReports.export.htmlExporter(bos).setIgnoreHyperLink(true); + + JasperReportBuilder builder = generateReport(httpServletRequest); + builder.pageFooter(DynamicReports.cmp.pageNumber().setStyle(TemplatesADV.boldCenteredStyle)); + builder.toHtml(htmlExporter); + + byte[] byteArray = bos.toByteArray(); + html = new String(byteArray); + + } catch (DRException e) { + _log.error(e, e); + } + + return html; } @Override public JasperReportBuilder generateReport(HttpServletRequest request) { - String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null); - TextColumnBuilder presidioColumn = DynamicReports.col.column("Presidio", "presidio", - DynamicReports.type.stringType()); - TextColumnBuilder numeroPraticheTotaliColumn = DynamicReports.col.column("N° Pratiche Totali", - "numeroPraticheTotaliColumn", DynamicReports.type.integerType()); - TextColumnBuilder numeroTotaleAutorizzateInScadenzaColumn = DynamicReports.col.column("Numero Totale", - "numeroTotaleAutorizzateInScadenzaColumn", DynamicReports.type.integerType()); - TextColumnBuilder numeroTotaleAutorizzateScaduteColumn = DynamicReports.col.column("Numero Totale", - "numeroTotaleAutorizzateScaduteColumn", DynamicReports.type.integerType()); - TextColumnBuilder durataMediaIstruttorieInScadenzaColumn = DynamicReports.col.column( - "Durata media istruttorie (1)", "durataMediaIstruttorieInScadenzaColumn", - DynamicReports.type.floatType()); - TextColumnBuilder durataMediaIstruttorieScaduteColumn = DynamicReports.col.column( - "Durata media istruttorie (1)", "durataMediaIstruttorieScaduteColumn", DynamicReports.type.floatType()); - TextColumnBuilder durataMediaApprovazionePraticaInScadenzaColumn = DynamicReports.col.column( - "Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaInScadenzaColumn", - DynamicReports.type.floatType()); - TextColumnBuilder durataMediaApprovazionePraticaScaduteColumn = DynamicReports.col.column( - "Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaScaduteColumn", - DynamicReports.type.floatType()); - ColumnTitleGroupBuilder titleGroupInScadenza = DynamicReports.grid.titleGroup(tipoPraticaSelected - + " T <= 60 gg", numeroTotaleAutorizzateInScadenzaColumn, durataMediaIstruttorieInScadenzaColumn, - durataMediaApprovazionePraticaInScadenzaColumn); - ColumnTitleGroupBuilder titleGroupScadute = DynamicReports.grid.titleGroup(tipoPraticaSelected + " T > 60 gg", - numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn, - durataMediaApprovazionePraticaScaduteColumn); - TextFieldBuilder note1 = DynamicReports.cmp.text(nota1); - TextFieldBuilder note2 = DynamicReports.cmp.text(nota2); + + TextColumnBuilder presidioColumn = + DynamicReports.col.column("Presidio", "presidio", DynamicReports.type.stringType()); + TextColumnBuilder numeroPraticheTotaliColumn = + DynamicReports.col.column("N° Pratiche Totali", "numeroPraticheTotaliColumn", DynamicReports.type.integerType()); + + TextColumnBuilder numeroTotaleAutorizzateInScadenzaColumn = + DynamicReports.col.column("Numero Totale", "numeroTotaleAutorizzateInScadenzaColumn", DynamicReports.type.integerType()); + TextColumnBuilder numeroTotaleAutorizzateScaduteColumn = + DynamicReports.col.column("Numero Totale", "numeroTotaleAutorizzateScaduteColumn", DynamicReports.type.integerType()); + + TextColumnBuilder durataMediaIstruttorieInScadenzaColumn = + DynamicReports.col.column("Durata media istruttorie (1)", "durataMediaIstruttorieInScadenzaColumn", DynamicReports.type.floatType()); + TextColumnBuilder durataMediaIstruttorieScaduteColumn = + DynamicReports.col.column("Durata media istruttorie (1)", "durataMediaIstruttorieScaduteColumn", DynamicReports.type.floatType()); + + TextColumnBuilder durataMediaApprovazionePraticaInScadenzaColumn = + DynamicReports.col.column("Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaInScadenzaColumn", DynamicReports.type.floatType()); + TextColumnBuilder durataMediaApprovazionePraticaScaduteColumn = + DynamicReports.col.column("Durata media approvazione della pratica (2)", "durataMediaApprovazionePraticaScaduteColumn", DynamicReports.type.floatType()); + + ColumnTitleGroupBuilder titleGroupInScadenza = + DynamicReports.grid.titleGroup(tipoPraticaSelected + " T <= 60 gg", numeroTotaleAutorizzateInScadenzaColumn, durataMediaIstruttorieInScadenzaColumn, durataMediaApprovazionePraticaInScadenzaColumn); + + ColumnTitleGroupBuilder titleGroupScadute = + DynamicReports.grid.titleGroup(tipoPraticaSelected + " T > 60 gg", numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn, durataMediaApprovazionePraticaScaduteColumn); + + TextFieldBuilder note1 = + DynamicReports.cmp.text(nota1); + TextFieldBuilder note2 = + DynamicReports.cmp.text(nota2); note1.setStyle(DynamicReports.stl.style(TemplatesADV.rootStyle).setFontSize(6)); note2.setStyle(DynamicReports.stl.style(TemplatesADV.rootStyle).setFontSize(6)); - JasperReportBuilder builder = DynamicReports - .report() - .setTemplate(TemplatesADV.reportTemplate) - .pageFooter(note1, note2) - .columnGrid(presidioColumn, numeroPraticheTotaliColumn, titleGroupInScadenza, titleGroupScadute) - .columns(presidioColumn, numeroPraticheTotaliColumn, numeroTotaleAutorizzateInScadenzaColumn, - durataMediaIstruttorieInScadenzaColumn, durataMediaApprovazionePraticaInScadenzaColumn, - numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn, - durataMediaApprovazionePraticaScaduteColumn).setDataSource(createDataSource(request)) - .addProperty("net.sf.jasperreports.export.xls.detect.cell.type", "true"); + + JasperReportBuilder builder = + DynamicReports.report().setTemplate(TemplatesADV.reportTemplate) + .pageFooter(note1, note2) + .columnGrid(presidioColumn, numeroPraticheTotaliColumn, titleGroupInScadenza, titleGroupScadute) + .columns(presidioColumn, numeroPraticheTotaliColumn + , numeroTotaleAutorizzateInScadenzaColumn, durataMediaIstruttorieInScadenzaColumn, durataMediaApprovazionePraticaInScadenzaColumn + , numeroTotaleAutorizzateScaduteColumn, durataMediaIstruttorieScaduteColumn, durataMediaApprovazionePraticaScaduteColumn) + .setDataSource(createDataSource(request)).addProperty("net.sf.jasperreports.export.xls.detect.cell.type", "true");; + return builder; } private JRDataSource createDataSource(HttpServletRequest request) { - - DRDataSource dataSource = new DRDataSource("presidio", "numeroPraticheTotaliColumn", - "numeroTotaleAutorizzateInScadenzaColumn", "durataMediaIstruttorieInScadenzaColumn", - "durataMediaApprovazionePraticaInScadenzaColumn", "numeroTotaleAutorizzateScaduteColumn", - "durataMediaIstruttorieScaduteColumn", "durataMediaApprovazionePraticaScaduteColumn"); + DRDataSource dataSource = + new DRDataSource("presidio", "numeroPraticheTotaliColumn" + , "numeroTotaleAutorizzateInScadenzaColumn", "durataMediaIstruttorieInScadenzaColumn", "durataMediaApprovazionePraticaInScadenzaColumn" + , "numeroTotaleAutorizzateScaduteColumn", "durataMediaIstruttorieScaduteColumn", "durataMediaApprovazionePraticaScaduteColumn"); + try { String dateMinString = ParamUtil.getString(request, "dateMin", null); String dateMaxString = ParamUtil.getString(request, "dateMax", null); String tipoPraticaSelected = ParamUtil.getString(request, "tipologiaPratica", null); + if (dateMinString != null && dateMaxString != null && tipoPraticaSelected != null) { + Date dateMin = SDF.parse(dateMinString); Date dateMax = SDF.parse(dateMaxString); + Calendar calendarMin = Calendar.getInstance(); calendarMin.setTime(dateMin); calendarMin.set(Calendar.HOUR_OF_DAY, 1); - dateMin = calendarMin.getTime(); + dateMin = calendarMin.getTime(); + Calendar calendarMax = Calendar.getInstance(); calendarMax.setTime(dateMax); calendarMax.set(Calendar.HOUR_OF_DAY, 23); dateMax = calendarMax.getTime(); + List orgs = new ArrayList(); orgs = OrganizationLocalServiceUtil.getOrganizations(QueryUtil.ALL_POS, QueryUtil.ALL_POS); - int numeroPraticheTotaliTotale = 0; - int numeroTotaleAutorizzateInScadenzaTotale = 0; - float durataMediaIstruttorieInScadenzaTotale = 0; - float durataMediaApprovazionePraticaInScadenzaTotale = 0; - int numeroTotaleAutorizzateScaduteTotale = 0; - float durataMediaIstruttorieScaduteTotale = 0; - float durataMediaApprovazionePraticaScaduteTotale = 0; + + int numeroPraticheTotaliTotale = 0; + int numeroTotaleAutorizzateInScadenzaTotale = 0; + float durataMediaIstruttorieInScadenzaTotale = 0; + float durataMediaApprovazionePraticaInScadenzaTotale = 0; + int numeroTotaleAutorizzateScaduteTotale = 0; + float durataMediaIstruttorieScaduteTotale = 0; + float durataMediaApprovazionePraticaScaduteTotale = 0; + int countOrganization = 0; int countOrganizationPraticheInScadenza = 0; int countOrganizationPraticheScadute = 0; + for (Organization org : orgs) { if (org.getParentOrganization() != null) { long groupId = org.getGroup().getGroupId(); - Map dbResult = ReportEngineServiceUtil.praticheChiuse(dateMin, dateMax, groupId, - tipoPraticaSelected); - int numeroPraticheTotali = dbResult.get("count").intValue(); - int numeroTotaleAutorizzateInScadenza = dbResult.get("countOrdinarie").intValue(); + + + //Retrieve data from DB + //Map dbResult=elaboraAutorizzazioniNew(dateMin,dateMax,groupId,tipoPraticaSelected); + Map dbResult=ReportEngineServiceUtil.praticheChiuse(dateMin, dateMax, groupId, tipoPraticaSelected); + + + int numeroPraticheTotali =dbResult.get("count").intValue(); + int numeroTotaleAutorizzateInScadenza = dbResult.get("countOrdinarie").intValue(); int numeroTotaleAutorizzateScadute = dbResult.get("countScadute").intValue(); - float durataMediaIstruttorieInScadenza = dbResult.get("countOrdinarie") > 0 ? dbResult - .get("giorniTotOrdinarieIstruttorie") / dbResult.get("countOrdinarie") : 0; - float durataMediaApprovazionePraticaInScadenza = dbResult.get("countOrdinarie") > 0 ? dbResult - .get("giorniTotOrdinarieApprovazioni") / dbResult.get("countOrdinarie") : 0; - float durataMediaIstruttorieScadute = dbResult.get("countScadute") > 0 ? dbResult - .get("giorniTotScaduteIstruttorie") / dbResult.get("countScadute") : 0; - float durataMediaApprovazionePraticaScadute = dbResult.get("countScadute") > 0 ? dbResult - .get("giorniTotScaduteApprovazioni") / dbResult.get("countScadute") : 0; - dataSource.add(org.getName(), numeroPraticheTotali, numeroTotaleAutorizzateInScadenza, - durataMediaIstruttorieInScadenza, durataMediaApprovazionePraticaInScadenza, - numeroTotaleAutorizzateScadute, durataMediaIstruttorieScadute, - durataMediaApprovazionePraticaScadute); - numeroPraticheTotaliTotale += numeroPraticheTotali; - numeroTotaleAutorizzateInScadenzaTotale += numeroTotaleAutorizzateInScadenza; - numeroTotaleAutorizzateScaduteTotale += numeroTotaleAutorizzateScadute; - durataMediaApprovazionePraticaInScadenzaTotale += durataMediaApprovazionePraticaInScadenza; - durataMediaApprovazionePraticaScaduteTotale += durataMediaApprovazionePraticaScadute; - durataMediaIstruttorieInScadenzaTotale += durataMediaIstruttorieInScadenza; - durataMediaIstruttorieScaduteTotale += durataMediaIstruttorieScadute; - if (numeroTotaleAutorizzateInScadenza > 0) { - countOrganizationPraticheInScadenza++; - } - if (numeroTotaleAutorizzateScadute > 0) { - countOrganizationPraticheScadute++; - } + + float durataMediaIstruttorieInScadenza =dbResult.get("countOrdinarie")>0? dbResult.get("giorniTotOrdinarieIstruttorie")/dbResult.get("countOrdinarie"):0; + float durataMediaApprovazionePraticaInScadenza =dbResult.get("countOrdinarie")>0? dbResult.get("giorniTotOrdinarieApprovazioni")/dbResult.get("countOrdinarie"):0; + + float durataMediaIstruttorieScadute = dbResult.get("countScadute")>0?dbResult.get("giorniTotScaduteIstruttorie")/dbResult.get("countScadute"):0; + float durataMediaApprovazionePraticaScadute =dbResult.get("countScadute")>0?dbResult.get("giorniTotScaduteApprovazioni")/dbResult.get("countScadute"):0; + + dataSource.add(org.getName(), numeroPraticheTotali + , numeroTotaleAutorizzateInScadenza, durataMediaIstruttorieInScadenza, durataMediaApprovazionePraticaInScadenza + , numeroTotaleAutorizzateScadute, durataMediaIstruttorieScadute, durataMediaApprovazionePraticaScadute); + + numeroPraticheTotaliTotale+=numeroPraticheTotali; + numeroTotaleAutorizzateInScadenzaTotale+=numeroTotaleAutorizzateInScadenza; + numeroTotaleAutorizzateScaduteTotale+=numeroTotaleAutorizzateScadute; + durataMediaApprovazionePraticaInScadenzaTotale+=durataMediaApprovazionePraticaInScadenza; + durataMediaApprovazionePraticaScaduteTotale+=durataMediaApprovazionePraticaScadute; + durataMediaIstruttorieInScadenzaTotale+=durataMediaIstruttorieInScadenza; + durataMediaIstruttorieScaduteTotale+=durataMediaIstruttorieScadute; + + + if (numeroTotaleAutorizzateInScadenza>0) + countOrganizationPraticheInScadenza++; + if (numeroTotaleAutorizzateScadute>0) + countOrganizationPraticheScadute++; + + + countOrganization++; } } - dataSource.add("TOTALI", numeroPraticheTotaliTotale, numeroTotaleAutorizzateInScadenzaTotale, - countOrganizationPraticheInScadenza > 0 ? durataMediaIstruttorieInScadenzaTotale - / countOrganizationPraticheInScadenza : 0, - countOrganizationPraticheInScadenza > 0 ? durataMediaApprovazionePraticaInScadenzaTotale - / countOrganizationPraticheInScadenza : 0, numeroTotaleAutorizzateScaduteTotale, - countOrganizationPraticheScadute > 0 ? durataMediaIstruttorieScaduteTotale - / countOrganizationPraticheScadute : 0, - countOrganizationPraticheScadute > 0 ? durataMediaApprovazionePraticaScaduteTotale - / countOrganizationPraticheScadute : 0); + + dataSource.add("TOTALI", numeroPraticheTotaliTotale, numeroTotaleAutorizzateInScadenzaTotale, + countOrganizationPraticheInScadenza>0?durataMediaIstruttorieInScadenzaTotale/countOrganizationPraticheInScadenza:0, + countOrganizationPraticheInScadenza>0?durataMediaApprovazionePraticaInScadenzaTotale/countOrganizationPraticheInScadenza:0, + numeroTotaleAutorizzateScaduteTotale, + countOrganizationPraticheScadute>0?durataMediaIstruttorieScaduteTotale/countOrganizationPraticheScadute:0, + countOrganizationPraticheScadute>0?durataMediaApprovazionePraticaScaduteTotale/countOrganizationPraticheScadute:0); } - } catch (ParseException | PortalException | SystemException e) { + } catch (SystemException e) { + _log.error(e, e); + } catch (PortalException e) { + _log.error(e, e); + } catch (ParseException e) { _log.error(e, e); } + return dataSource; } - + @Override public String getTitle() { return "Report Tempistiche Istruttorie"; @@ -199,40 +230,40 @@ public class ReportTempisticheIstruttorie implements PortosReportInterface { @Override public List getSearchFields() { - List listaFields = new ArrayList(); - listaFields.add(new PortosSearchTermsReport(1, FieldType.DATE, "dateMin")); - listaFields.add(new PortosSearchTermsReport(2, FieldType.DATE, "dateMax")); - List lista = new ArrayList<>(); - lista.add("Autorizzazioni"); - lista.add("Depositi a controllo obbligatorio"); - lista.add("Depositi a sorteggio"); - lista.add("Sanatorie"); - listaFields.add(new PortosSearchTermsReport(3, FieldType.SELECT, "tipologiaPratica", lista)); - return listaFields; + + listaFields.add(new PortosSearchTermsReport(1, FieldType.DATE, "dateMin")); + listaFields.add(new PortosSearchTermsReport(2, FieldType.DATE, "dateMax")); + + List lista = new ArrayList<>(); + lista.add("Autorizzazioni"); + lista.add("Depositi a controllo obbligatorio"); + lista.add("Depositi a sorteggio"); + lista.add("Sanatorie"); + + listaFields.add(new PortosSearchTermsReport(3, FieldType.SELECT, "tipologiaPratica", lista)); + + return listaFields; } @Override public boolean isCVSEnabled() { - return true; } @Override public boolean isPDFEnabled() { - return false; } @Override public boolean isExcelEnabled() { - return true; } @Override public boolean isWordEnabled() { - return false; - } -} \ No newline at end of file + } + +} diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/template/TemplatesADV.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/template/TemplatesADV.java index a6e4d87f..eef2d839 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/template/TemplatesADV.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/template/TemplatesADV.java @@ -12,6 +12,8 @@ import java.util.Locale; import javax.servlet.http.HttpServletRequest; +import com.liferay.portal.kernel.util.ParamUtil; + import net.sf.dynamicreports.report.base.expression.AbstractValueFormatter; import net.sf.dynamicreports.report.builder.HyperLinkBuilder; import net.sf.dynamicreports.report.builder.ReportTemplateBuilder; @@ -26,148 +28,177 @@ import net.sf.dynamicreports.report.constant.SplitType; import net.sf.dynamicreports.report.constant.VerticalTextAlignment; import net.sf.dynamicreports.report.definition.ReportParameters; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.kernel.util.StringPool; - public class TemplatesADV { - public static final StyleBuilder rootStyle; - public static final StyleBuilder rootCenterStyle; - - public static final StyleBuilder boldStyle; - - public static final StyleBuilder italicStyle; - public static final StyleBuilder boldCenteredStyle; - public static final StyleBuilder bold11CenteredStyle; - public static final StyleBuilder bold15CenteredStyle; - public static final StyleBuilder columnStyle; - public static final StyleBuilder columnTitleStyle; - public static final StyleBuilder groupStyle; - public static final StyleBuilder subtotalStyle; - - public static final ReportTemplateBuilder reportTemplate; - public static final CurrencyType currencyType; - public static final ComponentBuilder dynamicReportsComponent; - public static final ComponentBuilder footerComponent; - - static { - BorderBuilder border = stl.border(); - border.setBottomPen(stl.penThin().setLineColor(new Color(129, 33, 33))) - .setLeftPen(stl.penThin().setLineColor(new Color(129, 33, 33))) - .setTopPen(stl.penThin().setLineColor(new Color(129, 33, 33))) - .setRightPen(stl.penThin().setLineColor(new Color(129, 33, 33))); - - rootStyle = stl.style().setPadding(2).setFontSize(7); - rootCenterStyle = stl.style(rootStyle).setTextAlignment(HorizontalTextAlignment.CENTER, - VerticalTextAlignment.MIDDLE); - - boldStyle = stl.style(rootStyle).bold().setFontSize(7); - italicStyle = stl.style(rootStyle).italic().setFontSize(7); - boldCenteredStyle = stl.style(boldStyle) - .setTextAlignment(HorizontalTextAlignment.CENTER, VerticalTextAlignment.MIDDLE).setFontSize(7); - bold11CenteredStyle = stl.style(boldCenteredStyle).setFontSize(11).setForegroundColor(new Color(129, 33, 33)); - bold15CenteredStyle = stl.style(boldCenteredStyle).setFontSize(15).setForegroundColor(new Color(129, 33, 33)); - columnStyle = stl.style(rootCenterStyle).setVerticalTextAlignment(VerticalTextAlignment.TOP).setBorder(border); - columnTitleStyle = stl.style(columnStyle).setBorder(stl.pen2Point()) - .setHorizontalTextAlignment(HorizontalTextAlignment.CENTER).setBackgroundColor(Color.WHITE).bold() - .setForegroundColor(new Color(129, 33, 33)).italic(); - groupStyle = stl.style(boldStyle).setHorizontalTextAlignment(HorizontalTextAlignment.LEFT); - subtotalStyle = stl.style(boldStyle).setTopBorder(stl.pen1Point()); - - StyleBuilder crosstabGroupStyle = stl.style(columnTitleStyle); - StyleBuilder crosstabGroupTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(170, 170, 170)); - StyleBuilder crosstabGrandTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(140, 140, 140)); - StyleBuilder crosstabCellStyle = stl.style(columnStyle).setBorder(stl.pen1Point()); - TableOfContentsCustomizerBuilder tableOfContentsCustomizer = tableOfContentsCustomizer().setHeadingStyle(0, - stl.style(rootStyle).bold()); - - reportTemplate = template().setLocale(Locale.ENGLISH).setColumnStyle(columnStyle) - .setColumnTitleStyle(columnTitleStyle).setGroupStyle(groupStyle).setGroupTitleStyle(groupStyle) - .setSubtotalStyle(subtotalStyle).highlightDetailEvenRows().crosstabHighlightEvenRows() - .setCrosstabGroupStyle(crosstabGroupStyle).setCrosstabGroupTotalStyle(crosstabGroupTotalStyle) - .setCrosstabGrandTotalStyle(crosstabGrandTotalStyle).setCrosstabCellStyle(crosstabCellStyle) - .setTableOfContentsCustomizer(tableOfContentsCustomizer).setDefaultSplitType(SplitType.PREVENT) - .setDetailSplitType(SplitType.PREVENT); - currencyType = new CurrencyType(); - - HyperLinkBuilder link = hyperLink(StringPool.BLANK); - - dynamicReportsComponent = cmp.horizontalList( - cmp.verticalList( - cmp.text("GENIO CIVILE").setStyle(bold15CenteredStyle) - .setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text(StringPool.BLANK) - .setStyle(italicStyle).setHyperLink(link))).setFixedWidth(300); - footerComponent = cmp.pageXofY().setStyle(stl.style(boldCenteredStyle).setTopBorder(stl.pen1Point())); - } - - // Creates custom component which is possible to add to any report band component - public static ComponentBuilder createTitleComponent(String label) { - - HorizontalListBuilder horizontalListBuilder = cmp.horizontalList(); - horizontalListBuilder.add(dynamicReportsComponent, cmp.text(label).setStyle(bold15CenteredStyle) - .setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT)); - horizontalListBuilder.newRow(); - return horizontalListBuilder; - } - - // ADT: BUG BO ID=34 - REPORT PRATICHE VIDIMATE - public static ComponentBuilder createTitleComponentNew(String label, String className, - HttpServletRequest request) { - - if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())) { - HorizontalListBuilder horizontalListBuilder = cmp.horizontalList(); - HyperLinkBuilder link = hyperLink(StringPool.BLANK); - StringBuilder stBuilder = new StringBuilder(); - if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())) { - String dateMinString = ParamUtil.getString(request, "dateMin", null); - String dateMaxString = ParamUtil.getString(request, "dateMax", null); - stBuilder.append("Periodo di Osservazione: dal "); - stBuilder.append(dateMinString); - stBuilder.append(" al "); - stBuilder.append(dateMaxString); - } - ComponentBuilder dynamicReportsComponentNew = cmp.horizontalList( - cmp.verticalList(cmp.text(stBuilder.toString()).setStyle(bold15CenteredStyle) - .setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text(StringPool.BLANK) - .setStyle(italicStyle).setHyperLink(link))).setFixedWidth(300); - horizontalListBuilder.add(dynamicReportsComponentNew, cmp.text(label).setStyle(bold15CenteredStyle) - .setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT)); - horizontalListBuilder.newRow(); - return horizontalListBuilder; - } else { - return null; - } - } - - public static CurrencyValueFormatter createCurrencyValueFormatter(String label) { - - return new CurrencyValueFormatter(label); - } - - public static class CurrencyType extends BigDecimalType { - - private static final long serialVersionUID = 1L; - - @Override - public String getPattern() { - - return "€ #.###,00"; - } - } - - private static class CurrencyValueFormatter extends AbstractValueFormatter { - - private static final long serialVersionUID = 1L; - private String label; - - public CurrencyValueFormatter(String label) { - - this.label = label; - } - - @Override - public String format(Number value, ReportParameters reportParameters) { - return label + currencyType.valueToString(value, reportParameters.getLocale()); - } - } -} \ No newline at end of file + public static final StyleBuilder rootStyle; + public static final StyleBuilder rootCenterStyle; + + public static final StyleBuilder boldStyle; + + public static final StyleBuilder italicStyle; + public static final StyleBuilder boldCenteredStyle; + public static final StyleBuilder bold11CenteredStyle; + public static final StyleBuilder bold15CenteredStyle; + public static final StyleBuilder columnStyle; + public static final StyleBuilder columnTitleStyle; + public static final StyleBuilder groupStyle; + public static final StyleBuilder subtotalStyle; + + + public static final ReportTemplateBuilder reportTemplate; + public static final CurrencyType currencyType; + public static final ComponentBuilder dynamicReportsComponent; + public static final ComponentBuilder footerComponent; + + static { + BorderBuilder border = stl.border(); + border.setBottomPen(stl.penThin().setLineColor(new Color(129, 33, 33))) + .setLeftPen(stl.penThin().setLineColor(new Color(129, 33, 33))) + .setTopPen(stl.penThin().setLineColor(new Color(129, 33, 33))) + .setRightPen(stl.penThin().setLineColor(new Color(129, 33, 33))); + + rootStyle = stl.style().setPadding(2).setFontSize(7); + rootCenterStyle = + stl.style(rootStyle).setTextAlignment(HorizontalTextAlignment.CENTER, VerticalTextAlignment.MIDDLE); + + boldStyle = stl.style(rootStyle).bold().setFontSize(7); + italicStyle = stl.style(rootStyle).italic().setFontSize(7); + boldCenteredStyle = + stl.style(boldStyle).setTextAlignment(HorizontalTextAlignment.CENTER, VerticalTextAlignment.MIDDLE) + .setFontSize(7); + bold11CenteredStyle = stl.style(boldCenteredStyle).setFontSize(11).setForegroundColor(new Color(129, 33, 33)); + bold15CenteredStyle = stl.style(boldCenteredStyle).setFontSize(15).setForegroundColor(new Color(129, 33, 33)); + columnStyle = stl.style(rootCenterStyle).setVerticalTextAlignment(VerticalTextAlignment.TOP).setBorder(border); + columnTitleStyle = + stl.style(columnStyle).setBorder(stl.pen2Point()).setHorizontalTextAlignment(HorizontalTextAlignment.CENTER) + .setBackgroundColor(Color.WHITE).bold().setForegroundColor(new Color(129, 33, 33)).italic(); + groupStyle = stl.style(boldStyle).setHorizontalTextAlignment(HorizontalTextAlignment.LEFT); + subtotalStyle = stl.style(boldStyle).setTopBorder(stl.pen1Point()); + + StyleBuilder crosstabGroupStyle = stl.style(columnTitleStyle); + StyleBuilder crosstabGroupTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(170, 170, 170)); + StyleBuilder crosstabGrandTotalStyle = stl.style(columnTitleStyle).setBackgroundColor(new Color(140, 140, 140)); + StyleBuilder crosstabCellStyle = stl.style(columnStyle).setBorder(stl.pen1Point()); + TableOfContentsCustomizerBuilder tableOfContentsCustomizer = + tableOfContentsCustomizer().setHeadingStyle(0, stl.style(rootStyle).bold()); + + reportTemplate = + template().setLocale(Locale.ENGLISH).setColumnStyle(columnStyle).setColumnTitleStyle(columnTitleStyle) + .setGroupStyle(groupStyle).setGroupTitleStyle(groupStyle).setSubtotalStyle(subtotalStyle) + .highlightDetailEvenRows().crosstabHighlightEvenRows().setCrosstabGroupStyle(crosstabGroupStyle) + .setCrosstabGroupTotalStyle(crosstabGroupTotalStyle).setCrosstabGrandTotalStyle(crosstabGrandTotalStyle) + .setCrosstabCellStyle(crosstabCellStyle).setTableOfContentsCustomizer(tableOfContentsCustomizer) + .setDefaultSplitType(SplitType.PREVENT).setDetailSplitType(SplitType.PREVENT); + currencyType = new CurrencyType(); + + HyperLinkBuilder link = hyperLink(""); + + dynamicReportsComponent = + cmp.horizontalList( + // cmp.image(TemplatesADV.class.getResource("images/aaa.png")).setFixedDimension(60, 60), + cmp.verticalList( + cmp.text("GENIO CIVILE").setStyle(bold15CenteredStyle) + .setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text("").setStyle(italicStyle) + .setHyperLink(link))).setFixedWidth(300); + footerComponent = cmp.pageXofY().setStyle(stl.style(boldCenteredStyle).setTopBorder(stl.pen1Point())); + + } + + /** + * + * Creates custom component which is possible to add to any report band component + */ + + public static ComponentBuilder createTitleComponent(String label) { + HorizontalListBuilder horizontalListBuilder = cmp.horizontalList(); + horizontalListBuilder.add(dynamicReportsComponent, cmp.text(label).setStyle(bold15CenteredStyle) + .setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT)); + horizontalListBuilder.newRow(); + return horizontalListBuilder; + + } + + + /** + * ADT: BUG BO ID=34 – REPORT PRATICHE VIDIMATE + * + * @param label + * @param className + * @param request + * @return + */ + public static ComponentBuilder createTitleComponentNew(String label,String className,HttpServletRequest request) { + + + if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())){ + HorizontalListBuilder horizontalListBuilder = cmp.horizontalList(); + HyperLinkBuilder link = hyperLink(""); + StringBuilder stBuilder=new StringBuilder(); + if (className.equalsIgnoreCase(ReportPraticheVidimate.class.getName())){ + String dateMinString = ParamUtil.getString(request, "dateMin", null); + String dateMaxString = ParamUtil.getString(request, "dateMax", null); + stBuilder.append("Periodo di Osservazione: dal "); + stBuilder.append(dateMinString); + stBuilder.append(" al "); + stBuilder.append(dateMaxString); + } + ComponentBuilder dynamicReportsComponentNew = + cmp.horizontalList( + // cmp.image(TemplatesADV.class.getResource("images/aaa.png")).setFixedDimension(60, 60), + cmp.verticalList( + cmp.text(stBuilder.toString()).setStyle(bold15CenteredStyle) + .setHorizontalTextAlignment(HorizontalTextAlignment.LEFT), cmp.text("").setStyle(italicStyle) + .setHyperLink(link))).setFixedWidth(300); + + + horizontalListBuilder.add(dynamicReportsComponentNew, cmp.text(label).setStyle(bold15CenteredStyle) + .setHorizontalTextAlignment(HorizontalTextAlignment.RIGHT)); + horizontalListBuilder.newRow(); + return horizontalListBuilder; + + }else{ + return null; + } + + } + + public static CurrencyValueFormatter createCurrencyValueFormatter(String label) { + return new CurrencyValueFormatter(label); + } + + public static class CurrencyType extends BigDecimalType { + + private static final long serialVersionUID = 1L; + + @Override + public String getPattern() { + return "€ #.###,00"; + } + + } + + private static class CurrencyValueFormatter extends AbstractValueFormatter { + + private static final long serialVersionUID = 1L; + private String label; + + public CurrencyValueFormatter(String label) { + + this.label = label; + + } + + @Override + public String format(Number value, ReportParameters reportParameters) { + return label + currencyType.valueToString(value, reportParameters.getLocale()); + } + + } + + + + + + + +} diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/util/ReportEngineServiceUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/util/ReportEngineServiceUtil.java index 04a92f4a..c05aaed5 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/util/ReportEngineServiceUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-engine-portlet/docroot/WEB-INF/src/it/tref/portos/report/engine/util/ReportEngineServiceUtil.java @@ -1,5 +1,7 @@ package it.tref.portos.report.engine.util; +import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; + import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; @@ -11,8 +13,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; -import org.omg.CORBA.SystemException; - +import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; @@ -30,6 +31,7 @@ public class ReportEngineServiceUtil { } /** + * * Pratiche aperte alla data in input * * @param dateMax @@ -52,9 +54,8 @@ public class ReportEngineServiceUtil { String tipoDocumentoApprovato = co ? "CO" : "AU"; try { - // returnedList = IntPraticaLocalServiceUtil.reportPraticheVidimate(calendarStart.getTime(), dateMax, - // groupId, - // type); + returnedList = IntPraticaLocalServiceUtil.reportPraticheVidimate(calendarStart.getTime(), dateMax, groupId, + type); for (Object[] tmp : returnedList) { if (tmp.length == 8) { Long avvisoid = (Long) tmp[0]; @@ -153,12 +154,13 @@ public class ReportEngineServiceUtil { throws SystemException { Map> map = new HashMap>(); Map returnedMap = new HashMap(); - List returnedList = new ArrayList<>(); + List returnedList; boolean co = type.equalsIgnoreCase("Depositi a controllo obbligatorio"); + String tipoDocumentoApprovato = co ? "CO" : "AU"; try { - // returnedList = IntPraticaLocalServiceUtil.reportTempisticheIstruttorieAvvisiAutorizzazioni(dateMin, - // dateMax, groupId, type); + returnedList = IntPraticaLocalServiceUtil.reportTempisticheIstruttorieAvvisiAutorizzazioni(dateMin, + dateMax, groupId, type); for (Object[] tmp : returnedList) { if (tmp.length == 7) { Long avvisoid = (Long) tmp[0]; @@ -492,6 +494,7 @@ public class ReportEngineServiceUtil { } /** + * * @param dataEnd * @param dataStart * @return diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/liferay-display.xml b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/liferay-display.xml index 7b63619e..ce812348 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/liferay-display.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/liferay-display.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/service.xml b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/service.xml index eb52e37b..5ae00f1d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/service.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/service.xml @@ -1,28 +1,28 @@ - + - Walter Tommasi + Manifattura Web Group s.r.l. + Walter Tommasi portos_rep - - - - - - - - - + + + + + + + + + - + - + - - + + \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/HeaderFooterPageEvent.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/HeaderFooterPageEvent.java index 0cd178cd..3fdc07e5 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/HeaderFooterPageEvent.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/HeaderFooterPageEvent.java @@ -1,6 +1,5 @@ -package it.tref.liferay.portos.report.html.core; -import java.io.IOException; +package it.tref.liferay.portos.report.html.core; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; @@ -14,20 +13,25 @@ import com.itextpdf.tool.xml.ElementList; import com.itextpdf.tool.xml.XMLWorkerHelper; import com.liferay.portal.kernel.util.Validator; +import java.io.IOException; + public class HeaderFooterPageEvent extends PdfPageEventHelper { private ElementList header; private int headerHeight; + private ElementList footer; private int footerHeight; - public HeaderFooterPageEvent(String headerHtml, int headerHeight, String footerHtml, int footerHeight) - throws IOException { + public HeaderFooterPageEvent( + String headerHtml, int headerHeight, String footerHtml, int footerHeight) + throws IOException { if (Validator.isNotNull(headerHtml)) { this.header = XMLWorkerHelper.parseToElementList(headerHtml, null); this.headerHeight = headerHeight; } + if (Validator.isNotNull(footerHtml)) { this.footer = XMLWorkerHelper.parseToElementList(footerHtml, null); this.footerHeight = footerHeight; @@ -39,23 +43,30 @@ public class HeaderFooterPageEvent extends PdfPageEventHelper { try { ColumnText columnText = new ColumnText(writer.getDirectContent()); + if (Validator.isNotNull(header)) { - // columnText.setSimpleColumn(new Rectangle(36, 832, 559, 810)); - columnText.setSimpleColumn(new Rectangle(36, 832, 559, 832 - headerHeight)); + // columnText.setSimpleColumn(new Rectangle( + // 36, 832, 559, 810)); + columnText.setSimpleColumn(new Rectangle( + 36, 832, 559, 832 - headerHeight)); for (Element e : header) { columnText.addElement(e); } columnText.go(); } + if (Validator.isNotNull(footer)) { - // columnText.setSimpleColumn(new Rectangle(36, 10, 559, 32)); - columnText.setSimpleColumn(new Rectangle(36, 10, 559, 10 + footerHeight)); + // columnText.setSimpleColumn(new Rectangle( + // 36, 10, 559, 32)); + columnText.setSimpleColumn(new Rectangle( + 36, 10, 559, 10 + footerHeight)); for (Element e : footer) { columnText.addElement(e); } columnText.go(); } - } catch (DocumentException de) { + } + catch (DocumentException de) { throw new ExceptionConverter(de); } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/HtmlToPdfEngine.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/HtmlToPdfEngine.java index 0a417ff7..8e1bc965 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/HtmlToPdfEngine.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/HtmlToPdfEngine.java @@ -1,8 +1,5 @@ -package it.tref.liferay.portos.report.html.core; -import java.io.IOException; -import java.io.OutputStream; -import java.io.StringReader; +package it.tref.liferay.portos.report.html.core; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; @@ -23,15 +20,25 @@ import com.itextpdf.tool.xml.pipeline.html.HtmlPipelineContext; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; +import java.io.IOException; +import java.io.OutputStream; +import java.io.StringReader; + public final class HtmlToPdfEngine { - public void createPdfFile(String html, String[] css, String baseURL, String headerHtml, int headerHeight, - String footerHtml, int footerHeight, OutputStream outputStream) throws DocumentException, IOException { + public void createPdfFile( + String html, String[] css, String baseURL, String headerHtml, + int headerHeight, String footerHtml, int footerHeight, + OutputStream outputStream) + throws DocumentException, IOException { String htmlPage = createHtmlPage(html, css); String headerHtmlPage = createHtmlPage(headerHtml, css); String footerHtmlPage = createHtmlPage(footerHtml, css); - createPdf(htmlPage, baseURL, headerHtmlPage, headerHeight, footerHtmlPage, footerHeight, outputStream); + + createPdf( + htmlPage, baseURL, headerHtmlPage, headerHeight, footerHtmlPage, + footerHeight, outputStream); } private String createHtmlPage(String html, String[] css) { @@ -39,82 +46,126 @@ public final class HtmlToPdfEngine { StringBuilder tmpStr = new StringBuilder(); StringBuilder header = new StringBuilder(); StringBuilder content = new StringBuilder(); + cleanHtml(html, content, header); + tmpStr.append(""); tmpStr.append(""); + if (css != null) { for (int i = 0; i < css.length; i++) { - tmpStr.append(""); + tmpStr.append(""); } } + // aggiungo il css tmpStr.append(header); tmpStr.append(""); tmpStr.append(""); + // aggiungo il div footer tmpStr.append(content); + tmpStr.append(""); tmpStr.append(""); + return tmpStr.toString(); } - private void cleanHtml(String html, StringBuilder content, StringBuilder header) { + private void cleanHtml( + String html, StringBuilder content, StringBuilder header) { + + String regex = + "]*>[^<]*(?:(?!"; - String regex = "]*>[^<]*(?:(?!"; String cleanHtml = StringPool.BLANK; + html = html.replace(" ", StringPool.SPACE); html = html.replace("
", "
"); html = html.replace("&", "&"); - java.util.regex.Pattern p = java.util.regex.Pattern.compile(regex, java.util.regex.Pattern.CASE_INSENSITIVE - | java.util.regex.Pattern.UNICODE_CASE); + + java.util.regex.Pattern p = + java.util.regex.Pattern.compile( + regex, java.util.regex.Pattern.CASE_INSENSITIVE | + java.util.regex.Pattern.UNICODE_CASE); java.util.regex.Matcher m = p.matcher(html); + if (m.find()) { do { header.append(m.group().toString()); cleanHtml = m.replaceFirst(StringPool.BLANK); m = p.matcher(cleanHtml); - } while (m.find()); - } else { + } + while (m.find()); + } + else { content.append(html); } + content.append(cleanHtml); } - private void createPdf(String html, String baseURL, String headerHtml, int headerHeight, String footerHtml, - int footerHeight, OutputStream outputStream) throws DocumentException, IOException { + private void createPdf( + String html, String baseURL, String headerHtml, int headerHeight, + String footerHtml, int footerHeight, OutputStream outputStream) + throws DocumentException, IOException { Document document = new Document(PageSize.A4); + PdfWriter writer = PdfWriter.getInstance(document, outputStream); + float marginTop = document.topMargin(); if (Validator.isNotNull(headerHtml)) { headerHeight = (headerHeight <= 0 ? 30 : headerHeight); marginTop = headerHeight; } + float marginBottom = document.bottomMargin(); if (Validator.isNotNull(footerHtml)) { footerHeight = (footerHeight <= 0 ? 30 : footerHeight); marginBottom = footerHeight; } - writer.setPageEvent(new HeaderFooterPageEvent(headerHtml, headerHeight, footerHtml, footerHeight)); - document.setMargins(document.leftMargin(), document.rightMargin(), marginTop, marginBottom); + + writer.setPageEvent(new HeaderFooterPageEvent( + headerHtml, headerHeight, footerHtml, footerHeight)); + + document.setMargins( + document.leftMargin(), document.rightMargin(), marginTop, + marginBottom); + // writer.getInfo().put(PdfName.AUTHOR, new PdfString("author")); // writer.getInfo().put(PdfName.TITLE, new PdfString("title")); // writer.getInfo().put(PdfName.CREATOR, new PdfString("creator")); + writer.setPdfVersion(PdfWriter.VERSION_1_7); // writer.setPDFXConformance(PdfWriter.PDFA1B); writer.createXmpMetadata(); + document.open(); - TagProcessorFactory tagProcessorFactory = Tags.getHtmlTagProcessorFactory(); + + TagProcessorFactory tagProcessorFactory = + Tags.getHtmlTagProcessorFactory(); tagProcessorFactory.removeProcessor(HTML.Tag.IMG); - tagProcessorFactory.addProcessor(new ImageTagProcessor(baseURL), HTML.Tag.IMG); + tagProcessorFactory.addProcessor( + new ImageTagProcessor(baseURL), HTML.Tag.IMG); HtmlPipelineContext htmlContext = new HtmlPipelineContext(null); + htmlContext.setTagFactory(tagProcessorFactory); - CSSResolver cssResolver = XMLWorkerHelper.getInstance().getDefaultCssResolver(true); - Pipeline pipeline = new CssResolverPipeline(cssResolver, new HtmlPipeline(htmlContext, - new PdfWriterPipeline(document, writer))); + + CSSResolver cssResolver = + XMLWorkerHelper.getInstance().getDefaultCssResolver(true); + + Pipeline pipeline = + new CssResolverPipeline(cssResolver, new HtmlPipeline( + htmlContext, new PdfWriterPipeline(document, writer))); + XMLWorker worker = new XMLWorker(pipeline, true); + XMLParser p = new XMLParser(worker); + p.parse(new StringReader(html)); + document.close(); } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/ImageTagProcessor.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/ImageTagProcessor.java index b089cb4a..3a365de1 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/ImageTagProcessor.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/html/core/ImageTagProcessor.java @@ -1,8 +1,5 @@ -package it.tref.liferay.portos.report.html.core; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +package it.tref.liferay.portos.report.html.core; import com.itextpdf.text.Chunk; import com.itextpdf.text.Element; @@ -16,9 +13,14 @@ import com.itextpdf.tool.xml.pipeline.html.HtmlPipelineContext; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + public class ImageTagProcessor extends com.itextpdf.tool.xml.html.Image { private final Log _log = LogFactoryUtil.getLog(getClass()); + private String baseURL; public ImageTagProcessor(String baseURL) { @@ -27,31 +29,45 @@ public class ImageTagProcessor extends com.itextpdf.tool.xml.html.Image { } @Override - public List end(WorkerContext ctx, Tag tag, List currentContent) { + public List end( + WorkerContext ctx, Tag tag, List currentContent) { final Map attributes = tag.getAttributes(); + String src = attributes.get(HTML.Attribute.SRC); + List elements = new ArrayList(1); + if (null != src && src.length() > 0) { + if (!src.startsWith("http")) { src = baseURL + src; } + Image img = null; + try { img = Image.getInstance(src); - } catch (Exception e) { + } + catch (Exception e) { _log.error("errore caricamento immagine: " + src, e); } + if (img != null) { try { - final HtmlPipelineContext htmlPipelineContext = getHtmlPipelineContext(ctx); + final HtmlPipelineContext htmlPipelineContext = + getHtmlPipelineContext(ctx); elements.add(getCssAppliers().apply( - new Chunk((com.itextpdf.text.Image) getCssAppliers().apply(img, tag, htmlPipelineContext), - 0, 0, true), tag, htmlPipelineContext)); - } catch (NoCustomContextException e) { + new Chunk( + (com.itextpdf.text.Image) getCssAppliers().apply( + img, tag, htmlPipelineContext), 0, 0, true), + tag, htmlPipelineContext)); + } + catch (NoCustomContextException e) { throw new RuntimeWorkerException(e); } - } else { + } + else { elements = super.end(ctx, tag, currentContent); } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/jasper/core/annotation/BeanReportAnnotation.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/jasper/core/annotation/BeanReportAnnotation.java index cbd235ba..03da1c3a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/jasper/core/annotation/BeanReportAnnotation.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/jasper/core/annotation/BeanReportAnnotation.java @@ -1,3 +1,4 @@ + package it.tref.liferay.portos.report.jasper.core.annotation; import java.lang.annotation.ElementType; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java index 69e16e5a..7baf726f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java @@ -53,8 +53,8 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil; public class ProtocolloMessageListener extends BaseMessageListener { - private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + private static final Log _log = LogFactoryUtil.getLog(ProtocolloMessageListener.class); @Override @@ -64,17 +64,16 @@ public class ProtocolloMessageListener extends BaseMessageListener { long userId = message.getLong(ReportConstants.USER_ID); @SuppressWarnings("unchecked") Map taskContextMap = (Map) message.get(ReportConstants.PARAMATERS); - User user = - UserLocalServiceUtil.getRoleUsers( - RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR).getRoleId()).get(0); + User user = UserLocalServiceUtil.getRoleUsers( + RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR).getRoleId()).get(0); try { PermissionThreadLocal.setPermissionChecker(PermissionCheckerFactoryUtil.create(user)); } catch (Exception e) { throw new SystemException(e); } try { - JSONArray jsonArray = - JSONFactoryUtil.createJSONArray(MapUtil.getString(taskContextMap, ReportConstants.PARAM_REPORTS)); + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(MapUtil.getString(taskContextMap, + ReportConstants.PARAM_REPORTS)); JSONObject jsonObject = jsonArray.getJSONObject(0); ReportDto reportDto = JSONFactoryUtil.looseDeserialize(jsonObject.toString(), ReportDto.class); String protocolloToAttach = StringPool.BLANK; @@ -131,32 +130,22 @@ public class ProtocolloMessageListener extends BaseMessageListener { ServiceContext serviceContext = new ServiceContext(); serviceContext.setUserId(userId); serviceContext.setCompanyId(companyId); - long repositoryId = fileEntry.getRepositoryId(); - long folderId = fileEntry.getFolderId(); - String sourceFileName = reportDto.getFileName() + ".pdf"; - String mimeType = ContentTypes.APPLICATION_PDF; - String title = reportDto.getFileName(); - String description = StringPool.BLANK; - String changeLog = StringPool.BLANK; - FileEntry newFileEntry; + FileEntry newFileEntry = null; try { - newFileEntry = - DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, sourceFileName, - mimeType, title, description, changeLog, outputBytes, serviceContext); + newFileEntry = DLAppLocalServiceUtil.addFileEntry(userId, fileEntry.getRepositoryId(), + fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", ContentTypes.APPLICATION_PDF, + reportDto.getFileName(), StringPool.BLANK, StringPool.BLANK, outputBytes, serviceContext); } catch (DuplicateFileException e) { - FileEntry fe = - DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), fileEntry.getFolderId(), - reportDto.getFileName()); - DLAppLocalServiceUtil.deleteFileEntry(fe.getFileEntryId()); - newFileEntry = - DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, sourceFileName, - mimeType, title, description, changeLog, outputBytes, serviceContext); + FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), fileEntry.getFolderId(), + reportDto.getFileName()); + _log.info("File duplicato : " + fe.getFileEntryId()); + return; } if (Validator.isNotNull(newFileEntry)) { long[] fileEntryIds = new long[0]; fileEntryIds = ArrayUtil.append(fileEntryIds, newFileEntry.getFileEntryId()); - ReportResultDto dto = - new ReportResultDto(0L, fileEntryIds, ReportResult.SUCCESSFUL.toString(), null); + ReportResultDto dto = new ReportResultDto(0L, fileEntryIds, ReportResult.SUCCESSFUL.toString(), + null); Message responseMessage = MessageBusUtil.createResponseMessage(message); responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto)); MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage); @@ -175,16 +164,20 @@ public class ProtocolloMessageListener extends BaseMessageListener { throws SystemException { Company company = CompanyLocalServiceUtil.fetchCompany(companyId); + StringBuilder sb = new StringBuilder(); - sb.append( - (String) company.getExpandoBridge().getAttribute( - Constants.COMPANY_CUSTOM_FIELD_PROTOCOLLO_CODICE_INIZIALE_LABEL, false)) - .append(StringPool.SLASH) - .append(protocollo) - .append(StringPool.SLASH) - .append((String) company.getExpandoBridge().getAttribute( - Constants.COMPANY_CUSTOM_FIELD_PROTOCOLLO_CODICE_SEGUENTE_LABEL, false)).append(" del ") - .append(sdf.format(dtProtocollo)); + + sb.append((String) company.getExpandoBridge().getAttribute( + Constants.COMPANY_CUSTOM_FIELD_PROTOCOLLO_CODICE_INIZIALE_LABEL, false)); + sb.append(StringPool.SLASH); + sb.append(protocollo); + sb.append(StringPool.SLASH); + sb.append((String) company.getExpandoBridge().getAttribute( + Constants.COMPANY_CUSTOM_FIELD_PROTOCOLLO_CODICE_SEGUENTE_LABEL, false)); + + sb.append(" del "); + sb.append(sdf.format(dtProtocollo)); + return sb.toString(); } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ReportMessageListener.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ReportMessageListener.java index a126a417..c696576d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ReportMessageListener.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ReportMessageListener.java @@ -1,19 +1,5 @@ package it.tref.liferay.portos.report.messaging; -import it.tref.liferay.portos.report.model.ReportTask; -import it.tref.liferay.portos.report.service.ReportTaskLocalServiceUtil; -import it.tref.liferay.portos.report.service.ReportTaskManagerServiceUtil; -import it.tref.liferay.portos.report.shared.constants.ReportConstants; -import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportProcessMode; -import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportResult; -import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportType; -import it.tref.liferay.portos.report.shared.dto.ReportDto; -import it.tref.liferay.portos.report.shared.dto.ReportResultDto; - -import java.io.Serializable; -import java.util.Collections; -import java.util.Map; - import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.json.JSONArray; import com.liferay.portal.kernel.json.JSONFactoryUtil; @@ -28,70 +14,110 @@ import com.liferay.portal.kernel.util.MapUtil; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.service.ServiceContext; -public class ReportMessageListener extends BaseMessageListener { +import it.tref.liferay.portos.report.model.ReportTask; +import it.tref.liferay.portos.report.service.ReportTaskLocalServiceUtil; +import it.tref.liferay.portos.report.service.ReportTaskManagerServiceUtil; +import it.tref.liferay.portos.report.shared.constants.ReportConstants; +import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportProcessMode; +import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportResult; +import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportType; +import it.tref.liferay.portos.report.shared.dto.ReportDto; +import it.tref.liferay.portos.report.shared.dto.ReportResultDto; - private static final Log _log = LogFactoryUtil.getLog(ReportTaskMessageListener.class); +import java.io.Serializable; +import java.util.Collections; +import java.util.Map; + +public class ReportMessageListener extends BaseMessageListener { + private final static Log _log = LogFactoryUtil.getLog(ReportTaskMessageListener.class); + @SuppressWarnings("unchecked") @Override protected void doReceive(Message message) throws Exception { - try { + long companyId = message.getLong(ReportConstants.COMPANY_ID); long userId = message.getLong(ReportConstants.USER_ID); + Object dataSouce = message.get(ReportConstants.REPORT_DATASOURCE); - @SuppressWarnings("unchecked") Map taskContextMap = (Map) message .get(ReportConstants.PARAMATERS); + if (taskContextMap == null) { taskContextMap = Collections. emptyMap(); } + validate(companyId, userId, taskContextMap); + ReportProcessMode reportProcessMode = ReportProcessMode.valueOf(MapUtil.getString(taskContextMap, ReportConstants.PARAM_PROCESS_MODE)); + if (reportProcessMode.equals(ReportProcessMode.ASYNC)) { + ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(companyId); serviceContext.setUserId(userId); - ReportTask reportTask = ReportTaskLocalServiceUtil.addReportTask(taskContextMap, serviceContext); + + ReportTask reportTask = ReportTaskLocalServiceUtil.addReportTask(taskContextMap, + serviceContext); + ReportResultDto dto = new ReportResultDto(reportTask.getReportTaskId(), null, ReportResult.SUCCESSFUL.toString(), null); + Message responseMessage = MessageBusUtil.createResponseMessage(message); responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto)); + MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage); } else { - long[] fileEntryIds = ReportTaskManagerServiceUtil.doReport(companyId, userId, taskContextMap, - dataSouce); - ReportResultDto dto = new ReportResultDto(0L, fileEntryIds, ReportResult.SUCCESSFUL.toString(), null); + + long[] fileEntryIds = ReportTaskManagerServiceUtil.doReport(companyId, userId, + taskContextMap, dataSouce); + + ReportResultDto dto = new ReportResultDto(0L, fileEntryIds, + ReportResult.SUCCESSFUL.toString(), null); + Message responseMessage = MessageBusUtil.createResponseMessage(message); responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto)); + MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage); } } catch (Exception e) { _log.error(e, e); - ReportResultDto dto = new ReportResultDto(0L, null, ReportResult.FAILED.toString(), e.getMessage()); + ReportResultDto dto = new ReportResultDto(0L, null, ReportResult.FAILED.toString(), + e.getMessage()); + Message responseMessage = MessageBusUtil.createResponseMessage(message); responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto)); + MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage); } } - private void validate(long companyId, long userId, Map taskContextMap) throws PortalException { + private void validate(long companyId, long userId, Map taskContextMap) + throws PortalException { if (Validator.isNull(companyId)) { throw new PortalException("company id is required"); } + if (Validator.isNull(userId)) { throw new PortalException("user id is required"); } + String processMode = MapUtil.getString(taskContextMap, ReportConstants.PARAM_PROCESS_MODE); + if (Validator.isNull(processMode)) { throw new PortalException("process mode is required"); } else { try { + ReportProcessMode reportProcessMode = ReportProcessMode.valueOf(processMode); + if (reportProcessMode.equals(ReportProcessMode.ASYNC)) { + String destinationName = MapUtil.getString(taskContextMap, ReportConstants.PARAM_RESPONSE_DESTINATION_NAME); + if (Validator.isNull(destinationName)) { throw new PortalException("destination name is required"); } @@ -100,24 +126,36 @@ public class ReportMessageListener extends BaseMessageListener { throw new PortalException("report process is not valid"); } } + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(MapUtil.getString(taskContextMap, ReportConstants.PARAM_REPORTS)); + for (int i = 0; i < jsonArray.length(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + ReportDto reportDto = JSONFactoryUtil.looseDeserialize(jsonObject.toString(), ReportDto.class); + long[] fileEntryTemplateIds = reportDto.getFileEntryIds(); + if (ArrayUtil.isEmpty(fileEntryTemplateIds)) { throw new PortalException("file entry template ids are required"); } + long folderId = reportDto.getFolderId(); + if (Validator.isNull(folderId)) { throw new PortalException("folder id is required"); } + String reportName = reportDto.getFileName(); + if (Validator.isNull(reportName)) { throw new PortalException("report name is required"); } + ReportType reportType = reportDto.getReportType(); + if (Validator.isNull(reportType)) { throw new PortalException("report type is required"); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ReportTaskMessageListener.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ReportTaskMessageListener.java index 7d0fcb12..c990f92b 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ReportTaskMessageListener.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ReportTaskMessageListener.java @@ -1,17 +1,5 @@ package it.tref.liferay.portos.report.messaging; -import it.tref.liferay.portos.report.model.ReportTask; -import it.tref.liferay.portos.report.service.ReportTaskLocalServiceUtil; -import it.tref.liferay.portos.report.service.ReportTaskManagerServiceUtil; -import it.tref.liferay.portos.report.service.persistence.ReportTaskActionableDynamicQuery; -import it.tref.liferay.portos.report.shared.constants.ReportConstants; -import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportResult; -import it.tref.liferay.portos.report.shared.dto.ReportResultDto; - -import java.io.Serializable; -import java.util.Date; -import java.util.Map; - import com.liferay.portal.DuplicateLockException; import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery; import com.liferay.portal.kernel.dao.orm.DynamicQuery; @@ -19,6 +7,8 @@ import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.json.JSONFactoryUtil; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.messaging.BaseMessageListener; import com.liferay.portal.kernel.messaging.Message; import com.liferay.portal.kernel.messaging.MessageBusUtil; @@ -28,6 +18,18 @@ import com.liferay.portal.kernel.uuid.PortalUUIDUtil; import com.liferay.portal.model.Lock; import com.liferay.portal.service.LockLocalServiceUtil; +import it.tref.liferay.portos.report.model.ReportTask; +import it.tref.liferay.portos.report.service.ReportTaskLocalServiceUtil; +import it.tref.liferay.portos.report.service.ReportTaskManagerServiceUtil; +import it.tref.liferay.portos.report.service.persistence.ReportTaskActionableDynamicQuery; +import it.tref.liferay.portos.report.shared.constants.ReportConstants; +import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportResult; +import it.tref.liferay.portos.report.shared.dto.ReportResultDto; + +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + public class ReportTaskMessageListener extends BaseMessageListener { private static final String _LOCK_CLASS_NAME = ReportTaskMessageListener.class.getName(); @@ -47,26 +49,38 @@ public class ReportTaskMessageListener extends BaseMessageListener { protected void performAction(Object obj) throws PortalException, SystemException { ReportTask reportTask = (ReportTask) obj; + Map taskContextMap = reportTask.getTaskContextMap(); + String responseDestinationName = MapUtil.getString(taskContextMap, ReportConstants.PARAM_RESPONSE_DESTINATION_NAME); + try { + long[] fileEntryIds = ReportTaskManagerServiceUtil.doReport(reportTask.getCompanyId(), reportTask.getUserId(), taskContextMap, null); + sendMessage(responseDestinationName, reportTask.getReportTaskId(), fileEntryIds, ReportResult.SUCCESSFUL.toString(), null); } catch (Exception e) { sendMessage(responseDestinationName, reportTask.getReportTaskId(), null, ReportResult.FAILED.toString(), e.getMessage()); + } finally { ReportTaskLocalServiceUtil.markAsCompleted(reportTask.getReportTaskId(), new Date()); } + } }; + long count = actionableDynamicQuery.performCount(); + if (count > 0) { + String owner = PortalUUIDUtil.generate(); + if (tryLock(owner)) { + try { actionableDynamicQuery.performActions(); } finally { @@ -79,23 +93,31 @@ public class ReportTaskMessageListener extends BaseMessageListener { private boolean tryLock(String owner) { try { + Lock lock = null; + while (true) { try { lock = LockLocalServiceUtil.lock(_LOCK_CLASS_NAME, _LOCK_CLASS_NAME, owner); + break; } catch (SystemException se) { + try { Thread.sleep(50); - } catch (InterruptedException ie) {} + } catch (InterruptedException ie) { + } } } + if (!lock.isNew()) { throw new DuplicateLockException(lock); } + } catch (DuplicateLockException e) { return false; } + return true; } @@ -104,12 +126,16 @@ public class ReportTaskMessageListener extends BaseMessageListener { LockLocalServiceUtil.unlock(_LOCK_CLASS_NAME, _LOCK_CLASS_NAME, owner); } - private void sendMessage(String responseDestinationName, long reportTaskId, long[] fileEntryIds, String result, - String resultMessage) { + private void sendMessage(String responseDestinationName, long reportTaskId, long[] fileEntryIds, + String result, String resultMessage) { + + if (Validator.isNotNull(responseDestinationName) + && MessageBusUtil.hasMessageListener(responseDestinationName)) { - if (Validator.isNotNull(responseDestinationName) && MessageBusUtil.hasMessageListener(responseDestinationName)) { ReportResultDto dto = new ReportResultDto(reportTaskId, fileEntryIds, result, resultMessage); + MessageBusUtil.sendMessage(responseDestinationName, JSONFactoryUtil.looseSerializeDeep(dto)); } } + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskLocalServiceImpl.java index f5a8f1ae..9ec1903d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskLocalServiceImpl.java @@ -1,12 +1,25 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. The contents of this file are subject to the terms of the - * Liferay Enterprise Subscription License ("License"). You may not use this file except in compliance with the License. - * You can obtain a copy of the License by contacting Liferay, Inc. See the License for the specific language governing - * permissions and limitations under the License, including but not limited to distribution rights of the Software. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of the Liferay Enterprise + * Subscription License ("License"). You may not use this file except in + * compliance with the License. You can obtain a copy of the License by + * contacting Liferay, Inc. See the License for the specific language governing + * permissions and limitations under the License, including but not limited to + * distribution rights of the Software. + * + * + * */ package it.tref.liferay.portos.report.service.impl; +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.json.JSONFactoryUtil; +import com.liferay.portal.model.User; +import com.liferay.portal.service.ServiceContext; + import it.tref.liferay.portos.report.model.ReportTask; import it.tref.liferay.portos.report.service.base.ReportTaskLocalServiceBaseImpl; @@ -14,58 +27,64 @@ import java.io.Serializable; import java.util.Date; import java.util.Map; -import com.liferay.portal.kernel.exception.PortalException; -import com.liferay.portal.kernel.exception.SystemException; -import com.liferay.portal.kernel.json.JSONFactoryUtil; -import com.liferay.portal.model.User; -import com.liferay.portal.service.ServiceContext; - /** - * The implementation of the report task local service. - *

- * 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.report.service.ReportTaskLocalService} 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. - *

+ * The implementation of the report task local service.

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.report.service.ReportTaskLocalService} 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.

* * @author * @see it.tref.liferay.portos.report.service.base.ReportTaskLocalServiceBaseImpl * @see it.tref.liferay.portos.report.service.ReportTaskLocalServiceUtil */ public class ReportTaskLocalServiceImpl extends ReportTaskLocalServiceBaseImpl { + /* - * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link - * it.tref.liferay.portos.report.service.ReportTaskLocalServiceUtil} to access the report task local service. + * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use + * {@link it.tref.liferay.portos.report.service.ReportTaskLocalServiceUtil} to + * access the report task local service. */ - @Override - public ReportTask addReportTask(Map taskContextMap, ServiceContext serviceContext) - throws PortalException, SystemException { + public ReportTask addReportTask( + Map taskContextMap, ServiceContext serviceContext) + throws PortalException, SystemException { User user = userLocalService.getUser(serviceContext.getUserId()); + Date now = new Date(); - ReportTask reportTask = createReportTask(counterLocalService.increment(ReportTask.class.getName())); + + ReportTask reportTask = + reportTaskLocalService.createReportTask(counterLocalService.increment(ReportTask.class.getName())); + reportTask.setCompanyId(serviceContext.getCompanyId()); reportTask.setUserId(user.getUserId()); reportTask.setUserName(user.getFullName()); reportTask.setCreateDate(serviceContext.getCreateDate(now)); reportTask.setModifiedDate(serviceContext.getModifiedDate(now)); + if (taskContextMap != null) { - String taskContext = JSONFactoryUtil.looseSerializeDeep(taskContextMap); + String taskContext = + JSONFactoryUtil.looseSerializeDeep(taskContextMap); + reportTask.setTaskContext(taskContext); } - return addReportTask(reportTask); + + return reportTaskLocalService.addReportTask(reportTask); } - @Override - public ReportTask markAsCompleted(long reportTaskId, Date completionDate) throws PortalException, SystemException { + public ReportTask markAsCompleted(long reportTaskId, Date completionDate) + throws PortalException, SystemException { + + ReportTask reportTask = + reportTaskLocalService.getReportTask(reportTaskId); - ReportTask reportTask = getReportTask(reportTaskId); reportTask.setModifiedDate(new Date()); reportTask.setCompleted(true); reportTask.setCompletionDate(completionDate); - return updateReportTask(reportTask); + + return reportTaskLocalService.updateReportTask(reportTask); } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java index 4fb530c6..f4496ddc 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java @@ -1,32 +1,18 @@ /** - * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. The contents of this file are subject to the terms of the - * Liferay Enterprise Subscription License ("License"). You may not use this file except in compliance with the License. - * You can obtain a copy of the License by contacting Liferay, Inc. See the License for the specific language governing - * permissions and limitations under the License, including but not limited to distribution rights of the Software. + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of the Liferay Enterprise Subscription License + * ("License"). You may not use this file except in compliance with the License. You can obtain a + * copy of the License by contacting Liferay, Inc. See the License for the specific language + * governing permissions and limitations under the License, including but not limited to + * distribution rights of the Software. + * + * + * */ package it.tref.liferay.portos.report.service.impl; -import it.tref.liferay.portos.report.html.core.HtmlToPdfEngine; -import it.tref.liferay.portos.report.jasper.core.provider.JasperPdfProvider; -import it.tref.liferay.portos.report.jasper.core.report.BeanReport; -import it.tref.liferay.portos.report.jasper.core.report.ReportInterface; -import it.tref.liferay.portos.report.odt.core.OdtToPdfEngine; -import it.tref.liferay.portos.report.service.base.ReportTaskManagerServiceBaseImpl; -import it.tref.liferay.portos.report.shared.constants.ReportConstants; -import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportType; -import it.tref.liferay.portos.report.shared.dto.ReportDto; -import it.tref.liferay.portos.report.shared.util.PdfUtil; -import it.tref.liferay.portos.report.shared.util.VelocityUtil; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.json.JSONArray; @@ -47,14 +33,37 @@ import com.liferay.portal.service.ServiceContext; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; +import it.tref.liferay.portos.report.html.core.HtmlToPdfEngine; +import it.tref.liferay.portos.report.jasper.core.provider.JasperPdfProvider; +import it.tref.liferay.portos.report.jasper.core.report.BeanReport; +import it.tref.liferay.portos.report.jasper.core.report.ReportInterface; +import it.tref.liferay.portos.report.odt.core.OdtToPdfEngine; +import it.tref.liferay.portos.report.service.base.ReportTaskManagerServiceBaseImpl; +import it.tref.liferay.portos.report.shared.constants.ReportConstants; +import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportType; +import it.tref.liferay.portos.report.shared.dto.ReportDto; +import it.tref.liferay.portos.report.shared.util.PdfUtil; +import it.tref.liferay.portos.report.shared.util.VelocityUtil; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * The implementation of the report task manager remote service. *

- * 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.report.service.ReportTaskManagerService} interface. + * 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.report.service.ReportTaskManagerService} + * interface. *

- * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS - * credentials because this service can be accessed remotely. + * This is a remote service. Methods of this service are expected to have + * security checks based on the propagated JAAS credentials because this service + * can be accessed remotely. *

* * @author @@ -62,97 +71,139 @@ import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; * @see it.tref.liferay.portos.report.service.ReportTaskManagerServiceUtil */ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseImpl { - - private static final Log _log = LogFactoryUtil.getLog(ReportTaskManagerServiceImpl.class); + private final static Log _log = LogFactoryUtil.getLog(ReportTaskManagerServiceImpl.class); @Override - public long[] doReport(long companyId, long userId, Map taskContextMap, Object dataSource) - throws PortalException, SystemException { + public long[] doReport(long companyId, long userId, Map taskContextMap, + Object dataSource) throws PortalException, SystemException { long[] fileEntryIds = new long[0]; + try { + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(MapUtil.getString(taskContextMap, ReportConstants.PARAM_REPORTS)); + for (int i = 0; i < jsonArray.length(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); - ReportDto reportDto = JSONFactoryUtil.looseDeserialize(jsonObject.toString(), ReportDto.class); + + ReportDto reportDto = JSONFactoryUtil + .looseDeserialize(jsonObject.toString(), ReportDto.class); + long[] fileEntryTemplateIds = reportDto.getFileEntryIds(); + ReportType reportType = reportDto.getReportType(); + List rawReports = new ArrayList(fileEntryTemplateIds.length); + for (long fileEntryTemplateId : fileEntryTemplateIds) { + Map reportParameters = reportDto.getParameters(); + InputStream templateInputStream = null; try { + // recupero da document library il template FileEntry fileEntryTemplate = dlAppLocalService.getFileEntry(fileEntryTemplateId); templateInputStream = DLFileEntryLocalServiceUtil.getFileAsStream( fileEntryTemplate.getFileEntryId(), fileEntryTemplate.getVersion(), false); + // generazione report + if (reportType.equals(ReportType.JRXML_TO_PDF)) { + // Object dataSource = reportDto.getDataSource(); + ReportInterface reportInterface = null; if (dataSource != null) { reportInterface = new BeanReport(dataSource); } + HashMap params = new HashMap(); if (reportParameters != null) { params.putAll(reportParameters); } + JasperPdfProvider pdfProvider = new JasperPdfProvider(); pdfProvider.doReport(templateInputStream, params, reportInterface); + rawReports.add(pdfProvider.getBytes()); } else if (reportType.equals(ReportType.ODT_TO_PDF)) { + ByteArrayOutputStream baosOdt = new ByteArrayOutputStream(); + OdtToPdfEngine odtEngine = new OdtToPdfEngine(); odtEngine.createPdfFile(templateInputStream, reportParameters, baosOdt); + rawReports.add(baosOdt.toByteArray()); + } else if (reportType.equals(ReportType.VELOCITY_TO_PDF) || reportType.equals(ReportType.HTML_TO_PDF)) { + String[] css = reportDto.getCss(); String baseURL = reportDto.getPortalURL(); + String html = StringUtil.read(templateInputStream); if (reportType.equals(ReportType.VELOCITY_TO_PDF)) { html = VelocityUtil.evaluate(html, reportParameters); } + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + HtmlToPdfEngine engine = new HtmlToPdfEngine(); engine.createPdfFile(html, css, baseURL, reportDto.getHeader(), - reportDto.getHeaderHeight(), reportDto.getFooter(), reportDto.getFooterHeight(), - baos); + reportDto.getHeaderHeight(), reportDto.getFooter(), + reportDto.getFooterHeight(), baos); + rawReports.add(baos.toByteArray()); } + } finally { StreamUtil.cleanUp(templateInputStream); } } + byte[] bytes = PdfUtil.mergePdf(rawReports, reportDto.isShowNumberOfPage()); + // recupero folder dove inserire report generato + Folder folder = DLAppLocalServiceUtil.getFolder(reportDto.getFolderId()); + String title = reportDto.getFileName(); String sourceFileName = title + StringPool.PERIOD + "pdf"; String mimeType = MimeTypesUtil.getContentType(sourceFileName); + // se è già presente lo cancello + try { - FileEntry fileEntry = dlAppLocalService.getFileEntry(folder.getGroupId(), folder.getFolderId(), - title); + FileEntry fileEntry = dlAppLocalService.getFileEntry(folder.getGroupId(), + folder.getFolderId(), title); dlAppLocalService.deleteFileEntry(fileEntry.getFileEntryId()); - } catch (PortalException e) {} + } catch (PortalException e) { + } + // inserimento con permessi di view per site member + ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(companyId); serviceContext.setUserId(userId); serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); + _log.info("addFileEntry userId=" + serviceContext.getUserId() + ", repositoryId=" - + folder.getRepositoryId() + ", folderId=" + folder.getFolderId() + ", sourceFileName=" - + sourceFileName + ", mimeType=" + mimeType + ", title=" + title); + + folder.getRepositoryId() + ", folderId=" + folder.getFolderId() + + ", sourceFileName=" + sourceFileName + ", mimeType=" + mimeType + ", title=" + + title); FileEntry fileEntry = dlAppLocalService.addFileEntry(serviceContext.getUserId(), folder.getRepositoryId(), folder.getFolderId(), sourceFileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext); + fileEntryIds = ArrayUtil.append(fileEntryIds, fileEntry.getFileEntryId()); } } catch (Exception e) { _log.error(e); } + return fileEntryIds; } } diff --git a/liferay-plugins-sdk-6.2/themes/portos-private-theme/docroot/WEB-INF/liferay-look-and-feel.xml b/liferay-plugins-sdk-6.2/themes/portos-private-theme/docroot/WEB-INF/liferay-look-and-feel.xml index 085ae32c..8bf4ece5 100644 --- a/liferay-plugins-sdk-6.2/themes/portos-private-theme/docroot/WEB-INF/liferay-look-and-feel.xml +++ b/liferay-plugins-sdk-6.2/themes/portos-private-theme/docroot/WEB-INF/liferay-look-and-feel.xml @@ -8,7 +8,7 @@ ftl - + diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_instances/workflow_logs.jspf b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_instances/workflow_logs.jspf index 011c8696..5a059b4f 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_instances/workflow_logs.jspf +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/META-INF/custom_jsps/html/portlet/workflow_instances/workflow_logs.jspf @@ -44,7 +44,8 @@ details. if (workflowLog.getRoleId() != 0) { curRole = RoleLocalServiceUtil.getRole(workflowLog.getRoleId()); actorName = HtmlUtil.escape(curRole.getDescriptiveName()); - } else if (workflowLog.getUserId() != 0) { + } + else if (workflowLog.getUserId() != 0) { curUser = UserLocalServiceUtil.getUser(workflowLog.getUserId()); actorName = HtmlUtil.escape(curUser.getFullName()); } @@ -139,7 +140,6 @@ details. -
diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/liferay-web.xml b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/liferay-web.xml index 3962ad06..e45ccb92 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/liferay-web.xml +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/liferay-web.xml @@ -2,100 +2,72 @@ - Atom Servlet Filter - com.liferay.portal.kernel.servlet.PortalClassLoaderFilter - - filter-class - com.liferay.portal.servlet.filters.authverifier.AuthVerifierFilter - + Invoker Filter - ERROR + com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter - portal_property_prefix - atom.servlet. + dispatcher + ERROR - Axis Servlet Filter - com.liferay.portal.kernel.servlet.PortalClassLoaderFilter + Invoker Filter - FORWARD + com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter - filter-class - com.liferay.portal.servlet.filters.authverifier.AuthVerifierFilter - - - portal_property_prefix - axis.servlet. + dispatcher + FORWARD - JSON Servlet Filter - com.liferay.portal.kernel.servlet.PortalClassLoaderFilter - - filter-class - com.liferay.portal.servlet.filters.authverifier.AuthVerifierFilter - + Invoker Filter - INCLUDE + com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter - portal_property_prefix - json.servlet. + dispatcher + INCLUDE - JSON Web Service Servlet Filter - com.liferay.portal.kernel.servlet.PortalClassLoaderFilter - - filter-class - com.liferay.portal.servlet.filters.authverifier.AuthVerifierFilter - + Invoker Filter - REQUEST + com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter - portal_property_prefix - jsonws.servlet. + dispatcher + REQUEST - Thread Local Filter + Compound Session Id Filter com.liferay.portal.kernel.servlet.PortalClassLoaderFilter filter-class - com.liferay.portal.servlet.filters.threadlocal.ThreadLocalFilter + com.liferay.portal.servlet.filters.compoundsessionid.CompoundSessionIdFilter - Compound Session Id Filter + Thread Local Filter com.liferay.portal.kernel.servlet.PortalClassLoaderFilter filter-class - com.liferay.portal.servlet.filters.compoundsessionid.CompoundSessionIdFilter + com.liferay.portal.servlet.filters.threadlocal.ThreadLocalFilter - Thread Local Filter - /api/atom/* - - - Thread Local Filter - /api/axis/* - - - Thread Local Filter - /api/json/* - - - Thread Local Filter - /api/jsonws/* - - - Atom Servlet Filter - /api/atom/* + Invoker Filter - ERROR + /* + ERROR - Axis Servlet Filter - /api/axis/* + Invoker Filter - FORWARD + /* + FORWARD - JSON Servlet Filter - /api/json/* + Invoker Filter - INCLUDE + /* + INCLUDE - JSON Web Service Servlet Filter - /api/jsonws/* + Invoker Filter - REQUEST + /* + REQUEST Thread Local Filter diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/content/Language.properties b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/content/Language.properties index dbbd2bff..39af8759 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/content/Language.properties +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/content/Language.properties @@ -10,5 +10,6 @@ error-portos-kaleo-required = {0} is required ## HOOK +x-assigned-the-task-to-x = Task assigned to {1} x-completed-the-task-x-y={0} completed the task {1} ({2}). x-sent-signal-x=System sent a signal {1}. \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/content/Language_it.properties b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/content/Language_it.properties index 83228c65..1f5d2523 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/content/Language_it.properties +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/content/Language_it.properties @@ -10,5 +10,6 @@ error-portos-kaleo-required = {0} campo obbligatorio ## HOOK +x-assigned-the-task-to-x = L'attività è stata assegnata a {1} x-completed-the-task-x-y={0} ha completato l'attività {1} ({2}). x-sent-signal-x=Il sistema ha inviato un segnale {1}.