|
|
@ -1,5 +1,22 @@ |
|
|
|
package it.tref.liferay.portos.accesso.atti.portlet; |
|
|
|
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.model.RichiestaAccessoAtti; |
|
|
|
import it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.accesso.atti.uti.DocumentLibraryUtil; |
|
|
|
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.model.IntPratica; |
|
|
|
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.util.ProtocolloUtil; |
|
|
|
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.io.File; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import javax.mail.internet.AddressException; |
|
|
|
import javax.mail.internet.AddressException; |
|
|
|
import javax.portlet.ActionRequest; |
|
|
|
import javax.portlet.ActionRequest; |
|
|
|
import javax.portlet.ActionResponse; |
|
|
|
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 |
|
|
|
* Portlet implementation class AccessoAttiFEPortlet |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -42,6 +51,13 @@ public class AccessoAttiFEPortlet extends MVCPortlet { |
|
|
|
long accessoAttiId = 0L; |
|
|
|
long accessoAttiId = 0L; |
|
|
|
|
|
|
|
|
|
|
|
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
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"); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); |
|
|
|
Date dataCheck = sdf.parse("01/01/2015"); |
|
|
|
Date dataCheck = sdf.parse("01/01/2015"); |
|
|
@ -150,8 +166,27 @@ public class AccessoAttiFEPortlet extends MVCPortlet { |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
_log.error(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<>(); |
|
|
|
|
|
|
|
|
|
|
|
EmailSenderUtil.sendAcceptedRequest(accessoAttiId,themeDisplay.getLocale()); |
|
|
|
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());
|
|
|
|
actionResponse.setRenderParameter("jspPage","/html/accesso_atti_fe/richiesta-inviata-success.jsp"); |
|
|
|
actionResponse.setRenderParameter("jspPage","/html/accesso_atti_fe/richiesta-inviata-success.jsp"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|