Salvatore La Manna 4 anni fa
parent
commit
9975cdd511
  1. 402
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/SismicaAdministrationPortlet.java
  2. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp

402
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/SismicaAdministrationPortlet.java

@ -7,18 +7,27 @@ import it.tref.liferay.portos.bo.model.ControlloPratica;
import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.model.DocPratica; import it.tref.liferay.portos.bo.model.DocPratica;
import it.tref.liferay.portos.bo.model.Pagamento; import it.tref.liferay.portos.bo.model.Pagamento;
import it.tref.liferay.portos.bo.model.Soggetto;
import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ConfigurazioneServiceUtil; import it.tref.liferay.portos.bo.service.ConfigurazioneServiceUtil;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.PagamentoLocalServiceUtil; import it.tref.liferay.portos.bo.service.PagamentoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.SoggettoServiceUtil;
import it.tref.liferay.portos.bo.shared.bean.FirmeBean;
import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants;
import it.tref.liferay.portos.bo.shared.util.FirmeUtil;
import it.tref.liferay.portos.bo.shared.util.TipoSoggettoUtil;
import it.tref.liferay.portos.bo.util.PraticaUtil; import it.tref.liferay.portos.bo.util.PraticaUtil;
import it.tref.liferay.portos.bo.util.ValidazionePraticaUtil;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -34,15 +43,19 @@ import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.repository.model.FileEntry; import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.repository.model.Folder; import com.liferay.portal.kernel.repository.model.Folder;
import com.liferay.portal.kernel.servlet.SessionErrors;
import com.liferay.portal.kernel.upload.UploadPortletRequest; import com.liferay.portal.kernel.upload.UploadPortletRequest;
import com.liferay.portal.kernel.util.HttpUtil;
import com.liferay.portal.kernel.util.MimeTypesUtil; import com.liferay.portal.kernel.util.MimeTypesUtil;
import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.FileUtil; import com.liferay.portal.kernel.util.FileUtil;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.util.WebKeys; import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.model.User;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.ServiceContextFactory; import com.liferay.portal.service.ServiceContextFactory;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portal.util.PortalUtil; import com.liferay.portal.util.PortalUtil;
import com.liferay.portlet.documentlibrary.NoSuchFolderException; import com.liferay.portlet.documentlibrary.NoSuchFolderException;
@ -54,10 +67,11 @@ import com.liferay.util.bridges.mvc.MVCPortlet;
*/ */
public class SismicaAdministrationPortlet extends MVCPortlet { public class SismicaAdministrationPortlet extends MVCPortlet {
private static final Log _log = LogFactoryUtil.getLog(SismicaAdministrationPortlet.class); private static final Log _log = LogFactoryUtil
.getLog(SismicaAdministrationPortlet.class);
public void mostraConfigurazione(ActionRequest actionRequest, ActionResponse actionResponse) public void mostraConfigurazione(ActionRequest actionRequest,
throws SystemException { ActionResponse actionResponse) throws SystemException {
List<String> esito = new ArrayList<String>(); List<String> esito = new ArrayList<String>();
esito.add("<h3>Env</h3>"); esito.add("<h3>Env</h3>");
@ -66,25 +80,36 @@ public class SismicaAdministrationPortlet extends MVCPortlet {
} }
esito.add("<h3>Properties</h3>"); esito.add("<h3>Properties</h3>");
for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { for (Map.Entry<Object, Object> entry : System.getProperties()
.entrySet()) {
esito.add(entry.getKey() + "=" + entry.getValue()); esito.add(entry.getKey() + "=" + entry.getValue());
} }
actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); actionResponse.setRenderParameter("esito",
esito.toArray(new String[esito.size()]));
} }
public void generaDocumenti(ActionRequest actionRequest, ActionResponse actionResponse) { public void generaDocumenti(ActionRequest actionRequest,
ThemeDisplay td = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ActionResponse actionResponse) {
ThemeDisplay td = (ThemeDisplay) actionRequest
.getAttribute(WebKeys.THEME_DISPLAY);
List<String> esito = new ArrayList<>(); List<String> esito = new ArrayList<>();
try { try {
esito = SismicaUtil.generaDocumenti(td.getCompanyId()); esito = SismicaUtil.generaDocumenti(td.getCompanyId());
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
esito.add("Errore durante l'invio " + e.getMessage()); esito.add("Errore durante l'invio " + e.getMessage());
} }
actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); actionResponse.setRenderParameter("esito",
esito.toArray(new String[esito.size()]));
} }
<<<<<<< HEAD
public void sostituisciDL(ActionRequest actionRequest, ActionResponse actionResponse) public void sostituisciDL(ActionRequest actionRequest, ActionResponse actionResponse)
throws SystemException, PortalException, IOException { throws SystemException, PortalException, IOException {
=======
public void sostituisciDL(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
SismicaUtil.sostituisciDL(actionRequest, actionResponse);
>>>>>>> 096838dd46c4f289d1b3f53893c6727c14619a1e
long userId = 0; long userId = 0;
String title = null; String title = null;
String description = null; String description = null;
@ -109,170 +134,259 @@ public class SismicaAdministrationPortlet extends MVCPortlet {
String sourceFileName = uploadRequest.getFileName("file"); String sourceFileName = uploadRequest.getFileName("file");
File file = uploadRequest.getFile("file"); File file = uploadRequest.getFile("file");
Folder folder = null; Folder folder = null;
switch (className) { switch(className){
case "it.tref.liferay.portos.bo.model.DocPratica": case "it.tref.liferay.portos.bo.model.DocPratica":
DocPratica pratica = DocPraticaLocalServiceUtil.getDocPratica(idOggetto); DocPratica pratica = DocPraticaLocalServiceUtil.getDocPratica(idOggetto);
userId = pratica.getUserId(); userId = pratica.getUserId();
companyId = pratica.getCompanyId(); companyId = pratica.getCompanyId();
groupId = pratica.getGroupId(); groupId = pratica.getGroupId();
serviceContext.setCompanyId(companyId); serviceContext.setCompanyId(companyId);
serviceContext.setScopeGroupId(groupId); serviceContext.setScopeGroupId(groupId);
serviceContext.setUserId(userId); serviceContext.setUserId(userId);
defaultFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, defaultFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, ConfigurazioneConstants.ATTACHMENT_FOLDER_ID);
ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); defaultFolder = DLAppLocalServiceUtil.getFolder(defaultFolderId);
defaultFolder = DLAppLocalServiceUtil.getFolder(defaultFolderId); folderName = PraticaUtil.getFolderName(pratica.getClassPk());
folderName = PraticaUtil.getFolderName(pratica.getClassPk()); folderId = defaultFolder.getFolderId();
folderId = defaultFolder.getFolderId(); repositoryId = defaultFolder.getRepositoryId();
repositoryId = defaultFolder.getRepositoryId();
try {
try { folder = DLAppLocalServiceUtil.getFolder(repositoryId, folderId, folderName);
folder = DLAppLocalServiceUtil.getFolder(repositoryId, folderId, folderName); } catch (NoSuchFolderException e) {
} catch (NoSuchFolderException e) { folder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, folderId, folderName,
folder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, folderId, folderName, StringPool.BLANK, serviceContext);
StringPool.BLANK, serviceContext); }
}
bytes = FileUtil.getBytes(file);
bytes = FileUtil.getBytes(file); title = pratica.getTipologia() + StringPool.UNDERLINE + sourceFileName;
title = pratica.getTipologia() + StringPool.UNDERLINE + sourceFileName; description = sourceFileName;
description = sourceFileName; mimeType = MimeTypesUtil.getContentType(sourceFileName);
mimeType = MimeTypesUtil.getContentType(sourceFileName);
try {
/* fileEntry = DLAppLocalServiceUtil.getFileEntry(pratica.getDlFileEntryId());
* try { fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntry.getFileEntryId(),
* DLAppLocalServiceUtil.deleteFileEntry(pratica.getDlFileEntryId now.getTime() + "_" + sourceFileName, mimeType, title, description, changeLog, false, bytes,
* ()); } catch(PortalException e){ serviceContext);
* } catch (PortalException e) {
* } fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, folder.getRepositoryId(), folder.getFolderId(), now.getTime() + "_" + sourceFileName,
*/ mimeType, title, description, changeLog, bytes, serviceContext);
}
try {
fileEntry = DLAppLocalServiceUtil.getFileEntry(pratica.getDlFileEntryId()); pratica.setDlFileEntryId(fileEntry.getFileEntryId());
fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntry.getFileEntryId(), pratica.setSha256(DigestUtils.sha256Hex(bytes));
now.getTime() + "_" + sourceFileName, mimeType, title, description, changeLog, false, DocPraticaLocalServiceUtil.updateDocPratica(pratica);
bytes, serviceContext); break;
} catch (PortalException e) {
fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, folder.getRepositoryId(), case "it.tref.liferay.portos.bo.model.Pagamento":
folder.getFolderId(), now.getTime() + "_" + sourceFileName, mimeType, title, Pagamento pagamento = PagamentoLocalServiceUtil.getPagamento(idOggetto);
description, changeLog, bytes, serviceContext); userId = pagamento.getUserId();
} companyId = pagamento.getCompanyId();
groupId = pagamento.getGroupId();
pratica.setDlFileEntryId(fileEntry.getFileEntryId());
pratica.setSha256(DigestUtils.sha256Hex(bytes)); serviceContext.setCompanyId(companyId);
DocPraticaLocalServiceUtil.updateDocPratica(pratica); serviceContext.setScopeGroupId(groupId);
break; serviceContext.setUserId(userId);
case "it.tref.liferay.portos.bo.model.Pagamento": defaultFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, ConfigurazioneConstants.ATTACHMENT_FOLDER_ID);
Pagamento pagamento = PagamentoLocalServiceUtil.getPagamento(idOggetto); defaultFolder = DLAppLocalServiceUtil.getFolder(defaultFolderId);
userId = pagamento.getUserId(); folderName = PraticaUtil.getFolderName(pagamento.getClassPk());
companyId = pagamento.getCompanyId(); folderId = defaultFolder.getFolderId();
groupId = pagamento.getGroupId(); repositoryId = defaultFolder.getRepositoryId();
serviceContext.setCompanyId(companyId); try {
serviceContext.setScopeGroupId(groupId); folder = DLAppLocalServiceUtil.getFolder(repositoryId, folderId, folderName);
serviceContext.setUserId(userId); } catch (NoSuchFolderException e) {
folder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, folderId, folderName,
defaultFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, StringPool.BLANK, serviceContext);
ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); }
defaultFolder = DLAppLocalServiceUtil.getFolder(defaultFolderId);
folderName = PraticaUtil.getFolderName(pagamento.getClassPk()); bytes = FileUtil.getBytes(file);
folderId = defaultFolder.getFolderId(); title = now.getTime() + StringPool.UNDERLINE + "pagamento_manuale" + StringPool.UNDERLINE
repositoryId = defaultFolder.getRepositoryId(); + pagamento.getPagamentoId() + StringPool.UNDERLINE + sourceFileName;
description = StringPool.BLANK;
try { mimeType = MimeTypesUtil.getContentType(sourceFileName);
folder = DLAppLocalServiceUtil.getFolder(repositoryId, folderId, folderName);
} catch (NoSuchFolderException e) { try {
folder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, folderId, folderName, fileEntry = DLAppLocalServiceUtil.getFileEntry(pagamento.getFileEntryId());
StringPool.BLANK, serviceContext); fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntry.getFileEntryId(),
} now.getTime() + "_" + sourceFileName, mimeType, title, description, changeLog, false, bytes,
serviceContext);
bytes = FileUtil.getBytes(file); } catch (PortalException e) {
title = now.getTime() + StringPool.UNDERLINE + "pagamento_manuale" + StringPool.UNDERLINE fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, folder.getRepositoryId(), folder.getFolderId(), now.getTime() + "_" + sourceFileName,
+ pagamento.getPagamentoId() + StringPool.UNDERLINE + sourceFileName; mimeType, title, description, changeLog, bytes, serviceContext);
description = StringPool.BLANK; }
mimeType = MimeTypesUtil.getContentType(sourceFileName);
pagamento.setFileEntryId(fileEntry.getFileEntryId());
/* PagamentoLocalServiceUtil.updatePagamento(pagamento);
* try { break;
* DLAppLocalServiceUtil.deleteFileEntry(pagamento.getFileEntryId
* ()); } catch(PortalException e){ case "var_soggetti_no_docpratica":
* Soggetto soggetto = SoggettoLocalServiceUtil.getSoggetto(idOggetto);
* } DettPratica dettPratica = DettPraticaLocalServiceUtil.getDettPratica(soggetto.getDettPraticaId());
*/ long intPraticaId = dettPratica.getIntPraticaId();
serviceContext = ServiceContextFactory.getInstance(Soggetto.class.getName(), actionRequest);
try {
fileEntry = DLAppLocalServiceUtil.getFileEntry(pagamento.getFileEntryId()); byte[] content = null;
fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntry.getFileEntryId(), String jsonFirmatari = "";
now.getTime() + "_" + sourceFileName, mimeType, title, description, changeLog, false, boolean isSigned = false;
bytes, serviceContext); FirmeBean firmeBean = new FirmeBean();
} catch (PortalException e) {
fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, folder.getRepositoryId(),
folder.getFolderId(), now.getTime() + "_" + sourceFileName, mimeType, title, User user = UserLocalServiceUtil.getUser(serviceContext.getUserId());
description, changeLog, bytes, serviceContext);
} if (!firmeBean.allSignatures().contains(user.getScreenName())) {
jsonFirmatari = FirmeUtil.addFirma(firmeBean, user.getScreenName());
pagamento.setFileEntryId(fileEntry.getFileEntryId()); } else {
PagamentoLocalServiceUtil.updatePagamento(pagamento); jsonFirmatari = FirmeUtil.serialize(firmeBean);
break; }
default: if (file.exists()) {
break; if (Validator.isNotNull(sourceFileName) && file != null) {
// validazione: solo alcune estensioni
String ext = FileUtil.getExtension(sourceFileName);
if (!ext.equalsIgnoreCase("p7m")
&& !ext.equalsIgnoreCase("pdf")) {
SessionErrors
.add(actionRequest,
"error.geniocivilefe.variazione-soggetto.allegato.ext.valid");
}
// lunghezza fissata a 200
if (sourceFileName.length() > 200) {
SessionErrors
.add(actionRequest,
"error.geniocivilefe.variazione-soggetto.allegato.length.valid");
}
} else if (!TipoSoggettoUtil.COMMITTENTE
.equalsIgnoreCase(soggetto.getTipologiaSoggetto())) {
SessionErrors
.add(actionRequest,
"error.geniocivilefe.variazione-soggetto.allegato.is.request");
}
if (!SessionErrors.isEmpty(actionRequest)) {
throw new SystemException(
"error.geniocivilefe.variazione-soggetto.allegato");
} else if (file != null) {
content = FileUtil.getBytes(file);
}
}
if (TipoSoggettoUtil.COMMITTENTE.equals(soggetto
.getTipologiaSoggetto())) {
String[] titolare = new String[] { dettPratica
.getCodiceFiscaleDelegatoCommittente() };
isSigned = ValidazionePraticaUtil.isAllegatoSignedBySubjects(
sourceFileName, content, serviceContext.getCompanyId(),
Arrays.asList(titolare), jsonFirmatari);
} else {
List<Soggetto> soggettiValidi = SoggettoServiceUtil
.getValidTmpByIntPratica(intPraticaId);
List<String> codiciFiscaliValidi = new ArrayList<String>();
for (Soggetto valido : soggettiValidi) {
if (!codiciFiscaliValidi
.contains(valido.getCodiceFiscale())
&& !valido.getCodiceFiscale().equalsIgnoreCase(
soggetto.getCodiceFiscale())) {
codiciFiscaliValidi.add(valido.getCodiceFiscale());
}
}
isSigned = ValidazionePraticaUtil
.isAllegatoSignedBySubjectsAndPerson(sourceFileName,
content, serviceContext.getCompanyId(),
codiciFiscaliValidi,
soggetto.getCodiceFiscale(), jsonFirmatari);
}
if(isSigned){
userId = PortalUtil.getUserId(actionRequest);
try {
SoggettoServiceUtil.allegaFileModifica(soggetto.getSoggettoId(), userId, intPraticaId, content, sourceFileName, jsonFirmatari,
serviceContext);
} catch (PortalException e) {
_log.error(e, e);
throw e;
}
}
break;
default:
break;
} }
} }
public void resetFirme(ActionRequest actionRequest, ActionResponse actionResponse) { public void resetFirme(ActionRequest actionRequest,
ThemeDisplay td = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ActionResponse actionResponse) {
String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto"); ThemeDisplay td = (ThemeDisplay) actionRequest
.getAttribute(WebKeys.THEME_DISPLAY);
String numeroProgetto = ParamUtil.getString(actionRequest,
"numeroProgetto");
List<String> esito = new ArrayList<>(); List<String> esito = new ArrayList<>();
try { try {
esito = SismicaUtil.resetFirme(td.getCompanyId(), numeroProgetto); esito = SismicaUtil.resetFirme(td.getCompanyId(), numeroProgetto);
} catch (SystemException | PortalException e) { } catch (SystemException | PortalException e) {
esito.add("Errore durante l'invio " + e.getMessage()); esito.add("Errore durante l'invio " + e.getMessage());
} }
actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); actionResponse.setRenderParameter("esito",
esito.toArray(new String[esito.size()]));
} }
public void reIndexFasciolo(ActionRequest actionRequest, ActionResponse actionResponse) public void reIndexFasciolo(ActionRequest actionRequest,
throws PortalException, SystemException { ActionResponse actionResponse) throws PortalException,
SystemException {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
.getAttribute(WebKeys.THEME_DISPLAY);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId"); long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId");
if (Validator.isNotNull(intPraticaId)) { if (Validator.isNotNull(intPraticaId)) {
IntPraticaLocalServiceUtil.reIndexFasciolo(intPraticaId, themeDisplay.getCompanyId()); IntPraticaLocalServiceUtil.reIndexFasciolo(intPraticaId,
themeDisplay.getCompanyId());
} }
String numeroProgetto = ParamUtil.getString(actionRequest, "numeroProgetto"); String numeroProgetto = ParamUtil.getString(actionRequest,
"numeroProgetto");
if (Validator.isNotNull(numeroProgetto)) { if (Validator.isNotNull(numeroProgetto)) {
IntPraticaLocalServiceUtil.reIndexFasciolo(numeroProgetto, themeDisplay.getCompanyId()); IntPraticaLocalServiceUtil.reIndexFasciolo(numeroProgetto,
themeDisplay.getCompanyId());
} }
} }
public void reIndexFascicoli(ActionRequest actionRequest, ActionResponse actionResponse) { public void reIndexFascicoli(ActionRequest actionRequest,
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ActionResponse actionResponse) {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
.getAttribute(WebKeys.THEME_DISPLAY);
List<String> esito = null; List<String> esito = null;
esito = SismicaUtil.reIndexFascicoli(themeDisplay.getCompanyId()); esito = SismicaUtil.reIndexFascicoli(themeDisplay.getCompanyId());
if (esito != null) if (esito != null)
actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); actionResponse.setRenderParameter("esito",
esito.toArray(new String[esito.size()]));
} }
public void lanciaSorteggio(ActionRequest actionRequest, ActionResponse actionResponse) { public void lanciaSorteggio(ActionRequest actionRequest,
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ActionResponse actionResponse) {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
.getAttribute(WebKeys.THEME_DISPLAY);
List<String> esito = null; List<String> esito = null;
_log.info("Sorteggio lanciato manualmente"); _log.info("Sorteggio lanciato manualmente");
try { try {
esito = SorteggioPraticaUtil.sorteggio(themeDisplay.getCompanyId(), new Date()); esito = SorteggioPraticaUtil.sorteggio(themeDisplay.getCompanyId(),
new Date());
} catch (PortalException | SystemException e) { } catch (PortalException | SystemException e) {
_log.error("error", e); _log.error("error", e);
} }
if (esito != null) if (esito != null)
actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); actionResponse.setRenderParameter("esito",
esito.toArray(new String[esito.size()]));
} }
public void testInterno(ActionRequest actionRequest, ActionResponse actionResponse) public void testInterno(ActionRequest actionRequest, ActionResponse actionResponse)
@ -287,18 +401,22 @@ public class SismicaAdministrationPortlet extends MVCPortlet {
SismicaUtil.inviaAvviso(actionRequest, actionResponse); SismicaUtil.inviaAvviso(actionRequest, actionResponse);
} }
public void salvaDataProssimoSorteggio(ActionRequest actionRequest, ActionResponse actionResponse) public void salvaDataProssimoSorteggio(ActionRequest actionRequest,
throws PortalException, SystemException { ActionResponse actionResponse) throws PortalException,
SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory
.getInstance(actionRequest);
serviceContext.setScopeGroupId(-1L); serviceContext.setScopeGroupId(-1L);
serviceContext.setCompanyId(serviceContext.getCompanyId()); serviceContext.setCompanyId(serviceContext.getCompanyId());
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date dataProssimoSorteggio = ParamUtil.getDate(actionRequest, "dataProssimoSorteggio", sdf); Date dataProssimoSorteggio = ParamUtil.getDate(actionRequest,
"dataProssimoSorteggio", sdf);
ConfigurazioneServiceUtil.storeConfig("conf.geniocivile.sorteggio.data.prossimo.sorteggio", ConfigurazioneServiceUtil.storeConfig(
"conf.geniocivile.sorteggio.data.prossimo.sorteggio",
sdf.format(dataProssimoSorteggio), serviceContext); sdf.format(dataProssimoSorteggio), serviceContext);
} }

4
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp

@ -176,6 +176,10 @@ String dataProssimoSorteggio =
value="<%=DocPratica.class.getName()%>"></aui:option> value="<%=DocPratica.class.getName()%>"></aui:option>
<aui:option label="Pagamento (allegato)" selected="<%=oggetto.equals(Pagamento.class.getName())%>" <aui:option label="Pagamento (allegato)" selected="<%=oggetto.equals(Pagamento.class.getName())%>"
value="<%=Pagamento.class.getName()%>"></aui:option> value="<%=Pagamento.class.getName()%>"></aui:option>
<aui:option label="Variazione Soggetti (no DocPratica)" selected="<%=oggetto.equals(Pagamento.class.getName())%>"
value="var_soggetti_no_docpratica"></aui:option>
<aui:option label="Variazione Soggetti (solo FileEntry)" selected="<%=oggetto.equals(Pagamento.class.getName())%>"
value="var_soggetti_solo_fileentry"></aui:option>
</aui:select> </aui:select>
<aui:input type="file" name="file" label="File" /> <aui:input type="file" name="file" label="File" />
<aui:input name="classPK" label="Id oggetto"> <aui:input name="classPK" label="Id oggetto">

Caricamento…
Annulla
Salva