diff --git a/liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar b/liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar index 93f5d5a1..6af7064e 100644 Binary files a/liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar and b/liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar differ diff --git a/liferay-plugins-sdk-6.2/dist/portos-mail-manager-shared-6.2.0.1.jar b/liferay-plugins-sdk-6.2/dist/portos-mail-manager-shared-6.2.0.1.jar index e1587c22..f39f0670 100644 Binary files a/liferay-plugins-sdk-6.2/dist/portos-mail-manager-shared-6.2.0.1.jar and b/liferay-plugins-sdk-6.2/dist/portos-mail-manager-shared-6.2.0.1.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/build.xml b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/build.xml index cd2ce313..70cc9d5d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/build.xml +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/build.xml @@ -2,6 +2,6 @@ - + \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bcmail-jdk14.jar b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bcmail-jdk14.jar new file mode 100644 index 00000000..ab606b5f Binary files /dev/null and b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bcmail-jdk14.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bcprov-jdk14.jar b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bcprov-jdk14.jar new file mode 100644 index 00000000..d1befb7f Binary files /dev/null and b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bcprov-jdk14.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bctsp-jdk14.jar b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bctsp-jdk14.jar new file mode 100644 index 00000000..058fde1e Binary files /dev/null and b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bctsp-jdk14.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar index 93f5d5a1..6af7064e 100644 Binary files a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar and b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-mail-manager-shared.jar b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-mail-manager-shared.jar new file mode 100644 index 00000000..f39f0670 Binary files /dev/null and b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-mail-manager-shared.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/liferay-plugin-package.properties b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/liferay-plugin-package.properties index 1aa8ff17..8c1df76e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/liferay-plugin-package.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/liferay-plugin-package.properties @@ -13,6 +13,11 @@ portal-dependency-jars=\ jstl-api.jar,\ jstl-impl.jar,\ commons-codec.jar,\ - flexjson.jar + flexjson.jar,\ + commons-beanutils.jar,\ + commons-digester.jar,\ + commons-io.jar,\ + commons-lang.jar,\ + commons-collections.jar required-deployment-contexts=\ portos-bo-portlet 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 34d8438f..5477b206 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 @@ -1,5 +1,22 @@ package it.tref.liferay.portos.accesso.atti.portlet; +import com.liferay.counter.service.CounterLocalServiceUtil; +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.json.JSONFactoryUtil; +import com.liferay.portal.kernel.json.JSONObject; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.servlet.SessionErrors; +import com.liferay.portal.kernel.upload.UploadPortletRequest; +import com.liferay.portal.kernel.util.ParamUtil; +import com.liferay.portal.kernel.util.WebKeys; +import com.liferay.portal.service.ServiceContext; +import com.liferay.portal.service.ServiceContextFactory; +import com.liferay.portal.theme.ThemeDisplay; +import com.liferay.portal.util.PortalUtil; +import com.liferay.util.bridges.mvc.MVCPortlet; + import it.tref.liferay.portos.accesso.atti.model.RichiestaAccessoAtti; import it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil; import it.tref.liferay.portos.accesso.atti.uti.DocumentLibraryUtil; @@ -7,29 +24,21 @@ import it.tref.liferay.portos.accesso.atti.uti.EmailSenderUtil; import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.util.ProtocolloUtil; +import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil; +import it.tref.liferay.portos.mailmanager.shared.model.FileAttachment; import java.io.File; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Calendar; import java.util.Date; +import java.util.List; import javax.mail.internet.AddressException; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; -import com.liferay.counter.service.CounterLocalServiceUtil; -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.servlet.SessionErrors; -import com.liferay.portal.kernel.upload.UploadPortletRequest; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.kernel.util.WebKeys; -import com.liferay.portal.theme.ThemeDisplay; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - /** * Portlet implementation class AccessoAttiFEPortlet */ @@ -42,6 +51,13 @@ public class AccessoAttiFEPortlet extends MVCPortlet { long accessoAttiId = 0L; ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); + ServiceContext serviceContext = null; + try { + serviceContext = ServiceContextFactory.getInstance(actionRequest); + } catch (PortalException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date dataCheck = sdf.parse("01/01/2015"); @@ -150,8 +166,27 @@ public class AccessoAttiFEPortlet extends MVCPortlet { } catch (Exception e) { _log.error(e); } + // + String[] to = { richiestaAccessoAtti.getEmailRicontatto() }; + String[] cc = {}; + String[] ccn = {}; + JSONObject templateVariables = JSONFactoryUtil.createJSONObject(); + templateVariables.put("num", richiestaAccessoAtti.getRichiestaAccessoAttiId()); + templateVariables.put("praticaNum", richiestaAccessoAtti.getNumeroProgetto()); + List fileAttachments = new ArrayList<>(); + + try { + MailManagerUtil.sendMailByTemplate(RichiestaAccessoAtti.class.getName(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), + "INVIO-RICHIESTA-ATTI", to, cc, ccn, null, fileAttachments,true ,true,serviceContext); + + MailManagerUtil.sendMailByTemplatName(RichiestaAccessoAtti.class.getName(), richiestaAccessoAtti.getRichiestaAccessoAttiId(), + "INVIO-RICHIESTA-ATTI", to, cc, ccn, templateVariables, fileAttachments, serviceContext); + } catch (Exception e) { + // TODO: handle exception + } - EmailSenderUtil.sendAcceptedRequest(accessoAttiId,themeDisplay.getLocale()); + // + // EmailSenderUtil.sendAcceptedRequest(accessoAttiId,themeDisplay.getLocale()); 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/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 ae000209..b619c0bf 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 @@ -1,22 +1,26 @@ package it.tref.liferay.portos.accesso.atti.uti; import com.liferay.mail.service.MailServiceUtil; -import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.json.JSONFactoryUtil; +import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.mail.MailMessage; -import com.liferay.portal.model.User; -import com.liferay.portal.service.UserLocalServiceUtil; - -import java.util.Locale; +import com.liferay.portal.service.ServiceContext; +import com.liferay.portal.service.ServiceContextFactory; import it.tref.liferay.portos.accesso.atti.model.RichiestaAccessoAtti; import it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil; -import it.tref.liferay.portos.bo.model.IntPratica; -import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; +import it.tref.liferay.portos.mailmanager.shared.messaging.util.MailManagerUtil; +import it.tref.liferay.portos.mailmanager.shared.model.FileAttachment; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; +import javax.servlet.http.HttpServletRequest; public class EmailSenderUtil { @@ -25,6 +29,7 @@ public class EmailSenderUtil { public static void sendAcceptedEmail(long richiestaAccessoAttiId, Locale locale, String testoAggiuntivo) throws SystemException, AddressException{ RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId); +// ServiceContext serviceContext = ServiceContextFactory.getInstance(request); if(richiestaAccessoAtti != null){ InternetAddress toAddress = new InternetAddress(richiestaAccessoAtti.getEmailRicontatto()); @@ -37,6 +42,21 @@ public class EmailSenderUtil { mailMessage.setSubject("Notifica Accettazione Richiesta Accesso Atti"); mailMessage.setBody(creaCorpoMailRichiestaAccettata(richiestaAccessoAtti,locale,testoAggiuntivo)); mailMessage.setHTMLFormat(true); +// +// String[] to = { richiestaAccessoAtti.getEmailRicontatto() }; +// String[] cc = {}; +// String[] ccn = {}; +// JSONObject templateVariables = JSONFactoryUtil.createJSONObject(); +// templateVariables.put("num", richiestaAccessoAttiId); +// templateVariables.put("praticaNum", richiestaAccessoAtti.getNumeroProgetto()); +// List fileAttachments = new ArrayList<>(); +// +// try { +// MailManagerUtil.sendMailByTemplatName(RichiestaAccessoAtti.class.getName(), richiestaAccessoAttiId, +// "INVIO-RICHIESTA-ATTI", to, cc, ccn, templateVariables, fileAttachments, serviceContext); +// } catch (Exception e) { +// // TODO: handle exception +// } /* * Invio email diff --git a/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/build.gradle b/liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/build.gradle deleted file mode 100644 index e69de29b..00000000