Sfoglia il codice sorgente

Corretta applicazione protocollo su documenti provenienti da scanner

Salvatore La Manna 4 anni fa
parent
commit
e6e8264dd9
  1. 3
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/.settings/org.eclipse.wst.common.component
  2. 6
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpServiceUtil.java
  3. 25
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/AllegatiManualiPortlet.java
  4. 9
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java
  5. 24
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraProtocollo.java
  6. 231
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java
  7. 87
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AllegatoManualeLocalServiceImpl.java
  8. 293
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java
  9. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/resource/asseverazioni/calcolista.html
  10. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties
  11. 630
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/soggettipratica/view.jsp
  12. 31
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/META-INF/messaging-spring.xml
  13. 126
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java
  14. 115
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java
  15. 4
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties
  16. 64
      liferay-plugins-sdk-6.2/shared/portos-report-shared/src/it/tref/liferay/portos/report/shared/util/ReportUtil.java

3
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/.settings/org.eclipse.wst.common.component

@ -6,6 +6,9 @@
<dependent-module archiveName="hms-taglib-hook-service.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/hms-taglib-hook/docroot/WEB-INF/lib/hms-taglib-hook-service.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="portos-mail-manager-portlet-service.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/portos-mail-manager-portlet/docroot/WEB-INF/lib/portos-mail-manager-portlet-service.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="portos-kaleo-portlet-service.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/portos-kaleo-portlet/docroot/WEB-INF/lib/portos-kaleo-portlet-service.jar">
<dependency-type>uses</dependency-type>
</dependent-module>

6
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpServiceUtil.java

@ -20,9 +20,9 @@ import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.Http.Body;
import com.liferay.portal.kernel.util.Http.Options;
import com.liferay.portal.kernel.util.HttpUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Http.Options;
public class HttpServiceUtil {
private static final Log _log = LogFactoryUtil.getLog(HttpServiceUtil.class);
@ -49,9 +49,6 @@ public class HttpServiceUtil {
if (statusCode == HttpServletResponse.SC_OK || statusCode == HttpServletResponse.SC_CREATED) {
risposta = JSONFactoryUtil.createJSONObject(responseBody);
_log.info(url + " || " + json + " || " + risposta + " || " + responseBody);
} else {
_log.info(url + " || " + json + " || " + statusCode + ": " + responseBody);
}
return risposta;
}
@ -85,7 +82,6 @@ public class HttpServiceUtil {
String responseBody = HttpUtil.URLtoString(options);
_log.info(url + " || " + responseBody);
if (options.getResponse().getResponseCode() != HttpServletResponse.SC_OK) {
throw new Exception(url + ": " + options.getResponse().getResponseCode());
// responseBody = defaultValue;

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

@ -61,9 +61,8 @@ public class AllegatiManualiPortlet extends MVCPortlet {
// validazione: solo alcune estensioni
String ext = FileUtil.getExtension(sourceFileName);
if (!ext.equalsIgnoreCase("pdf")) {
SessionErrors.add(actionRequest,"error.geniocivilefe.pratica.allegato.ext.valid");
SessionErrors.add(actionRequest, "error.geniocivilefe.pratica.allegato.ext.valid");
}
// lunghezza fissata a 200
if (sourceFileName.length() > 200) {
SessionErrors.add(actionRequest, "error.geniocivilefe.allegato.manuale.length.valid");
@ -72,18 +71,13 @@ public class AllegatiManualiPortlet extends MVCPortlet {
SessionErrors.add(actionRequest, "error.geniocivilefe.allegato.manuale.is.request");
}
if (!SessionErrors.isEmpty(actionRequest)) {
PortalUtil.copyRequestParameters(actionRequest, actionResponse);
} else {
if (SessionErrors.isEmpty(actionRequest)) {
if (Validator.isNotNull(intPraticaId) && Validator.isNotNull(dettPraticaId)) {
byte[] content = FileUtil.getBytes(file);
AllegatoManualeLocalServiceUtil
.addAllegatoManuale(serviceContext.getUserId(), intPraticaId, dettPraticaId,
descrizione, content, sourceFileName, serviceContext);
AllegatoManualeLocalServiceUtil.addAllegatoManuale(serviceContext.getUserId(), intPraticaId,
dettPraticaId, descrizione, content, sourceFileName, serviceContext);
}
}
PortalUtil.copyRequestParameters(actionRequest, actionResponse);
} catch (Exception e) {
PortalUtil.copyRequestParameters(actionRequest, actionResponse);
@ -93,15 +87,14 @@ public class AllegatiManualiPortlet extends MVCPortlet {
}
public void deleteAllegatoManuale(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
public void deleteAllegatoManuale(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long allegatoManualeId = ParamUtil.getLong(actionRequest, "allegatoManualeId");
AllegatoManualeServiceUtil.deleteAllegatoManuale(allegatoManualeId);
}
@Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
throws IOException, PortletException {
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
PortletException {
String id = resourceRequest.getResourceID();
@ -134,8 +127,8 @@ public class AllegatiManualiPortlet extends MVCPortlet {
resourceResponse.setContentType(ContentTypes.APPLICATION_ZIP);
resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate");
resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\""
+ file.getName() + "\"");
resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"" + file.getName() + "\"");
resourceResponse.setContentLength(data.length);
resourceResponse.getPortletOutputStream().write(data);

9
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraDocumento.java

@ -21,7 +21,6 @@ import it.tref.liferay.portos.report.shared.util.ReportUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@ -51,6 +50,7 @@ public class SchedulerGeneraDocumento implements MessageListener {
private static final int SIZE = 10;
@Override
public void receive(Message message) throws MessageListenerException {
if (lock.tryLock()) {
@ -177,13 +177,6 @@ public class SchedulerGeneraDocumento implements MessageListener {
reportDto.setShowNumberOfPage(true);
reportDto.setType(ReportConstants.ReportType.JRXML_TO_PDF.toString());
_log.info("*********************************************************");
_log.info("generaDocumento: generateReport: " + fileEntryIdTemplate);
for (Entry<String, Object> entry : parameters.entrySet()) {
_log.info(entry.getKey() + " = " + entry.getValue());
}
_log.info("*********************************************************");
ReportResultDto result = ReportUtil.generateReport(companyId, userId, reportDto, bean);
idFileEntry = result.getFileEntryIds()[0];
// idFileEntry = (Long)

24
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerGeneraProtocollo.java

@ -37,48 +37,34 @@ public class SchedulerGeneraProtocollo implements MessageListener {
@Override
public void receive(Message message) throws MessageListenerException {
long avvisoId = 0l;
long avvisoId = 0L;
if (lock.tryLock()) {
_log.debug("SchedulerGeneraProtocollo - inizio");
try {
List<Avviso> avvisiList = AvvisoLocalServiceUtil.getAvvisiPerAggiuntaProtocollo(-1, SIZE);
if (Validator.isNotNull(avvisiList) && !avvisiList.isEmpty()) {
for (Avviso avviso : avvisiList) {
_log.info("SchedulerGeneraProtocollo - avviso " + avviso.getAvvisoId());
try {
avvisoId = avviso.getAvvisoId();
FileEntry fileEntryBase = DLAppLocalServiceUtil.getFileEntry(avviso
.getFileEntryIdBase());
FileEntry fileEntryBase = DLAppLocalServiceUtil.getFileEntry(avviso.getFileEntryIdBase());
if (Validator.isNotNull(fileEntryBase)) {
generaProtocollo(avviso, fileEntryBase);
}
} catch (PortalException e) {
_log.debug("SchedulerGeneraProtocollo - non esiste file base | avvisoId="
+ avvisoId);
_log.debug("SchedulerGeneraProtocollo - non esiste file base | avvisoId=" + avvisoId);
}
}
}
} catch (SystemException e) {
_log.error(e, e);
} finally {
lock.unlock();
}
}
}
private void generaProtocollo(Avviso avviso, FileEntry fileEntry) throws ReportGenerationException,
SystemException {
private void generaProtocollo(Avviso avviso, FileEntry fileEntry) throws ReportGenerationException, SystemException {
long companyId = avviso.getCompanyId();
long userId = avviso.getUserId();
@ -108,10 +94,8 @@ public class SchedulerGeneraProtocollo implements MessageListener {
avvisoModified.setFileEntryIdInvio(idFileEntry);
avvisoModified.setDtCreateFileEntryInvio(new Date());
}
AvvisoLocalServiceUtil.updateAvviso(avvisoModified);
}
}
}
}

231
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/scheduler/SchedulerPratiche.java

@ -56,35 +56,23 @@ public class SchedulerPratiche implements MessageListener {
@Override
public void receive(Message message) throws MessageListenerException {
if (lock.tryLock()) {
try {
/*
* Fascicoli Senza progetto
*/
int count = IntPraticaLocalServiceUtil.countFascicoliNotProgetto();
if (count > 0) {
for (int cursor = 0; cursor <= count; cursor += SIZE) {
List<IntPratica> intPratiche = IntPraticaLocalServiceUtil.findFascicoliNotProgetto(
cursor, cursor + SIZE);
List<IntPratica> intPratiche = IntPraticaLocalServiceUtil.findFascicoliNotProgetto(cursor,
cursor + SIZE);
for (IntPratica intPratica : intPratiche) {
try {
User user = UserLocalServiceUtil.getUser(intPratica.getUserId());
PrincipalThreadLocal.setName(user.getUserId());
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil
.create(user);
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(permissionChecker);
assegnaNumeroProgetto(intPratica);
} catch (Exception e) {
_log.error("Error", e);
} finally {
@ -94,33 +82,21 @@ public class SchedulerPratiche implements MessageListener {
}
}
}
/*
* Pratiche gestite ma senza protocollo
*/
count = DettPraticaLocalServiceUtil.countPraticheCompleteNotProtocollo();
if (count > 0) {
for (int cursor = 0; cursor <= count; cursor += SIZE) {
List<DettPratica> dettPratiche = DettPraticaLocalServiceUtil
.findPraticheCompleteNotProtocollo(cursor, cursor + SIZE);
List<DettPratica> dettPratiche = DettPraticaLocalServiceUtil.findPraticheCompleteNotProtocollo(
cursor, cursor + SIZE);
for (DettPratica dettPratica : dettPratiche) {
try {
User user = UserLocalServiceUtil.getUser(dettPratica.getUserId());
PrincipalThreadLocal.setName(user.getUserId());
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil
.create(user);
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(permissionChecker);
protocollazione(dettPratica.getCompanyId(), dettPratica.getGroupId(),
dettPratica);
protocollazione(dettPratica.getCompanyId(), dettPratica.getGroupId(), dettPratica);
} catch (Exception e) {
_log.error("Error DettPraticaId=" + dettPratica.getDettPraticaId(), e);
} finally {
@ -130,33 +106,21 @@ public class SchedulerPratiche implements MessageListener {
}
}
}
/*
* Fine Lavori complete ma senza protocollo
*/
count = FineLavoriLocalServiceUtil.countFineLavoriCompleteNotProtocollo();
if (count > 0) {
for (int cursor = 0; cursor <= count; cursor += SIZE) {
List<FineLavori> fineLavoris = FineLavoriLocalServiceUtil
.findFineLavoriCompleteNotProtocollo(cursor, cursor + SIZE);
List<FineLavori> fineLavoris = FineLavoriLocalServiceUtil.findFineLavoriCompleteNotProtocollo(
cursor, cursor + SIZE);
for (FineLavori fineLavori : fineLavoris) {
try {
User user = UserLocalServiceUtil.getUser(fineLavori.getUserId());
PrincipalThreadLocal.setName(user.getUserId());
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil
.create(user);
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(permissionChecker);
protocollazione(fineLavori.getCompanyId(), fineLavori.getGroupId(),
fineLavori);
protocollazione(fineLavori.getCompanyId(), fineLavori.getGroupId(), fineLavori);
} catch (Exception e) {
_log.error("Error fineLavoriId=" + fineLavori.getFineLavoriId(), e);
} finally {
@ -166,36 +130,25 @@ public class SchedulerPratiche implements MessageListener {
}
}
}
/*
* Fine Lavori complete con protocollo non gestite
*/
count = FineLavoriLocalServiceUtil.countFineLavoriCompleteNotGestite();
if (count > 0) {
for (int cursor = 0; cursor <= count; cursor += SIZE) {
List<FineLavori> fineLavoris = FineLavoriLocalServiceUtil
.findFineLavoriCompleteNotGestite(cursor, cursor + SIZE);
List<FineLavori> fineLavoris = FineLavoriLocalServiceUtil.findFineLavoriCompleteNotGestite(
cursor, cursor + SIZE);
for (FineLavori fineLavori : fineLavoris) {
try {
User user = UserLocalServiceUtil.getUser(fineLavori.getUserId());
PrincipalThreadLocal.setName(user.getUserId());
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil
.create(user);
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(permissionChecker);
creaAvvisoVidimazione(fineLavori.getCompanyId(), fineLavori.getGroupId(),
fineLavori.getUserId(), fineLavori.getIntPraticaId(),
fineLavori.getFineLavoriId(), FineLavori.class.getName());
fineLavori.setGestita(true);
FineLavoriLocalServiceUtil.updateFineLavori(fineLavori);
} catch (Exception e) {
_log.error("Error", e);
} finally {
@ -208,28 +161,18 @@ public class SchedulerPratiche implements MessageListener {
/*
* Collaudi complete ma senza protocollo
*/
count = CollaudoLocalServiceUtil.countCollaudiCompletiNotProtocollo();
if (count > 0) {
for (int cursor = 0; cursor <= count; cursor += SIZE) {
List<Collaudo> collaudi = CollaudoLocalServiceUtil.findCollaudiCompletiNotProtocollo(
cursor, cursor + SIZE);
List<Collaudo> collaudi = CollaudoLocalServiceUtil.findCollaudiCompletiNotProtocollo(cursor,
cursor + SIZE);
for (Collaudo collaudo : collaudi) {
try {
User user = UserLocalServiceUtil.getUser(collaudo.getUserId());
PrincipalThreadLocal.setName(user.getUserId());
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil
.create(user);
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(permissionChecker);
protocollazione(collaudo.getCompanyId(), collaudo.getGroupId(), collaudo);
} catch (Exception e) {
_log.error("Error collaudoId=" + collaudo.getCollaudoId(), e);
} finally {
@ -242,32 +185,22 @@ public class SchedulerPratiche implements MessageListener {
/*
* Collaudi complete con protocollo non gestiti
*/
count = CollaudoLocalServiceUtil.countCollaudiCompletiNotGestiti();
if (count > 0) {
for (int cursor = 0; cursor <= count; cursor += SIZE) {
List<Collaudo> collaudi = CollaudoLocalServiceUtil.findCollaudiCompletiNotGestiti(
cursor, cursor + SIZE);
List<Collaudo> collaudi = CollaudoLocalServiceUtil.findCollaudiCompletiNotGestiti(cursor,
cursor + SIZE);
for (Collaudo collaudo : collaudi) {
try {
User user = UserLocalServiceUtil.getUser(collaudo.getUserId());
PrincipalThreadLocal.setName(user.getUserId());
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil
.create(user);
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(permissionChecker);
creaAvvisoVidimazione(collaudo.getCompanyId(), collaudo.getGroupId(),
collaudo.getUserId(), collaudo.getIntPraticaId(),
collaudo.getCollaudoId(), Collaudo.class.getName());
collaudo.getUserId(), collaudo.getIntPraticaId(), collaudo.getCollaudoId(),
Collaudo.class.getName());
collaudo.setGestita(true);
CollaudoLocalServiceUtil.updateCollaudo(collaudo);
} catch (Exception e) {
_log.error("Error", e);
} finally {
@ -277,29 +210,19 @@ public class SchedulerPratiche implements MessageListener {
}
}
}
// generazioni documenti e avvio workflow
count = DettPraticaLocalServiceUtil.countPraticheCompleteNotGestite();
if (count > 0) {
for (int cursor = 0; cursor <= count; cursor += SIZE) {
List<DettPratica> dettPratiche = DettPraticaLocalServiceUtil
.findPraticheCompleteNotGestite(cursor, cursor + SIZE);
List<DettPratica> dettPratiche = DettPraticaLocalServiceUtil.findPraticheCompleteNotGestite(
cursor, cursor + SIZE);
for (DettPratica dettPratica : dettPratiche) {
try {
User user = UserLocalServiceUtil.getUser(dettPratica.getUserId());
PrincipalThreadLocal.setName(user.getUserId());
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil
.create(user);
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(permissionChecker);
gestionePratica(dettPratica);
} catch (Exception e) {
_log.error("Error", e);
} finally {
@ -309,29 +232,20 @@ public class SchedulerPratiche implements MessageListener {
}
}
}
// versionamento
count = DettPraticaLocalServiceUtil.countPraticheCompletateNonversionate();
if (count > 0) {
for (Company company : CompanyLocalServiceUtil.getCompanies()) {
String condition = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(
company.getCompanyId(), ConfigurazioneConstants.SCHEDULER_VERSIONING);
String condition = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(company.getCompanyId(),
ConfigurazioneConstants.SCHEDULER_VERSIONING);
if (Boolean.parseBoolean(condition)) {
for (int cursor = 0; cursor <= count; cursor += SIZE) {
List<DettPratica> dettPratiche = DettPraticaLocalServiceUtil
.findPraticheCompletateNonVersionate(cursor, cursor + SIZE);
for (DettPratica dettPratica : dettPratiche) {
try {
DettPraticaServiceUtil.sendToVersioning(
dettPratica.getDettPraticaId(), dettPratica.getCompanyId());
DettPraticaServiceUtil.sendToVersioning(dettPratica.getDettPraticaId(),
dettPratica.getCompanyId());
} catch (Exception e) {
_log.error("Error", e);
} finally {
@ -340,12 +254,9 @@ public class SchedulerPratiche implements MessageListener {
}
}
}
}
}
}
} catch (SystemException e) {
_log.error("Error", e);
} finally {
@ -354,8 +265,8 @@ public class SchedulerPratiche implements MessageListener {
}
}
private void creaAvvisoVidimazione(long companyId, long groupId, long userId, long intPraticaId,
long classPk, String className) throws SystemException, PortalException {
private void creaAvvisoVidimazione(long companyId, long groupId, long userId, long intPraticaId, long classPk,
String className) throws SystemException, PortalException {
String descLong = StringPool.BLANK;
Date dtAvviso = new Date();
String tipoAvviso = AvvisoUtil.TIPO_AVVISO_DIRETTO;
@ -371,12 +282,10 @@ public class SchedulerPratiche implements MessageListener {
propertiesTemplateType = StatoPraticaConstants.VARIAZIONE_SOGGETTI;
}
}
String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(
propertiesTemplateType);
long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId,
propertiesTemplate);
String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(propertiesTemplateType);
long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, propertiesTemplate);
long controlloPraticaId = 0l;
long controlloPraticaId = 0L;
ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(companyId);
serviceContext.setScopeGroupId(groupId);
@ -387,43 +296,33 @@ public class SchedulerPratiche implements MessageListener {
}
private IntPratica assegnaNumeroProgetto(IntPratica intPratica) throws PortalException, SystemException {
// in caso di errore successivo alla protocollazione salto questa
// operazione
// in caso di errore successivo alla protocollazione salto questa operazione
if (Validator.isNull(intPratica.getNumeroProgetto())) {
intPratica = IntPraticaLocalServiceUtil.addNumeroProgetto(intPratica.getIntPraticaId());
}
return intPratica;
}
public void gestionePratica(DettPratica dettPratica) throws Exception {
ServiceContext serviceContext = getServiceContext(dettPratica);
// protocollazione da servizio remoto
protocollazione(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), dettPratica);
IntPratica intPratica = IntPraticaLocalServiceUtil.getIntPratica(dettPratica.getIntPraticaId());
intPratica = assegnaNumeroProgetto(intPratica);
String tipoIntegrazione = dettPratica.getTipoIntegrazione();
// 1o Avviso di ricezione corretta o in errore della pratica
int count = AvvisoLocalServiceUtil.countAvvisoByClassPk_ClassName(dettPratica.getDettPraticaId(),
DettPratica.class.getName());
// in caso di errore non genere un nuovo avviso
if (count == 0) {
// tutte le integrazioni eccetto annulla valida
if (Validator.isNotNull(tipoIntegrazione)) {
if (TipoIntegrazioneUtil.RICHIESTA_INTEGRAZIONE.equals(tipoIntegrazione)) {
// avviso pilotato per integrazioni
String stato = StatoPraticaConstants.INTEGRAZIONE_ACCETTATA;
AvvisoLocalServiceUtil.createStandardAvvisoPratica(dettPratica.getIntPraticaId(), stato,
dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext,
AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0l);
AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0L);
} else if (TipoIntegrazioneUtil.VARIANTE.equals(tipoIntegrazione)) {
// avviso pilotato per varianti
String stato = null;
@ -434,72 +333,55 @@ public class SchedulerPratiche implements MessageListener {
}
AvvisoLocalServiceUtil.createStandardAvvisoPratica(dettPratica.getIntPraticaId(), stato,
dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext,
AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0l);
AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0L);
} else if (TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO.equals(tipoIntegrazione)) {
String propertiesTemplateType = StatoPraticaConstants.VARIAZIONE_SOGGETTI;
String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(
propertiesTemplateType);
long fileEntryIdTemplate = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(
serviceContext.getCompanyId(), propertiesTemplate);
AvvisoLocalServiceUtil.addAvviso(dettPratica.getIntPraticaId(), StringPool.BLANK,
new Date(), AvvisoUtil.TIPO_AVVISO_DIRETTO, StatoPraticaConstants.VIDIMATA,
fileEntryIdTemplate, dettPratica.getDettPraticaId(), DettPratica.class.getName(),
0l, serviceContext);
AvvisoLocalServiceUtil.addAvviso(dettPratica.getIntPraticaId(), StringPool.BLANK, new Date(),
AvvisoUtil.TIPO_AVVISO_DIRETTO, StatoPraticaConstants.VIDIMATA, fileEntryIdTemplate,
dettPratica.getDettPraticaId(), DettPratica.class.getName(), 0L, serviceContext);
}
} else {
// avviso standard da stato pratica
AvvisoLocalServiceUtil.createStandardAvvisoPratica(intPratica,
dettPratica.getDettPraticaId(), DettPratica.class.getName(), serviceContext,
AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK, 0l);
AvvisoLocalServiceUtil.createStandardAvvisoPratica(intPratica, dettPratica.getDettPraticaId(),
DettPratica.class.getName(), serviceContext, AvvisoUtil.TIPO_AVVISO_DIRETTO, StringPool.BLANK,
0L);
}
}
// Avvio Workflow
if (!dettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIAZIONE_SOGGETTO)
&& !(dettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIANTE) && !dettPratica
.getVarianteSostanziale())) {
ControlloPratica cp = avvioWorkflow(dettPratica, dettPratica.getUserId(), serviceContext);
if (cp != null)
ControlloPraticaLocalServiceUtil.gestioneWFVarianti(cp);
} else {
_log.info("Workflow non avviato");
}
dettPratica = DettPraticaLocalServiceUtil.updateDettPraticaGestita(dettPratica.getDettPraticaId(),
true);
dettPratica = DettPraticaLocalServiceUtil.updateDettPraticaGestita(dettPratica.getDettPraticaId(), true);
DettPraticaLocalServiceUtil.updateAsset(dettPratica, null, true);
}
private DettPratica protocollazione(long companyId, long groupId, DettPratica dettPratica)
throws Exception {
// in caso di errore successivo alla protocollazione salto questa
// operazione
private DettPratica protocollazione(long companyId, long groupId, DettPratica dettPratica) throws Exception {
// in caso di errore successivo alla protocollazione salto questa operazione
if (Validator.isNull(dettPratica.getProtocollo())) {
String protocollo = null;
String title = dettPratica.getDettPraticaId() + "_" + System.currentTimeMillis();
protocollo = ProtocollazioneUtil.protocollaArrivo(dettPratica, title);
if (Validator.isNull(protocollo)) {
throw new Exception("errore nella protocollazione pratica");
}
dettPratica = DettPraticaLocalServiceUtil.updateDettPraticaProtocollo(
dettPratica.getDettPraticaId(), protocollo);
dettPratica = DettPraticaLocalServiceUtil.updateDettPraticaProtocollo(dettPratica.getDettPraticaId(),
protocollo);
}
return dettPratica;
}
private FineLavori protocollazione(long companyId, long groupId, FineLavori fineLavori) throws Exception {
// in caso di errore successivo alla protocollazione salto questa
// operazione
// in caso di errore successivo alla protocollazione salto questa operazione
if (Validator.isNull(fineLavori.getProtocollo())) {
String protocollo = null;
@ -510,8 +392,8 @@ public class SchedulerPratiche implements MessageListener {
throw new Exception("errore nella protocollazione fine lavori");
}
fineLavori = FineLavoriLocalServiceUtil.updateFineLavoriProtocollo(fineLavori.getFineLavoriId(),
protocollo);
fineLavori = FineLavoriLocalServiceUtil
.updateFineLavoriProtocollo(fineLavori.getFineLavoriId(), protocollo);
}
return fineLavori;
@ -531,8 +413,7 @@ public class SchedulerPratiche implements MessageListener {
throw new Exception("errore nella protocollazione collaudo");
}
collaudo = CollaudoLocalServiceUtil
.updateCollaudoProtocollo(collaudo.getCollaudoId(), protocollo);
collaudo = CollaudoLocalServiceUtil.updateCollaudoProtocollo(collaudo.getCollaudoId(), protocollo);
}
return collaudo;
@ -545,10 +426,9 @@ public class SchedulerPratiche implements MessageListener {
Territorio territorio = TerritorioLocalServiceUtil.getTerritorio(intPratica.getTerritorioId());
if (WorkflowUtil.needToStartWorkflow(dettPratica)) {
boolean updateFlagControlloObbligatorio = true;
// ADT: bug id=7 gestione workflow
ControlloPratica cp = ControlloPraticaLocalServiceUtil.addControlloPratica(
territorio.getGroupId(), userId, intPratica.getIntPraticaId(),
dettPratica.getDettPraticaId(), updateFlagControlloObbligatorio, serviceContext);
ControlloPratica cp = ControlloPraticaLocalServiceUtil.addControlloPratica(territorio.getGroupId(),
userId, intPratica.getIntPraticaId(), dettPratica.getDettPraticaId(),
updateFlagControlloObbligatorio, serviceContext);
return cp;
}
}
@ -562,5 +442,4 @@ public class SchedulerPratiche implements MessageListener {
serviceContext.setUserId(dettPratica.getUserId());
return serviceContext;
}
}

87
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AllegatoManualeLocalServiceImpl.java

@ -1,13 +1,13 @@
/**
* 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 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.
* 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.bo.service.impl;
@ -43,13 +43,12 @@ import com.liferay.portlet.documentlibrary.NoSuchFolderException;
* The implementation of the allegato manuale local service.
*
* <p>
* 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.bo.service.AllegatoManualeLocalService} 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.bo.service.AllegatoManualeLocalService} interface.
*
* <p>
* 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.
* </p>
*
* @author Davide Barbagallo, 3F Consulting
@ -61,45 +60,50 @@ public class AllegatoManualeLocalServiceImpl extends AllegatoManualeLocalService
* NOTE FOR DEVELOPERS:
*
* Never reference this interface directly. Always use {@link
* it.tref.liferay.portos.bo.service.AllegatoManualeLocalServiceUtil} to access the allegato
* manuale local service.
* it.tref.liferay.portos.bo.service.AllegatoManualeLocalServiceUtil} to access the allegato manuale local service.
*/
@Override
public List<AllegatoManuale> findByIntPratica(long intPraticaId) throws SystemException {
return allegatoManualePersistence.findByIntPratica(intPraticaId);
}
@Override
public List<AllegatoManuale> findByIntPratica(long intPraticaId, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return allegatoManualePersistence.findByIntPratica(intPraticaId, start, end, orderByComparator);
}
@Override
public int countByIntPratica(long intPraticaId) throws SystemException {
return allegatoManualePersistence.countByIntPratica(intPraticaId);
}
@Override
public List<AllegatoManuale> findByDettPratica(long dettPraticaId) throws SystemException {
return allegatoManualePersistence.findByIntPratica(dettPraticaId);
}
@Override
public List<AllegatoManuale> findByDettPratica(long dettPraticaId, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return allegatoManualePersistence.findByIntPratica(dettPraticaId, start, end, orderByComparator);
}
@Override
public int countByDettPratica(long dettPraticaId) throws SystemException {
return allegatoManualePersistence.countByIntPratica(dettPraticaId);
}
@Override
public AllegatoManuale addAllegatoManuale(long userId, long intPraticaId, long dettPraticaId, String descrizione,
byte[] content, String sourceFileName, ServiceContext serviceContext) throws SystemException, PortalException {
AllegatoManuale allegatoManuale =
allegatoManualePersistence.create(counterLocalService.increment(AllegatoManuale.class.getName()));
byte[] content, String sourceFileName, ServiceContext serviceContext) throws SystemException,
PortalException {
AllegatoManuale allegatoManuale = allegatoManualePersistence.create(counterLocalService
.increment(AllegatoManuale.class.getName()));
DettPratica dettPratica = dettPraticaLocalService.getDettPratica(dettPraticaId);
User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();
allegatoManuale.setCompanyId(serviceContext.getCompanyId());
@ -108,16 +112,13 @@ public class AllegatoManualeLocalServiceImpl extends AllegatoManualeLocalService
allegatoManuale.setCreateDate(serviceContext.getCreateDate(now));
allegatoManuale.setModifiedDate(serviceContext.getModifiedDate(now));
allegatoManuale.setGroupId(serviceContext.getScopeGroupId());
allegatoManuale.setIntPraticaId(intPraticaId);
allegatoManuale.setDettPraticaId(dettPraticaId);
allegatoManuale.setDescrizione(descrizione);
long fileEntryId = 0l;
long defaultFolderId =
configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(),
long defaultFolderId = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(),
ConfigurazioneConstants.ATTACHMENT_FOLDER_ID);
Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId);
@ -125,23 +126,22 @@ public class AllegatoManualeLocalServiceImpl extends AllegatoManualeLocalService
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
Folder folder = null;
try {
folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), defaultFolder.getFolderId(), folderName);
folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), defaultFolder.getFolderId(),
folderName);
} catch (NoSuchFolderException e) {
// cartella non presente -> creo cartella
folder =
dlAppLocalService.addFolder(serviceContext.getUserId(), defaultFolder.getRepositoryId(),
folder = dlAppLocalService.addFolder(serviceContext.getUserId(), defaultFolder.getRepositoryId(),
defaultFolder.getFolderId(), folderName, StringPool.BLANK, serviceContext);
}
String title =
now.getTime() + StringPool.UNDERLINE + "allegato_manuale" + StringPool.UNDERLINE
+ allegatoManuale.getAllegatoManualeId() + StringPool.UNDERLINE + sourceFileName;
String description = "";
String title = now.getTime() + "_allegato_manuale_" + allegatoManuale.getAllegatoManualeId()
+ StringPool.UNDERLINE + sourceFileName;
String description = StringPool.BLANK;
String mimeType = MimeTypesUtil.getContentType(sourceFileName);
String changeLog = StringPool.BLANK;
FileEntry fileEntry =
dlAppLocalService.addFileEntry(serviceContext.getUserId(), folder.getRepositoryId(), folder.getFolderId(),
now.getTime() + "_" + sourceFileName, mimeType, title, description, changeLog, content, serviceContext);
FileEntry fileEntry = dlAppLocalService.addFileEntry(serviceContext.getUserId(), folder.getRepositoryId(),
folder.getFolderId(), now.getTime() + StringPool.UNDERLINE + sourceFileName, mimeType, title,
description, changeLog, content, serviceContext);
fileEntryId = fileEntry.getFileEntryId();
allegatoManuale.setFileEntryId(fileEntryId);
@ -155,11 +155,9 @@ public class AllegatoManualeLocalServiceImpl extends AllegatoManualeLocalService
Constants.ROLE_NAME_FIRMA, true)) {
codiceFiscalePrimaFirma = user.getScreenName();
}
Avviso avviso =
avvisoLocalService.addAvviso(intPratica.getIntPraticaId(), descrizione, now, AvvisoUtil.TIPO_AVVISO_FIRMA,
"MA", 0l, dettPraticaId, DettPratica.class.getName(), codiceFiscalePrimaFirma, fileEntryId, 0l,
StringPool.BLANK, 0l, serviceContextAvvisi);
Avviso avviso = avvisoLocalService.addAvviso(intPratica.getIntPraticaId(), descrizione, now,
AvvisoUtil.TIPO_AVVISO_FIRMA, "MA", 0L, dettPraticaId, DettPratica.class.getName(),
codiceFiscalePrimaFirma, fileEntryId, 0L, StringPool.BLANK, 0L, serviceContextAvvisi);
allegatoManuale.setAvvisoId(avviso.getAvvisoId());
allegatoManuale = allegatoManualePersistence.update(allegatoManuale);
@ -169,22 +167,11 @@ public class AllegatoManualeLocalServiceImpl extends AllegatoManualeLocalService
@Override
public AllegatoManuale deleteAllegatoManuale(AllegatoManuale allegatoManuale) throws SystemException {
// Se si cancella il fileEntryid da qui, va tolto anche nell'avviso
// try {
// if (Validator.isNotNull(allegatoManuale.getFileEntryId())) {
// dlAppLocalService.deleteFileEntry(allegatoManuale.getFileEntryId());
// }
// } catch (NoSuchFileEntryException | NoSuchRepositoryEntryException e) {
//
// } catch (PortalException e) {
// throw new SystemException(e);
// }
return super.deleteAllegatoManuale(allegatoManuale);
}
@Override
public AllegatoManuale deleteAllegatoManuale(long allegatoManuale) throws PortalException, SystemException {
return this.deleteAllegatoManuale(allegatoManualeLocalService.getAllegatoManuale(allegatoManuale));
public AllegatoManuale deleteAllegatoManuale(long allegatoManualeId) throws PortalException, SystemException {
return deleteAllegatoManuale(allegatoManualeLocalService.getAllegatoManuale(allegatoManualeId));
}
}

293
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AvvisoLocalServiceImpl.java

@ -1,13 +1,13 @@
/**
* 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 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.
* 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.bo.service.impl;
@ -72,14 +72,12 @@ import com.liferay.util.dao.orm.CustomSQLUtil;
* The implementation of the avviso local service.
*
* <p>
* 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.bo.service.AvvisoLocalService} 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.bo.service.AvvisoLocalService} interface.
*
* <p>
* 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.
* </p>
*
* @author Davide Barbagallo, 3F Consulting
@ -88,13 +86,13 @@ import com.liferay.util.dao.orm.CustomSQLUtil;
*/
public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use
* {@link it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil} to
* access the avviso local service.
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil} to access the avviso local service.
*/
private static final Log _log = LogFactoryUtil.getLog(AvvisoLocalServiceImpl.class.getName());
@Override
public Avviso createStandardAvvisoPratica(IntPratica intPratica, long classPk, String className,
ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma,
long controlloPraticaId) throws SystemException, PortalException {
@ -103,6 +101,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
userCodiceFiscalePrimaFirma, StringPool.BLANK, controlloPraticaId);
}
@Override
public Avviso createStandardAvvisoPratica(IntPratica intPratica, long classPk, String className,
ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma,
String jsonParameters, long controlloPraticaId) throws SystemException, PortalException {
@ -131,26 +130,25 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
case StatoPraticaConstants.VIDIMATA:
if (null == tipoProcedura)
tipoProcedura = Constants.PROCEDURA_A;
propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(
"DP" + tipoProcedura);
propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get("DP" + tipoProcedura);
break;
default:
propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(statoPratica);
}
long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(
serviceContext.getCompanyId(), propertiesTemplate);
long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(),
propertiesTemplate);
return addAvviso(intPratica.getIntPraticaId(), StringPool.BLANK, new Date(), tipoAvviso,
statoPratica, fileEntryIdTemplate, classPk, className, userCodiceFiscalePrimaFirma,
jsonParameters, controlloPraticaId, serviceContext);
return addAvviso(intPratica.getIntPraticaId(), StringPool.BLANK, new Date(), tipoAvviso, statoPratica,
fileEntryIdTemplate, classPk, className, userCodiceFiscalePrimaFirma, jsonParameters,
controlloPraticaId, serviceContext);
}
return null;
}
public Avviso createStandardAvvisoPratica(long intPraticaId, String stato, String jsonParameters,
long classPk, String className, ServiceContext serviceContext, String tipoAvviso,
String userCodiceFiscalePrimaFirma, long controlloPraticaId) throws SystemException,
PortalException {
@Override
public Avviso createStandardAvvisoPratica(long intPraticaId, String stato, String jsonParameters, long classPk,
String className, ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma,
long controlloPraticaId) throws SystemException, PortalException {
IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId);
@ -160,56 +158,54 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
varianteNonSostanziale = dettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIANTE)
&& !dettPratica.getVarianteSostanziale();
}
String statoPraticaCode = varianteNonSostanziale ? "DPVNS" : PraticaUtil.getStatoPraticaCode(stato,
intPratica);
String statoPraticaCode = varianteNonSostanziale ? "DPVNS" : PraticaUtil.getStatoPraticaCode(stato, intPratica);
String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(statoPraticaCode);
long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(
serviceContext.getCompanyId(), propertiesTemplate);
long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(),
propertiesTemplate);
_log.info("debugAvviso: " + propertiesTemplate + " (" + statoPraticaCode + ")"
+ (varianteNonSostanziale ? " non sostanziale" : ""));
return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate,
classPk, className, userCodiceFiscalePrimaFirma, jsonParameters, controlloPraticaId,
serviceContext);
return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate, classPk,
className, userCodiceFiscalePrimaFirma, jsonParameters, controlloPraticaId, serviceContext);
}
public Avviso createStandardAvvisoPratica(long intPraticaId, String stato, long classPk,
String className, ServiceContext serviceContext, String tipoAvviso,
String userCodiceFiscalePrimaFirma, long controlloPraticaId) throws SystemException,
PortalException {
@Override
public Avviso createStandardAvvisoPratica(long intPraticaId, String stato, long classPk, String className,
ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma,
long controlloPraticaId) throws SystemException, PortalException {
return createStandardAvvisoPratica(intPraticaId, stato, null, classPk, className, serviceContext,
tipoAvviso, userCodiceFiscalePrimaFirma, controlloPraticaId);
return createStandardAvvisoPratica(intPraticaId, stato, null, classPk, className, serviceContext, tipoAvviso,
userCodiceFiscalePrimaFirma, controlloPraticaId);
}
public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso,
String tipoDocumento, long fileEntryIdTemplate, long classPk, String className,
long controlloPraticaId, ServiceContext serviceContext) throws SystemException, PortalException {
@Override
public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso, String tipoDocumento,
long fileEntryIdTemplate, long classPk, String className, long controlloPraticaId,
ServiceContext serviceContext) throws SystemException, PortalException {
return addAvviso(intPraticaId, descLong, dtAvviso, tipoAvviso, tipoDocumento, fileEntryIdTemplate,
classPk, className, StringPool.BLANK, StringPool.BLANK, controlloPraticaId, serviceContext);
return addAvviso(intPraticaId, descLong, dtAvviso, tipoAvviso, tipoDocumento, fileEntryIdTemplate, classPk,
className, StringPool.BLANK, StringPool.BLANK, controlloPraticaId, serviceContext);
}
public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso,
String tipoDocumento, long fileEntryIdTemplate, long classPk, String className,
String userCodiceFiscalePrimaFirma, String jsonParameters, long controlloPraticaId,
ServiceContext serviceContext) throws SystemException, PortalException {
@Override
public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso, String tipoDocumento,
long fileEntryIdTemplate, long classPk, String className, String userCodiceFiscalePrimaFirma,
String jsonParameters, long controlloPraticaId, ServiceContext serviceContext) throws SystemException,
PortalException {
return addAvviso(intPraticaId, descLong, dtAvviso, tipoAvviso, tipoDocumento, fileEntryIdTemplate,
classPk, className, userCodiceFiscalePrimaFirma, null, 0L, jsonParameters,
controlloPraticaId, serviceContext);
return addAvviso(intPraticaId, descLong, dtAvviso, tipoAvviso, tipoDocumento, fileEntryIdTemplate, classPk,
className, userCodiceFiscalePrimaFirma, null, 0L, jsonParameters, controlloPraticaId, serviceContext);
}
public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso,
String tipoDocumento, long fileEntryIdTemplate, long classPk, String className,
String userCodiceFiscalePrimaFirma, Long fileEntryIdBase, long fileEntryIdFirma,
String jsonParameters, long controlloPraticaId, ServiceContext serviceContext)
throws SystemException, PortalException {
@Override
public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso, String tipoDocumento,
long fileEntryIdTemplate, long classPk, String className, String userCodiceFiscalePrimaFirma,
Long fileEntryIdBase, long fileEntryIdFirma, String jsonParameters, long controlloPraticaId,
ServiceContext serviceContext) throws SystemException, PortalException {
_log.info("addAvviso: descLong=\"" + descLong + "\", tipoAvviso=\"" + tipoAvviso
+ "\", tipoDocumento=\"" + tipoDocumento + "\", className=\"" + className
+ "\", jsonParameters=\"" + jsonParameters + "\"");
_log.info("addAvviso: descLong=\"" + descLong + "\", tipoAvviso=\"" + tipoAvviso + "\", tipoDocumento=\""
+ tipoDocumento + "\", className=\"" + className + "\", jsonParameters=\"" + jsonParameters + "\"");
User user = userPersistence.fetchByPrimaryKey(serviceContext.getUserId());
Date now = new Date();
Avviso avviso = createAvviso(counterLocalService.increment(Avviso.class.getName()));
@ -244,6 +240,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return addAvviso(avviso);
}
@Override
public Avviso addAvvisoForImport(String descLong, Date dtAvviso, String tipoAvviso, String tipoDocumento,
long fileEntryIdTemplate, long classPk, String className, String userCodiceFiscalePrimaFirma,
long fileEntryIdBase, String jsonParameters, long intPraticaId, long oldAvvisoId, String inviato,
@ -293,6 +290,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return super.addAvviso(avviso);
}
@Override
public List<Avviso> search(long[] groupIds, Long classPk, String keywords, int start, int end)
throws SystemException {
@ -301,6 +299,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
@Override
public int countSearch(long[] groupIds, Long classPk, String keywords) throws SystemException {
return (int) avvisoPersistence.countWithDynamicQuery(searchDynamicQuery(groupIds, classPk, keywords));
@ -331,14 +330,15 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
public List<Avviso> getAvvisiFirmatiByCF(long companyId, String cf, int start, int end)
throws SystemException {
@Override
public List<Avviso> getAvvisiFirmatiByCF(long companyId, String cf, int start, int end) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiFirmatiByCF(companyId, cf);
dynamicQuery.addOrder(OrderFactoryUtil.desc("dtAvviso"));
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
@Override
public int countAvvisiFirmatiByCF(long companyId, String cf) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiFirmatiByCF(companyId, cf);
@ -361,6 +361,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public List<Avviso> getAvvisiDaFirmarePrimaFirmaByCF(long companyId, String cf, int start, int end)
throws SystemException {
@ -369,6 +370,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
@Override
public int countAvvisiDaFirmarePrimaFirmaByCF(long companyId, String cf) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirmaByCF(companyId, cf);
@ -428,23 +430,23 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
public List<Avviso> getAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, String cf,
int start, int end) throws SystemException {
@Override
public List<Avviso> getAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, String cf, int start,
int end) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirmaByNotCF(companyId, groupIds, cf);
dynamicQuery.addOrder(OrderFactoryUtil.desc("dtAvviso"));
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
public int countAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, String cf)
throws SystemException {
@Override
public int countAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, String cf) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirmaByNotCF(companyId, groupIds, cf);
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
}
private DynamicQuery getDynamicQueryAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds,
String cf) {
private DynamicQuery getDynamicQueryAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, String cf) {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("companyId").eq(companyId));
@ -453,8 +455,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
} else {
dynamicQuery.add(PropertyFactoryUtil.forName("groupId").eq(0l));
}
dynamicQuery.add(RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.ilike(
"userCodiceFiscalePrimaFirma", cf)));
dynamicQuery.add(RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.ilike("userCodiceFiscalePrimaFirma", cf)));
dynamicQuery.add(RestrictionsFactoryUtil.isNotNull("userCodiceFiscalePrimaFirma"));
dynamicQuery.add(RestrictionsFactoryUtil.ne("userCodiceFiscalePrimaFirma", StringPool.BLANK));
dynamicQuery.add(PropertyFactoryUtil.forName("fileEntryIdBase").ne(0L));
@ -467,6 +468,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public List<Avviso> getAvvisiDaFirmarePrimaFirma(long companyId, long[] groupIds, int start, int end)
throws SystemException {
@ -475,6 +477,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
@Override
public int countAvvisiDaFirmarePrimaFirma(long companyId, long[] groupIds) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirma(companyId, groupIds);
@ -506,12 +509,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public int countAvvisiGenerazioneDocumento() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiGenerazioneDocumento();
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
}
@Override
public List<Avviso> getAvvisiGenerazioneDocumento(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiGenerazioneDocumento();
@ -519,6 +524,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
@Override
public DynamicQuery dynamicQueryAvvisiGenerazioneDocumento() throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -529,12 +535,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public int countAvvisiFirmaDocumento() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiFirmaDocumento();
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
}
@Override
public List<Avviso> getAvvisiFirmaDocumento(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiFirmaDocumento();
@ -542,6 +550,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
@Override
public DynamicQuery dynamicQueryAvvisiFirmaDocumento() throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -559,12 +568,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public int countAvvisiInvioDocumento() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioDocumento();
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
}
@Override
public List<Avviso> getAvvisiInvioDocumento(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioDocumento();
@ -572,6 +583,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
@Override
public DynamicQuery dynamicQueryAvvisiInvioDocumento() throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -583,12 +595,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public int countAvvisiInvioSignal() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioSignal(null);
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
}
@Override
public Avviso getAvvisoInvioSignal(long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioSignal(avvisoId);
@ -596,6 +610,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return !avviso.isEmpty() ? avviso.get(0) : null;
}
@Override
public List<Avviso> getAvvisiInvioSignal(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioSignal(null);
@ -603,6 +618,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
@Override
public DynamicQuery dynamicQueryAvvisiInvioSignal(Long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -622,12 +638,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public int countAvvisiTempistica() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiTempistica(null);
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
}
@Override
public Avviso getAvvisoTempistica(long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiTempistica(avvisoId);
@ -635,6 +653,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return !avviso.isEmpty() ? avviso.get(0) : null;
}
@Override
public List<Avviso> getAvvisiTempistica(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiTempistica(null);
@ -642,6 +661,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
@Override
public DynamicQuery dynamicQueryAvvisiTempistica(Long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -656,6 +676,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public Avviso updateAvvisoDlFileEntryFirma(long avvisoId, long fileEntryFirma) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -664,8 +685,8 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
public Avviso updateAvvisoPrimaFirma(long avvisoId, String transactionId) throws PortalException,
SystemException {
@Override
public Avviso updateAvvisoPrimaFirma(long avvisoId, String transactionId) throws PortalException, SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
if (Validator.isNotNull(avviso.getTransactionIdPrimaFirma())) {
@ -676,6 +697,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso updateAvvisoRollbackPrimaFirma(long avvisoId) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -684,6 +706,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso updateAvvisoDlFileEntryIdBase(long avvisoId, long fileEntryIdBase) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -691,16 +714,17 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
public Avviso updateAvvisoDlFileEntryIdBaseSingola(long avvisoId, long fileEntryIdBase)
throws SystemException {
@Override
public Avviso updateAvvisoDlFileEntryIdBaseSingola(long avvisoId, long fileEntryIdBase) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
avviso.setFileEntryIdBase(fileEntryIdBase);
return avvisoLocalService.updateAvviso(avviso);
}
public Avviso updateAvvisoDlFileEntryIdBaseAndInvio(long avvisoId, long fileEntryId,
Date dtCreateFileEntryInvio) throws SystemException {
@Override
public Avviso updateAvvisoDlFileEntryIdBaseAndInvio(long avvisoId, long fileEntryId, Date dtCreateFileEntryInvio)
throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
avviso.setFileEntryIdBase(fileEntryId);
@ -711,8 +735,9 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
public Avviso updateAvvisoDlFileEntryIdInvio(long avvisoId, long fileEntryIdInvio,
Date dtCreateFileEntryInvio) throws SystemException {
@Override
public Avviso updateAvvisoDlFileEntryIdInvio(long avvisoId, long fileEntryIdInvio, Date dtCreateFileEntryInvio)
throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
avviso.setFileEntryIdInvio(fileEntryIdInvio);
@ -721,6 +746,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso updateAvvisoInvio(long avvisoId) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -729,6 +755,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso updateAvvisoErrore(long avvisoId, boolean errore) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -736,6 +763,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso updateAvvisoAnnullato(long avvisoId, boolean annullato) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -743,6 +771,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso updateAvvisoSignal(long avvisoId, Date dtInvioSignal) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -750,6 +779,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso updateAvvisoSignal(long avvisoId, boolean signal) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -757,6 +787,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso updateAvvisoTempistica(long avvisoId, Date dtTempistica) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -764,6 +795,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso updateAvvisoTempistica(long avvisoId, boolean tempistica) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -771,6 +803,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso updateAvvisoProtocollo(long avvisoId, String protocollo) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -786,6 +819,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso getAvvisoInvioTecnico(long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnico(avvisoId);
@ -793,12 +827,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisi.isEmpty() ? null : avvisi.get(0);
}
@Override
public int countAvvisiInvioTecnico() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnico(null);
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
}
@Override
public List<Avviso> getAvvisiInvioTecnico(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnico(null);
@ -810,9 +846,8 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("inviatoTecnico").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento")
.in(new String[] { StatoPraticaConstants.VIDIMATA,
StatoPraticaConstants.INTEGRAZIONE_ACCETTATA }));
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in(
new String[] { StatoPraticaConstants.VIDIMATA, StatoPraticaConstants.INTEGRAZIONE_ACCETTATA }));
dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false));
if (Validator.isNotNull(avvisoId)) {
@ -821,11 +856,13 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public Avviso fetchAvvisoByOldAvvisoId(long oldAvvisoId) throws SystemException {
return avvisoPersistence.fetchByoldAvvisoId(oldAvvisoId);
}
@Override
public Avviso updateAvvisoInviatoTecnico(long avvisoId, boolean inviatoTecnico) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -833,26 +870,28 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
public List<Avviso> findByClassPk_tipoDocumento(Long classPk, String tipoDocumento)
throws SystemException {
@Override
public List<Avviso> findByClassPk_tipoDocumento(Long classPk, String tipoDocumento) throws SystemException {
return avvisoPersistence.findByClassPk_tipoDocumento(classPk, tipoDocumento);
}
@Override
public List<Avviso> findByIntPraticaId_tipoDocumento(Long intPraticaId, String tipoDocumento)
throws SystemException {
return avvisoPersistence.findByIntPraticaId_tipoDocumento(intPraticaId, tipoDocumento);
}
@Override
public List<Avviso> findByIntPraticaIds_tipoDocumento(long[] intPraticaIds, String tipoDocumento)
throws SystemException {
return avvisoPersistence.findByIntPraticaIds_tipoDocumento(intPraticaIds, tipoDocumento);
}
public List<Avviso> findByClassPk_ExcludeTipoDocumento(Long classPk, String tipoDocumento)
throws SystemException {
@Override
public List<Avviso> findByClassPk_ExcludeTipoDocumento(Long classPk, String tipoDocumento) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.ne("tipoDocumento", tipoDocumento));
@ -860,26 +899,28 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery);
}
public List<Avviso> findByIntPratica(long intPraticaId, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
@Override
public List<Avviso> findByIntPratica(long intPraticaId, int start, int end, OrderByComparator orderByComparator)
throws SystemException {
return avvisoPersistence.findByIntPratica(intPraticaId, start, end, orderByComparator);
}
@Override
public List<Avviso> findByIntPratica_Inviato(long intPraticaId, String inviato, int start, int end,
OrderByComparator orderByComparator) throws SystemException {
return avvisoPersistence.findByIntPratica_Inviato(intPraticaId, inviato, start, end,
orderByComparator);
return avvisoPersistence.findByIntPratica_Inviato(intPraticaId, inviato, start, end, orderByComparator);
}
@Override
public int countByIntPratica(long intPraticaId) throws SystemException {
return avvisoPersistence.countByIntPratica(intPraticaId);
}
public boolean containsFileEntry(long companyId, long[] groupIds, long fileEntryId)
throws SystemException {
@Override
public boolean containsFileEntry(long companyId, long[] groupIds, long fileEntryId) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("companyId", companyId));
@ -897,11 +938,13 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return count > 0;
}
@Override
public List<Avviso> findByUUID(String uuid, int start, int end) throws SystemException {
return avvisoPersistence.findByUuid(uuid, start, end);
}
@Override
public int countAvvisoByClassPk(long classPk) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -909,6 +952,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
}
@Override
public int countAvvisoByClassPk_ClassName(long classPk, String className) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -917,26 +961,28 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
}
@Override
public Avviso findByProtocollo(long companyId, long groupId, String protocollo) throws PortalException,
SystemException {
return avvisoPersistence.findByC_G_Protocollo(companyId, groupId, protocollo);
}
@Override
public Avviso fetchByProtocollo(long companyId, long groupId, String protocollo) throws PortalException,
SystemException {
return avvisoPersistence.fetchByC_G_Protocollo(companyId, groupId, protocollo);
}
@Override
public Avviso fetchByProtocollo(String protocollo) throws PortalException, SystemException {
return avvisoPersistence.fetchByProtocollo(protocollo);
}
/*
* Utilizzato nell'override di update e add per automatizzazione campo
* signal (default false)
* Utilizzato nell'override di update e add per automatizzazione campo signal (default false)
*/
private void updateSignalAndTempistica(Avviso avviso) {
@ -953,6 +999,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
avviso.setTempistica(tempistica);
}
@Override
public Avviso fetchLastAvvisoByIntPraticaPerStatoFinale(long intPraticaId) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -975,6 +1022,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
}
@Override
public List<Avviso> getListaAvvisiPerApplet(String codFisc) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -983,27 +1031,30 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
dynamicQuery.add(RestrictionsFactoryUtil.eq("fileEntryIdInvio", 0l));
dynamicQuery.add(RestrictionsFactoryUtil.ne("fileEntryIdBase", 0l));
dynamicQuery.add(RestrictionsFactoryUtil.eq("rifiutato", false));
List<Avviso> avvisi = (List<Avviso>) avvisoPersistence.findWithDynamicQuery(dynamicQuery);
List<Avviso> avvisi = avvisoPersistence.findWithDynamicQuery(dynamicQuery);
return avvisi;
}
@Override
public Map<String, String> getAllTipoDocumentoFolderProps() {
return AvvisoUtil.getAllTipoDocumentoFolderProps();
}
@Override
public String getFileNameAvviso(long classPk, String tipoDocumento, Long idAvviso, String doc) {
String filename = StringUtils.leftPad(String.valueOf(classPk), 10, '0')
+ (Validator.isNotNull(tipoDocumento) ? StringPool.UNDERLINE + tipoDocumento
: StringPool.BLANK) + StringPool.UNDERLINE + doc + StringPool.UNDERLINE
+ (Validator.isNotNull(tipoDocumento) ? StringPool.UNDERLINE + tipoDocumento : StringPool.BLANK)
+ StringPool.UNDERLINE + doc + StringPool.UNDERLINE
+ (Validator.isNotNull(idAvviso) ? idAvviso : System.currentTimeMillis());
return filename;
}
@Override
public Avviso rilasciaFirma(long avvisoId) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -1015,6 +1066,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public Avviso assegnaFirma(long avvisoId, String cf) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -1026,6 +1078,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso);
}
@Override
public List<Avviso> getAvvisiWithOldFileEntryIdInvio(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Avviso.class);
@ -1035,6 +1088,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.dynamicQuery(dynamicQuery, start, end);
}
@Override
public List<Avviso> getAvvisiWithOldFileEntryIdBase(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Avviso.class);
@ -1044,8 +1098,8 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.dynamicQuery(dynamicQuery, start, end);
}
public List<Avviso> getAvvisiRifiutatiByControlloPraticaId(long controlloPraticaId)
throws SystemException {
@Override
public List<Avviso> getAvvisiRifiutatiByControlloPraticaId(long controlloPraticaId) throws SystemException {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Avviso.class);
dynamicQuery.add(RestrictionsFactoryUtil.eq("controlloPraticaId", controlloPraticaId));
@ -1056,15 +1110,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.dynamicQuery(dynamicQuery);
}
@Override
public Avviso addFileFirmato(long avvisoId, long classPk, String fileToSave, ServiceContext serviceContext)
throws Exception {
Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(avvisoId);
// DettPratica dettPratica =
// DettPraticaLocalServiceUtil.fetchDettPratica(dettPraticaId);
long folderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(avviso.getCompanyId(),
avvisoLocalService.getAllTipoDocumentoFolderProps().get(avviso.getTipoDocumento()));
long folderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(avviso.getCompanyId(), avvisoLocalService
.getAllTipoDocumentoFolderProps().get(avviso.getTipoDocumento()));
String fileName = getFileNameAvviso(classPk, avviso.getTipoDocumento(), avviso.getAvvisoId(), "F");
@ -1075,17 +1128,15 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
byte[] bytes = Base64.decode(fileToSave);
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(avviso.getUserId(),
folder.getRepositoryId(), folderId, fileName,
MimeTypesUtil.getContentType(fileName + ".p7m"), fileName + ".p7m", "", "", bytes,
serviceContext);
FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(avviso.getUserId(), folder.getRepositoryId(),
folderId, fileName, MimeTypesUtil.getContentType(fileName + ".p7m"), fileName + ".p7m",
StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
avviso.setFileEntryIdInvio(fileEntry.getFileEntryId());
avviso = avvisoLocalService.updateAvviso(avviso);
if (Validator.isNull(avviso.getProtocollo())) {
String protocollo = ProtocollazioneUtil.protocollaPartenza(avviso,
fileEntry.getFileEntryId());
String protocollo = ProtocollazioneUtil.protocollaPartenza(avviso, fileEntry.getFileEntryId());
avviso = avvisoLocalService.updateAvvisoProtocollo(avviso.getAvvisoId(), protocollo);
}
@ -1100,8 +1151,9 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
}
public List<Avviso> protocolliSearch(String dataDa, String dataA, String numeroProtocollo, int start,
int end) throws ParseException, SystemException {
@Override
public List<Avviso> protocolliSearch(String dataDa, String dataA, String numeroProtocollo, int start, int end)
throws ParseException, SystemException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
@ -1145,8 +1197,8 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
}
if ((numeroProtocollo != null && !numeroProtocollo.equals(""))
|| (dataDa != null && !dataDa.equals("")) || (dataA != null && !dataA.equals(""))) {
if ((numeroProtocollo != null && !numeroProtocollo.equals("")) || (dataDa != null && !dataDa.equals(""))
|| (dataA != null && !dataA.equals(""))) {
Order defaultOrder = OrderFactoryUtil.asc("dtProtocollo");
query.addOrder(defaultOrder);
@ -1157,8 +1209,9 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return lista;
}
public int countProtocolliSearch(String dataDa, String dataA, String numeroProtocollo)
throws SystemException, ParseException {
@Override
public int countProtocolliSearch(String dataDa, String dataA, String numeroProtocollo) throws SystemException,
ParseException {
int count = 0;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
@ -1201,14 +1254,15 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
}
if ((numeroProtocollo != null && !numeroProtocollo.equals(""))
|| (dataDa != null && !dataDa.equals("")) || (dataA != null && !dataA.equals(""))) {
if ((numeroProtocollo != null && !numeroProtocollo.equals("")) || (dataDa != null && !dataDa.equals(""))
|| (dataA != null && !dataA.equals(""))) {
count = (int) avvisoPersistence.countWithDynamicQuery(query);
}
return count;
}
@Override
public List<Avviso> getAvvisiPerAggiuntaProtocollo(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAggiuntaProtocollo();
@ -1216,6 +1270,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}
@Override
public DynamicQuery dynamicQueryAggiuntaProtocollo() throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -1230,6 +1285,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery;
}
@Override
public List<Avviso> findByClassPk(long classPk) throws SystemException {
return avvisoPersistence.findByClassPk(classPk);
@ -1242,6 +1298,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
/**
* ADT
*/
@Override
public int countAvvisiInvioTecnicoNew() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnicoNew(null);
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
@ -1251,6 +1308,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
* ADT
*
*/
@Override
public List<Avviso> getAvvisiInvioTecnicoNew(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnicoNew(null);
@ -1272,8 +1330,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("inviatoTecnico").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in(
new String[] { StatoPraticaConstants.SOTTOPOSTA_A_PARERE,
StatoPraticaConstants.CAMBIO_ISTRUTTORE }));
new String[] { StatoPraticaConstants.SOTTOPOSTA_A_PARERE, StatoPraticaConstants.CAMBIO_ISTRUTTORE }));
dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false));
if (Validator.isNotNull(avvisoId)) {
@ -1300,6 +1357,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
* @return
* @throws SystemException
*/
@Override
public Avviso getAvvisoVidimazione(long intPraticaId, long dettPraticaID) throws SystemException {
DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery();
@ -1329,6 +1387,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
* @return
* @throws SystemException
*/
@Override
public Avviso getLastAvvisoIntegrazione(long intPraticaId) throws SystemException {
DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery();

2
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/resource/asseverazioni/calcolista.html

@ -8,7 +8,7 @@
<h1 class="text-center">ASSEVERAZIONE DEL CALCOLISTA</h1>
<p class="text-center">(resa ai sensi del D.P.R. n° 445 del 28.12.2000 e ss.mm.ii.)</p>
<p>
Il sottoscritto <b>{{nome}} {{cognome}}</b>, C.F. <b>{{codicefiscale}}</b>, progettista architettonico, consapevole
Il sottoscritto <b>{{nome}} {{cognome}}</b>, C.F. <b>{{codicefiscale}}</b>, progettista strutturale, consapevole
delle sanzioni civili e penali previste dalla normativa vigente a seguito di dichiarazioni mendaci, dichiara:
</p>
<ul>

4
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
##
build.namespace=portos_bo
build.number=2552
build.date=1614942025006
build.number=2555
build.date=1615540150045
build.auto.upgrade=true
##

630
liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/soggettipratica/view.jsp

File diff soppresso perché troppo grande Load Diff

31
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/META-INF/messaging-spring.xml

@ -1,26 +1,26 @@
<?xml version="1.0"?>
<beans
default-destroy-method="destroy"
default-init-method="afterPropertiesSet"
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
>
<beans default-destroy-method="destroy" default-init-method="afterPropertiesSet"
xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- Listeners -->
<bean id="messageListener.tref.liferay.portos.report" class="it.tref.liferay.portos.report.messaging.ReportMessageListener"/>
<bean id="messageListener.tref.liferay.portos.report"
class="it.tref.liferay.portos.report.messaging.ReportMessageListener" />
<bean id="messageListener.tref.liferay.portos.protocollo" class="it.tref.liferay.portos.report.messaging.ProtocolloMessageListener"/>
<bean id="messageListener.tref.liferay.portos.protocollo"
class="it.tref.liferay.portos.report.messaging.ProtocolloMessageListener" />
<!-- Destinations -->
<bean id="destination.tref.liferay.portos.report_sync" class="com.liferay.portal.kernel.messaging.SynchronousDestination">
<bean id="destination.tref.liferay.portos.report_sync"
class="com.liferay.portal.kernel.messaging.SynchronousDestination">
<property name="name" value="liferay/tref/portos/report_sync" />
</bean>
<bean id="destination.tref.liferay.portos.protocollo_sync" class="com.liferay.portal.kernel.messaging.SynchronousDestination">
<bean id="destination.tref.liferay.portos.protocollo_sync"
class="com.liferay.portal.kernel.messaging.SynchronousDestination">
<property name="name" value="liferay/tref/portos/protocollo_sync" />
</bean>
@ -30,7 +30,8 @@
<!-- Configurator -->
<bean id="messagingConfigurator" class="com.liferay.portal.kernel.messaging.config.PluginMessagingConfigurator">
<bean id="messagingConfigurator"
class="com.liferay.portal.kernel.messaging.config.PluginMessagingConfigurator">
<property name="messageListeners">
<map key-type="java.lang.String" value-type="java.util.List">
<entry key="liferay/tref/portos/report_sync">
@ -52,9 +53,9 @@
</property>
<property name="destinations">
<list>
<ref bean="destination.tref.liferay.portos.report_sync"/>
<ref bean="destination.tref.liferay.portos.report_serial"/>
<ref bean="destination.tref.liferay.portos.protocollo_sync"/>
<ref bean="destination.tref.liferay.portos.report_sync" />
<ref bean="destination.tref.liferay.portos.report_serial" />
<ref bean="destination.tref.liferay.portos.protocollo_sync" />
</list>
</property>
</bean>

126
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java

@ -1,9 +1,26 @@
package it.tref.liferay.portos.report.messaging;
import it.tref.liferay.portos.bo.shared.util.Constants;
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.ReportDto;
import it.tref.liferay.portos.report.shared.dto.ReportResultDto;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.FontFactory;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfLayer;
@ -37,21 +54,6 @@ import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portlet.documentlibrary.DuplicateFileException;
import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil;
import it.tref.liferay.portos.bo.shared.util.Constants;
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.ReportDto;
import it.tref.liferay.portos.report.shared.dto.ReportResultDto;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
public class ProtocolloMessageListener extends BaseMessageListener {
@ -63,9 +65,8 @@ public class ProtocolloMessageListener extends BaseMessageListener {
long companyId = message.getLong(ReportConstants.COMPANY_ID);
long userId = message.getLong(ReportConstants.USER_ID);
Map<String, Serializable> taskContextMap = (Map<String, Serializable>) message
.get(ReportConstants.PARAMATERS);
@SuppressWarnings("unchecked")
Map<String, Serializable> taskContextMap = (Map<String, Serializable>) message.get(ReportConstants.PARAMATERS);
User user = UserLocalServiceUtil.getRoleUsers(
RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR).getRoleId()).get(0);
try {
@ -75,95 +76,67 @@ public class ProtocolloMessageListener extends BaseMessageListener {
}
try {
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 = "";
long dtPraticaString = 0L;
String oggetto = "";
String protocolloToAttach = StringPool.BLANK;
long dtPraticaLong = 0L;
String oggetto = StringPool.BLANK;
if (reportDto.getParameters() != null) {
protocolloToAttach = (String) reportDto.getParameters().get("protocollo");
dtPraticaString = (Long) reportDto.getParameters().get("dtProtocollo");
dtPraticaLong = (Long) reportDto.getParameters().get("dtProtocollo");
oggetto = (String) reportDto.getParameters().get("oggetto");
}
Date dtPratica = new Date(dtPraticaString);
protocolloToAttach = finalizzaProtocollazione(companyId, protocolloToAttach, dtPratica);
protocolloToAttach = finalizzaProtocollazione(companyId, protocolloToAttach, new Date(dtPraticaLong));
long fileEntryId = reportDto.getFileEntryIds()[0];
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId);
if (Validator.isNotNull(fileEntry)) {
InputStream is = fileEntry.getContentStream();
byte[] targetArray = new byte[is.available()];
is.read(targetArray);
String tempFileNameCopy = System.getProperty(SystemProperties.TMP_DIR) + File.separator
+ "copied-files" + System.currentTimeMillis() + ".pdf";
File tempFileCopy = new File(tempFileNameCopy);
OutputStream outStreamCopiedFile = new FileOutputStream(tempFileCopy);
outStreamCopiedFile.write(targetArray);
is.close();
outStreamCopiedFile.close();
String tempFileNameModified = System.getProperty(SystemProperties.TMP_DIR) + File.separator
+ "modified-files" + System.currentTimeMillis() + ".pdf";
File tempFileModified = new File(tempFileNameModified);
FileOutputStream fileOutputStream = new FileOutputStream(tempFileModified);
PdfReader reader = new PdfReader(tempFileNameCopy);
PdfStamper stamper = new PdfStamper(reader, fileOutputStream);
PdfWriter writer = stamper.getWriter();
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
PdfContentByte cb = stamper.getOverContent(i);
PdfLayer protocollo = new PdfLayer("not printed", writer);
protocollo.setOnPanel(false);
protocollo.setPrint("Print", false);
cb.beginLayer(protocollo);
Font font = FontFactory.getFont(FontFactory.COURIER, 9.0f);
Font font = FontFactory.getFont(FontFactory.COURIER, 9.0F);
// Gestione stringa protocollo
float xProtocollo = cb.getPdfDocument().getPageSize().getWidth() - 8;
float yProtocollo = cb.getPdfDocument().getPageSize().getHeight() / 3;
Rectangle pageSize = reader.getPageSize(i);
float xProtocollo = pageSize.getWidth() - 8;
float yProtocollo = pageSize.getHeight() / 3;
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(protocolloToAttach, font),
xProtocollo, yProtocollo, 90);
// Gestion stringa oggetto
float xOggetto = cb.getPdfDocument().getPageSize().getWidth() - 8;
float yOggetto = cb.getPdfDocument().getPageSize().getHeight() - 30;
// Gestione stringa oggetto
float xOggetto = pageSize.getWidth() - 8;
float yOggetto = pageSize.getHeight() - 30;
if (oggetto != null) {
if (oggetto.length() >= 75) {
oggetto = oggetto.substring(0, 75);
}
} else {
oggetto = "";
oggetto = StringPool.BLANK;
}
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(oggetto, font), xOggetto,
yOggetto, 90);
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(oggetto, font), xOggetto, yOggetto,
90);
cb.endLayer();
}
stamper.close();
reader.close();
@ -172,55 +145,39 @@ public class ProtocolloMessageListener extends BaseMessageListener {
serviceContext.setCompanyId(companyId);
byte[] newFilesBytes = Files.readAllBytes(tempFileModified.toPath());
fileOutputStream.close();
tempFileCopy.delete();
tempFileModified.delete();
// ADT: BUG BO ID=28
FileEntry newFileEntry = null;
try {
newFileEntry = DLAppLocalServiceUtil.addFileEntry(userId, fileEntry.getRepositoryId(),
fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", "application/pdf",
reportDto.getFileName(), "", "", newFilesBytes, serviceContext);
} catch (DuplicateFileException e) {
FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(),
fileEntry.getFolderId(), reportDto.getFileName());
FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), fileEntry.getFolderId(),
reportDto.getFileName());
// DLAppLocalServiceUtil.deleteFileEntry(fe.getFileEntryId());
_log.info("File duplicato : " + fe.getFileEntryId());
return;
}
tempFileCopy.delete();
tempFileModified.delete();
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);
}
}
} 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);
}
}
@ -229,11 +186,8 @@ public class ProtocolloMessageListener extends BaseMessageListener {
throws SystemException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Company company = CompanyLocalServiceUtil.fetchCompany(companyId);
StringBuilder sb = new StringBuilder();
sb.append((String) company.getExpandoBridge().getAttribute(
Constants.COMPANY_CUSTOM_FIELD_PROTOCOLLO_CODICE_INIZIALE_LABEL, false));
sb.append(StringPool.SLASH);
@ -241,10 +195,8 @@ public class ProtocolloMessageListener extends BaseMessageListener {
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();
}
}

115
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java

@ -1,11 +1,10 @@
/**
* 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.
* 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.
*
*
*
@ -13,25 +12,6 @@
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.JSONArray;
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.repository.model.FileEntry;
import com.liferay.portal.kernel.repository.model.Folder;
import com.liferay.portal.kernel.util.ArrayUtil;
import com.liferay.portal.kernel.util.MapUtil;
import com.liferay.portal.kernel.util.MimeTypesUtil;
import com.liferay.portal.kernel.util.StreamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.security.permission.ActionKeys;
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;
@ -52,17 +32,34 @@ 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;
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.repository.model.FileEntry;
import com.liferay.portal.kernel.repository.model.Folder;
import com.liferay.portal.kernel.util.ArrayUtil;
import com.liferay.portal.kernel.util.MapUtil;
import com.liferay.portal.kernel.util.MimeTypesUtil;
import com.liferay.portal.kernel.util.StreamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.security.permission.ActionKeys;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
/**
* The implementation of the report task manager remote service.
* <p>
* 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.
* <p>
* 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.
* </p>
*
* @author
@ -73,8 +70,8 @@ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseIm
private final static Log _log = LogFactoryUtil.getLog(ReportTaskManagerServiceImpl.class);
@Override
public long[] doReport(long companyId, long userId, Map<String, Serializable> taskContextMap,
Object dataSource) throws PortalException, SystemException {
public long[] doReport(long companyId, long userId, Map<String, Serializable> taskContextMap, Object dataSource)
throws PortalException, SystemException {
long[] fileEntryIds = new long[0];
@ -84,121 +81,83 @@ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseIm
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<byte[]> rawReports = new ArrayList<byte[]>(fileEntryTemplateIds.length);
for (long fileEntryTemplateId : fileEntryTemplateIds) {
Map<String, Object> 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<String, Object> params = new HashMap<String, Object>();
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
long folderId = reportDto.getFolderId();
Folder folder = DLAppLocalServiceUtil.getFolder(folderId);
long groupId = folder.getGroupId();
long repositoryId = folder.getRepositoryId();
String title = reportDto.getFileName();
String fileName = title + StringPool.PERIOD + "pdf";
String mimeType = MimeTypesUtil.getContentType(fileName);
ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(companyId);
serviceContext.setUserId(userId);
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
_log.info("addFileEntry userId=" + userId + ", repositoryId=" + repositoryId + ", folderId="
+ folderId + ", sourceFileName=" + fileName + ", mimeType=" + mimeType + ", title="
+ title);
FileEntry fileEntry = null;
try {
fileEntry = DLAppLocalServiceUtil.getFileEntry(groupId, folderId, title);
fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntry.getFileEntryId(),
fileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, false, bytes,
serviceContext);
fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntry.getFileEntryId(), fileName,
mimeType, title, StringPool.BLANK, StringPool.BLANK, false, bytes, serviceContext);
} catch (PortalException e) {
fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, fileName,
mimeType, title, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, fileName, mimeType,
title, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
}
fileEntryIds = ArrayUtil.append(fileEntryIds, fileEntry.getFileEntryId());
}
} catch (Exception e) {
e.printStackTrace();
}
return fileEntryIds;
}
}

4
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
##
build.namespace=portos_rep
build.number=28
build.date=1603814144806
build.number=30
build.date=1615540264646
build.auto.upgrade=true
##

64
liferay-plugins-sdk-6.2/shared/portos-report-shared/src/it/tref/liferay/portos/report/shared/util/ReportUtil.java

@ -23,30 +23,24 @@ import com.liferay.portal.kernel.messaging.MessageBusUtil;
public class ReportUtil {
/*
* Considerazioni per report generati con <i>modalità asincrona</i>. Il risultato finale sarà
* inviato tramite message bus su una destinazione passata in input. La chiave di legame tra l'ack
* iniziale e il messaggio di esito è il <code>reportTaskId</code>.<br /> <b>LIMITAZIONI</b> Il
* campo <code>parameters</code> non può contenetere <code>Array[]</code> ma solo
* <code>List</code> che saranno gestite dall'engine come <code>ArrayList</code> che chiaramente
* non potranno essere tipati come <code>List&lt;Array[]&gt;</code> ma
* <code>List&lt;List&lt;&gt;&gt;</code> nel caso di matrici. All'interno di template Velocity si
* dovrà rifare rimento al bean direttamente al campo e non con metodi get (es:
* <code>$user.firstName</code> e non <code>$user.getFirstName()</code>). In generale parametri
* "semplici" (come background task).
* Considerazioni per report generati con <i>modalità asincrona</i>. Il risultato finale sarà inviato tramite
* message bus su una destinazione passata in input. La chiave di legame tra l'ack iniziale e il messaggio di esito
* è il <code>reportTaskId</code>.<br /> <b>LIMITAZIONI</b> Il campo <code>parameters</code> non può contenere
* <code>Array[]</code> ma solo <code>List</code> che saranno gestite dall'engine come <code>ArrayList</code> che
* chiaramente non potranno essere tipati come <code>List&lt;Array[]&gt;</code> ma
* <code>List&lt;List&lt;&gt;&gt;</code> nel caso di matrici. All'interno di template Velocity si dovrà fare
* riferimento al bean direttamente al campo e non con metodi get (es: <code>$user.firstName</code> e non
* <code>$user.getFirstName()</code>). In generale parametri "semplici" (come background task).
*/
public static ReportResultDto generateReport(long companyId, long userId, ReportDto reportDto, Object dataSource)
throws ReportGenerationException {
try {
Message message = new Message();
setMessage(message, companyId, userId, ReportProcessMode.SYNC, Collections.singletonList(reportDto), dataSource,
null);
setMessage(message, companyId, userId, ReportProcessMode.SYNC, Collections.singletonList(reportDto),
dataSource, null);
String json = (String) MessageBusUtil.sendSynchronousMessage(ReportDestinationNames.SYNC, message, 1);
return JSONFactoryUtil.looseDeserialize(json, ReportResultDto.class);
} catch (Exception e) {
throw new ReportGenerationException(e);
@ -57,13 +51,9 @@ public class ReportUtil {
Object dataSource) throws ReportGenerationException {
try {
Message message = new Message();
setMessage(message, companyId, userId, ReportProcessMode.SYNC, reportDtos, dataSource, null);
String json = (String) MessageBusUtil.sendSynchronousMessage(ReportDestinationNames.SYNC, message, 1);
return JSONFactoryUtil.looseDeserialize(json, ReportResultDto.class);
} catch (Exception e) {
throw new ReportGenerationException(e);
@ -74,16 +64,11 @@ public class ReportUtil {
String responseDestinationName) throws ReportGenerationException {
try {
Message message = new Message();
setMessage(message, companyId, userId, ReportProcessMode.ASYNC, Collections.singletonList(reportDto), dataSource,
responseDestinationName);
String json =
(String) MessageBusUtil.sendSynchronousMessage(ReportDestinationNames.SERIAL, message,
setMessage(message, companyId, userId, ReportProcessMode.ASYNC, Collections.singletonList(reportDto),
dataSource, responseDestinationName);
String json = (String) MessageBusUtil.sendSynchronousMessage(ReportDestinationNames.SERIAL, message,
TimeUnit.SECONDS.toMillis(60));
return JSONFactoryUtil.looseDeserialize(json, ReportResultDto.class);
} catch (Exception e) {
throw new ReportGenerationException(e);
@ -94,15 +79,11 @@ public class ReportUtil {
Object dataSource, String responseDestinationName) throws ReportGenerationException {
try {
Message message = new Message();
setMessage(message, companyId, userId, ReportProcessMode.ASYNC, reportDtos, dataSource, responseDestinationName);
String json =
(String) MessageBusUtil.sendSynchronousMessage(ReportDestinationNames.SERIAL, message,
setMessage(message, companyId, userId, ReportProcessMode.ASYNC, reportDtos, dataSource,
responseDestinationName);
String json = (String) MessageBusUtil.sendSynchronousMessage(ReportDestinationNames.SERIAL, message,
TimeUnit.SECONDS.toMillis(60));
return JSONFactoryUtil.looseDeserialize(json, ReportResultDto.class);
} catch (Exception e) {
throw new ReportGenerationException(e);
@ -113,14 +94,11 @@ public class ReportUtil {
throws ReportGenerationException {
try {
Message message = new Message();
setMessage(message, companyId, userId, ReportProcessMode.SYNC, Collections.singletonList(reportDto), null,
ReportDestinationNames.SYNC_PROTOCOLLO);
String json = (String) MessageBusUtil.sendSynchronousMessage(ReportDestinationNames.SYNC_PROTOCOLLO, message, 1);
String json = (String) MessageBusUtil.sendSynchronousMessage(ReportDestinationNames.SYNC_PROTOCOLLO,
message, 1);
return JSONFactoryUtil.looseDeserialize(json, ReportResultDto.class);
} catch (Exception e) {
throw new ReportGenerationException(e);
@ -132,19 +110,13 @@ public class ReportUtil {
message.put(ReportConstants.COMPANY_ID, companyId);
message.put(ReportConstants.USER_ID, userId);
Map<String, Serializable> map = new HashMap<String, Serializable>();
JSONArray reportJsonArray = JSONFactoryUtil.createJSONArray();
for (ReportDto reportDto : reportDtos) {
String json = JSONFactoryUtil.looseSerializeDeep(reportDto);
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(json);
reportJsonArray.put(jsonObject);
}
map.put(ReportConstants.PARAM_REPORTS, reportJsonArray.toString());
map.put(ReportConstants.PARAM_RESPONSE_DESTINATION_NAME, responseDestinationName);
map.put(ReportConstants.PARAM_PROCESS_MODE, processMode.toString());

Caricamento…
Annulla
Salva