Sfoglia il codice sorgente

Avanzamento Integrazione mail manager

feature/accesso-atti
abianchi7701 1 anno fa
parent
commit
25065e2ff2
  1. BIN
      liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar
  2. BIN
      liferay-plugins-sdk-6.2/dist/portos-mail-manager-shared-6.2.0.1.jar
  3. 2
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/build.xml
  4. BIN
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bcmail-jdk14.jar
  5. BIN
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bcprov-jdk14.jar
  6. BIN
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bctsp-jdk14.jar
  7. BIN
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar
  8. BIN
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-mail-manager-shared.jar
  9. 7
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/liferay-plugin-package.properties
  10. 61
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/portlet/AccessoAttiFEPortlet.java
  11. 34
      liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/EmailSenderUtil.java
  12. 0
      liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/build.gradle

BIN
liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar vendored

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/dist/portos-mail-manager-shared-6.2.0.1.jar vendored

File binario non mostrato.

2
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/build.xml

@ -2,6 +2,6 @@
<!DOCTYPE project>
<project name="portos-accesso-atti-portlet" basedir="." default="deploy">
<property name="import.shared" value="portos-bo-shared" />
<property name="import.shared" value="portos-bo-shared,portos-mail-manager-shared" />
<import file="../build-common-portlet.xml" />
</project>

BIN
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bcmail-jdk14.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bcprov-jdk14.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/bctsp-jdk14.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/lib/portos-mail-manager-shared.jar

File binario non mostrato.

7
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

61
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<FileAttachment> 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");

34
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<FileAttachment> 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

0
liferay-plugins-sdk-6.2/shared/portos-mail-manager-shared/build.gradle

Caricamento…
Annulla
Salva