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. 8
      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. 26
      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. 269
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AllegatoManualeLocalServiceImpl.java
  8. 305
      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. 1084
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/soggettipratica/view.jsp
  12. 65
      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. 230
      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"> <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> <dependency-type>uses</dependency-type>
</dependent-module> </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"> <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> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>

8
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.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.ContentTypes; import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.Http.Body; 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.HttpUtil;
import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Http.Options;
public class HttpServiceUtil { public class HttpServiceUtil {
private static final Log _log = LogFactoryUtil.getLog(HttpServiceUtil.class); private static final Log _log = LogFactoryUtil.getLog(HttpServiceUtil.class);
@ -46,12 +46,9 @@ public class HttpServiceUtil {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
String responseBody = EntityUtils.toString(response.getEntity(), StringPool.UTF8); String responseBody = EntityUtils.toString(response.getEntity(), StringPool.UTF8);
client.close(); client.close();
if (statusCode == HttpServletResponse.SC_OK || statusCode == HttpServletResponse.SC_CREATED) { if (statusCode == HttpServletResponse.SC_OK || statusCode == HttpServletResponse.SC_CREATED) {
risposta = JSONFactoryUtil.createJSONObject(responseBody); risposta = JSONFactoryUtil.createJSONObject(responseBody);
_log.info(url + " || " + json + " || " + risposta + " || " + responseBody);
} else {
_log.info(url + " || " + json + " || " + statusCode + ": " + responseBody);
} }
return risposta; return risposta;
} }
@ -85,7 +82,6 @@ public class HttpServiceUtil {
String responseBody = HttpUtil.URLtoString(options); String responseBody = HttpUtil.URLtoString(options);
_log.info(url + " || " + responseBody);
if (options.getResponse().getResponseCode() != HttpServletResponse.SC_OK) { if (options.getResponse().getResponseCode() != HttpServletResponse.SC_OK) {
throw new Exception(url + ": " + options.getResponse().getResponseCode()); throw new Exception(url + ": " + options.getResponse().getResponseCode());
// responseBody = defaultValue; // 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 // validazione: solo alcune estensioni
String ext = FileUtil.getExtension(sourceFileName); String ext = FileUtil.getExtension(sourceFileName);
if (!ext.equalsIgnoreCase("pdf")) { 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 // lunghezza fissata a 200
if (sourceFileName.length() > 200) { if (sourceFileName.length() > 200) {
SessionErrors.add(actionRequest, "error.geniocivilefe.allegato.manuale.length.valid"); 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"); SessionErrors.add(actionRequest, "error.geniocivilefe.allegato.manuale.is.request");
} }
if (!SessionErrors.isEmpty(actionRequest)) { if (SessionErrors.isEmpty(actionRequest)) {
PortalUtil.copyRequestParameters(actionRequest, actionResponse);
} else {
if (Validator.isNotNull(intPraticaId) && Validator.isNotNull(dettPraticaId)) { if (Validator.isNotNull(intPraticaId) && Validator.isNotNull(dettPraticaId)) {
byte[] content = FileUtil.getBytes(file); byte[] content = FileUtil.getBytes(file);
AllegatoManualeLocalServiceUtil.addAllegatoManuale(serviceContext.getUserId(), intPraticaId,
AllegatoManualeLocalServiceUtil dettPraticaId, descrizione, content, sourceFileName, serviceContext);
.addAllegatoManuale(serviceContext.getUserId(), intPraticaId, dettPraticaId,
descrizione, content, sourceFileName, serviceContext);
} }
} }
PortalUtil.copyRequestParameters(actionRequest, actionResponse); PortalUtil.copyRequestParameters(actionRequest, actionResponse);
} catch (Exception e) { } catch (Exception e) {
PortalUtil.copyRequestParameters(actionRequest, actionResponse); PortalUtil.copyRequestParameters(actionRequest, actionResponse);
@ -93,15 +87,14 @@ public class AllegatiManualiPortlet extends MVCPortlet {
} }
public void deleteAllegatoManuale(ActionRequest actionRequest, ActionResponse actionResponse) public void deleteAllegatoManuale(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
throws Exception {
long allegatoManualeId = ParamUtil.getLong(actionRequest, "allegatoManualeId"); long allegatoManualeId = ParamUtil.getLong(actionRequest, "allegatoManualeId");
AllegatoManualeServiceUtil.deleteAllegatoManuale(allegatoManualeId); AllegatoManualeServiceUtil.deleteAllegatoManuale(allegatoManualeId);
} }
@Override @Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException,
throws IOException, PortletException { PortletException {
String id = resourceRequest.getResourceID(); String id = resourceRequest.getResourceID();
@ -134,8 +127,8 @@ public class AllegatiManualiPortlet extends MVCPortlet {
resourceResponse.setContentType(ContentTypes.APPLICATION_ZIP); resourceResponse.setContentType(ContentTypes.APPLICATION_ZIP);
resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate"); resourceResponse.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate");
resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION,
+ file.getName() + "\""); "attachment; filename=\"" + file.getName() + "\"");
resourceResponse.setContentLength(data.length); resourceResponse.setContentLength(data.length);
resourceResponse.getPortletOutputStream().write(data); 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.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
@ -51,6 +50,7 @@ public class SchedulerGeneraDocumento implements MessageListener {
private static final int SIZE = 10; private static final int SIZE = 10;
@Override
public void receive(Message message) throws MessageListenerException { public void receive(Message message) throws MessageListenerException {
if (lock.tryLock()) { if (lock.tryLock()) {
@ -177,13 +177,6 @@ public class SchedulerGeneraDocumento implements MessageListener {
reportDto.setShowNumberOfPage(true); reportDto.setShowNumberOfPage(true);
reportDto.setType(ReportConstants.ReportType.JRXML_TO_PDF.toString()); 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); ReportResultDto result = ReportUtil.generateReport(companyId, userId, reportDto, bean);
idFileEntry = result.getFileEntryIds()[0]; idFileEntry = result.getFileEntryIds()[0];
// idFileEntry = (Long) // idFileEntry = (Long)

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

269
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. * 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 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* GNU Lesser General Public License as published by the Free Software Foundation; either version * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
* 2.1 of the License, or (at your option) any later version. * any later version.
* *
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* Lesser General Public License for more details. * details.
*/ */
package it.tref.liferay.portos.bo.service.impl; 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. * The implementation of the allegato manuale local service.
* *
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* ServiceBuilder to copy their definitions into the * their definitions into the {@link it.tref.liferay.portos.bo.service.AllegatoManualeLocalService} interface.
* {@link it.tref.liferay.portos.bo.service.AllegatoManualeLocalService} interface.
* *
* <p> * <p>
* This is a local service. Methods of this service will not have security checks based on the * This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* propagated JAAS credentials because this service can only be accessed from within the same VM. * credentials because this service can only be accessed from within the same VM.
* </p> * </p>
* *
* @author Davide Barbagallo, 3F Consulting * @author Davide Barbagallo, 3F Consulting
@ -57,134 +56,122 @@ import com.liferay.portlet.documentlibrary.NoSuchFolderException;
* @see it.tref.liferay.portos.bo.service.AllegatoManualeLocalServiceUtil * @see it.tref.liferay.portos.bo.service.AllegatoManualeLocalServiceUtil
*/ */
public class AllegatoManualeLocalServiceImpl extends AllegatoManualeLocalServiceBaseImpl { public class AllegatoManualeLocalServiceImpl extends AllegatoManualeLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: * NOTE FOR DEVELOPERS:
* *
* Never reference this interface directly. Always use {@link * Never reference this interface directly. Always use {@link
* it.tref.liferay.portos.bo.service.AllegatoManualeLocalServiceUtil} to access the allegato * it.tref.liferay.portos.bo.service.AllegatoManualeLocalServiceUtil} to access the allegato manuale local service.
* manuale local service. */
*/
@Override
public List<AllegatoManuale> findByIntPratica(long intPraticaId) throws SystemException { public List<AllegatoManuale> findByIntPratica(long intPraticaId) throws SystemException {
return allegatoManualePersistence.findByIntPratica(intPraticaId); return allegatoManualePersistence.findByIntPratica(intPraticaId);
} }
public List<AllegatoManuale> findByIntPratica(long intPraticaId, int start, int end, @Override
OrderByComparator orderByComparator) throws SystemException { public List<AllegatoManuale> findByIntPratica(long intPraticaId, int start, int end,
return allegatoManualePersistence.findByIntPratica(intPraticaId, start, end, orderByComparator); OrderByComparator orderByComparator) throws SystemException {
} return allegatoManualePersistence.findByIntPratica(intPraticaId, start, end, orderByComparator);
}
public int countByIntPratica(long intPraticaId) throws SystemException {
return allegatoManualePersistence.countByIntPratica(intPraticaId); @Override
} public int countByIntPratica(long intPraticaId) throws SystemException {
return allegatoManualePersistence.countByIntPratica(intPraticaId);
public List<AllegatoManuale> findByDettPratica(long dettPraticaId) throws SystemException { }
return allegatoManualePersistence.findByIntPratica(dettPraticaId);
} @Override
public List<AllegatoManuale> findByDettPratica(long dettPraticaId) throws SystemException {
public List<AllegatoManuale> findByDettPratica(long dettPraticaId, int start, int end, return allegatoManualePersistence.findByIntPratica(dettPraticaId);
OrderByComparator orderByComparator) throws SystemException { }
return allegatoManualePersistence.findByIntPratica(dettPraticaId, start, end, orderByComparator);
} @Override
public List<AllegatoManuale> findByDettPratica(long dettPraticaId, int start, int end,
public int countByDettPratica(long dettPraticaId) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return allegatoManualePersistence.countByIntPratica(dettPraticaId); return allegatoManualePersistence.findByIntPratica(dettPraticaId, start, end, orderByComparator);
} }
public AllegatoManuale addAllegatoManuale(long userId, long intPraticaId, long dettPraticaId, String descrizione, @Override
byte[] content, String sourceFileName, ServiceContext serviceContext) throws SystemException, PortalException { public int countByDettPratica(long dettPraticaId) throws SystemException {
AllegatoManuale allegatoManuale = return allegatoManualePersistence.countByIntPratica(dettPraticaId);
allegatoManualePersistence.create(counterLocalService.increment(AllegatoManuale.class.getName())); }
DettPratica dettPratica = dettPraticaLocalService.getDettPratica(dettPraticaId); @Override
public AllegatoManuale addAllegatoManuale(long userId, long intPraticaId, long dettPraticaId, String descrizione,
User user = userPersistence.findByPrimaryKey(userId); byte[] content, String sourceFileName, ServiceContext serviceContext) throws SystemException,
PortalException {
Date now = new Date(); AllegatoManuale allegatoManuale = allegatoManualePersistence.create(counterLocalService
.increment(AllegatoManuale.class.getName()));
allegatoManuale.setCompanyId(serviceContext.getCompanyId());
allegatoManuale.setUserId(user.getUserId()); DettPratica dettPratica = dettPraticaLocalService.getDettPratica(dettPraticaId);
allegatoManuale.setUserName(user.getFullName()); User user = userPersistence.findByPrimaryKey(userId);
allegatoManuale.setCreateDate(serviceContext.getCreateDate(now)); Date now = new Date();
allegatoManuale.setModifiedDate(serviceContext.getModifiedDate(now));
allegatoManuale.setGroupId(serviceContext.getScopeGroupId()); allegatoManuale.setCompanyId(serviceContext.getCompanyId());
allegatoManuale.setUserId(user.getUserId());
allegatoManuale.setIntPraticaId(intPraticaId); allegatoManuale.setUserName(user.getFullName());
allegatoManuale.setDettPraticaId(dettPraticaId); allegatoManuale.setCreateDate(serviceContext.getCreateDate(now));
allegatoManuale.setModifiedDate(serviceContext.getModifiedDate(now));
allegatoManuale.setDescrizione(descrizione); allegatoManuale.setGroupId(serviceContext.getScopeGroupId());
allegatoManuale.setIntPraticaId(intPraticaId);
long fileEntryId = 0l; allegatoManuale.setDettPraticaId(dettPraticaId);
allegatoManuale.setDescrizione(descrizione);
long defaultFolderId =
configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(), long fileEntryId = 0l;
ConfigurazioneConstants.ATTACHMENT_FOLDER_ID);
long defaultFolderId = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(),
Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId); ConfigurazioneConstants.ATTACHMENT_FOLDER_ID);
String folderName = PraticaUtil.getFolderName(dettPratica.getDettPraticaId());
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); Folder defaultFolder = dlAppLocalService.getFolder(defaultFolderId);
Folder folder = null; String folderName = PraticaUtil.getFolderName(dettPratica.getDettPraticaId());
try { serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), defaultFolder.getFolderId(), folderName); Folder folder = null;
} catch (NoSuchFolderException e) { try {
// cartella non presente -> creo cartella folder = dlAppLocalService.getFolder(defaultFolder.getRepositoryId(), defaultFolder.getFolderId(),
folder = folderName);
dlAppLocalService.addFolder(serviceContext.getUserId(), defaultFolder.getRepositoryId(), } catch (NoSuchFolderException e) {
defaultFolder.getFolderId(), folderName, StringPool.BLANK, serviceContext); // cartella non presente -> creo cartella
} folder = dlAppLocalService.addFolder(serviceContext.getUserId(), defaultFolder.getRepositoryId(),
String title = defaultFolder.getFolderId(), folderName, StringPool.BLANK, serviceContext);
now.getTime() + StringPool.UNDERLINE + "allegato_manuale" + StringPool.UNDERLINE }
+ allegatoManuale.getAllegatoManualeId() + StringPool.UNDERLINE + sourceFileName; String title = now.getTime() + "_allegato_manuale_" + allegatoManuale.getAllegatoManualeId()
String description = ""; + StringPool.UNDERLINE + sourceFileName;
String mimeType = MimeTypesUtil.getContentType(sourceFileName); String description = StringPool.BLANK;
String mimeType = MimeTypesUtil.getContentType(sourceFileName);
String changeLog = StringPool.BLANK;
FileEntry fileEntry = String changeLog = StringPool.BLANK;
dlAppLocalService.addFileEntry(serviceContext.getUserId(), folder.getRepositoryId(), folder.getFolderId(), FileEntry fileEntry = dlAppLocalService.addFileEntry(serviceContext.getUserId(), folder.getRepositoryId(),
now.getTime() + "_" + sourceFileName, mimeType, title, description, changeLog, content, serviceContext); folder.getFolderId(), now.getTime() + StringPool.UNDERLINE + sourceFileName, mimeType, title,
fileEntryId = fileEntry.getFileEntryId(); description, changeLog, content, serviceContext);
allegatoManuale.setFileEntryId(fileEntryId); fileEntryId = fileEntry.getFileEntryId();
allegatoManuale.setFileEntryId(fileEntryId);
String codiceFiscalePrimaFirma = StringPool.BLANK;
String codiceFiscalePrimaFirma = StringPool.BLANK;
ServiceContext serviceContextAvvisi = (ServiceContext) serviceContext.clone();
IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId); ServiceContext serviceContextAvvisi = (ServiceContext) serviceContext.clone();
Territorio territorio = territorioLocalService.getTerritorio(intPratica.getTerritorioId()); IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId);
serviceContextAvvisi.setScopeGroupId(territorio.getGroupId()); Territorio territorio = territorioLocalService.getTerritorio(intPratica.getTerritorioId());
if (UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), territorio.getGroupId(), serviceContextAvvisi.setScopeGroupId(territorio.getGroupId());
Constants.ROLE_NAME_FIRMA, true)) { if (UserGroupRoleLocalServiceUtil.hasUserGroupRole(user.getUserId(), territorio.getGroupId(),
codiceFiscalePrimaFirma = user.getScreenName(); Constants.ROLE_NAME_FIRMA, true)) {
} codiceFiscalePrimaFirma = user.getScreenName();
Avviso avviso = }
avvisoLocalService.addAvviso(intPratica.getIntPraticaId(), descrizione, now, AvvisoUtil.TIPO_AVVISO_FIRMA, Avviso avviso = avvisoLocalService.addAvviso(intPratica.getIntPraticaId(), descrizione, now,
"MA", 0l, dettPraticaId, DettPratica.class.getName(), codiceFiscalePrimaFirma, fileEntryId, 0l, AvvisoUtil.TIPO_AVVISO_FIRMA, "MA", 0L, dettPraticaId, DettPratica.class.getName(),
StringPool.BLANK, 0l, serviceContextAvvisi); codiceFiscalePrimaFirma, fileEntryId, 0L, StringPool.BLANK, 0L, serviceContextAvvisi);
allegatoManuale.setAvvisoId(avviso.getAvvisoId());
allegatoManuale.setAvvisoId(avviso.getAvvisoId()); allegatoManuale = allegatoManualePersistence.update(allegatoManuale);
allegatoManuale = allegatoManualePersistence.update(allegatoManuale);
return allegatoManuale;
return allegatoManuale; }
}
@Override
@Override public AllegatoManuale deleteAllegatoManuale(AllegatoManuale allegatoManuale) throws SystemException {
public AllegatoManuale deleteAllegatoManuale(AllegatoManuale allegatoManuale) throws SystemException { return super.deleteAllegatoManuale(allegatoManuale);
// Se si cancella il fileEntryid da qui, va tolto anche nell'avviso }
// try { @Override
// if (Validator.isNotNull(allegatoManuale.getFileEntryId())) { public AllegatoManuale deleteAllegatoManuale(long allegatoManualeId) throws PortalException, SystemException {
// dlAppLocalService.deleteFileEntry(allegatoManuale.getFileEntryId()); return deleteAllegatoManuale(allegatoManualeLocalService.getAllegatoManuale(allegatoManualeId));
// } }
// } 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));
}
} }

305
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. * 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 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* GNU Lesser General Public License as published by the Free Software Foundation; either version * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
* 2.1 of the License, or (at your option) any later version. * any later version.
* *
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* Lesser General Public License for more details. * details.
*/ */
package it.tref.liferay.portos.bo.service.impl; 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. * The implementation of the avviso local service.
* *
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* added, rerun ServiceBuilder to copy their definitions into the * their definitions into the {@link it.tref.liferay.portos.bo.service.AvvisoLocalService} interface.
* {@link it.tref.liferay.portos.bo.service.AvvisoLocalService} interface.
* *
* <p> * <p>
* This is a local service. Methods of this service will not have security * This is a local service. Methods of this service will not have security checks based on the propagated JAAS
* checks based on the propagated JAAS credentials because this service can only * credentials because this service can only be accessed from within the same VM.
* be accessed from within the same VM.
* </p> * </p>
* *
* @author Davide Barbagallo, 3F Consulting * @author Davide Barbagallo, 3F Consulting
@ -88,13 +86,13 @@ import com.liferay.util.dao.orm.CustomSQLUtil;
*/ */
public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl { public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
/* /*
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link
* {@link it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil} to * it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil} to access the avviso local service.
* access the avviso local service.
*/ */
private static final Log _log = LogFactoryUtil.getLog(AvvisoLocalServiceImpl.class.getName()); private static final Log _log = LogFactoryUtil.getLog(AvvisoLocalServiceImpl.class.getName());
@Override
public Avviso createStandardAvvisoPratica(IntPratica intPratica, long classPk, String className, public Avviso createStandardAvvisoPratica(IntPratica intPratica, long classPk, String className,
ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma, ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma,
long controlloPraticaId) throws SystemException, PortalException { long controlloPraticaId) throws SystemException, PortalException {
@ -103,6 +101,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
userCodiceFiscalePrimaFirma, StringPool.BLANK, controlloPraticaId); userCodiceFiscalePrimaFirma, StringPool.BLANK, controlloPraticaId);
} }
@Override
public Avviso createStandardAvvisoPratica(IntPratica intPratica, long classPk, String className, public Avviso createStandardAvvisoPratica(IntPratica intPratica, long classPk, String className,
ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma, ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma,
String jsonParameters, long controlloPraticaId) throws SystemException, PortalException { String jsonParameters, long controlloPraticaId) throws SystemException, PortalException {
@ -131,26 +130,25 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
case StatoPraticaConstants.VIDIMATA: case StatoPraticaConstants.VIDIMATA:
if (null == tipoProcedura) if (null == tipoProcedura)
tipoProcedura = Constants.PROCEDURA_A; tipoProcedura = Constants.PROCEDURA_A;
propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get( propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get("DP" + tipoProcedura);
"DP" + tipoProcedura);
break; break;
default: default:
propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(statoPratica); propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(statoPratica);
} }
long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong( long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(),
serviceContext.getCompanyId(), propertiesTemplate); propertiesTemplate);
return addAvviso(intPratica.getIntPraticaId(), StringPool.BLANK, new Date(), tipoAvviso, return addAvviso(intPratica.getIntPraticaId(), StringPool.BLANK, new Date(), tipoAvviso, statoPratica,
statoPratica, fileEntryIdTemplate, classPk, className, userCodiceFiscalePrimaFirma, fileEntryIdTemplate, classPk, className, userCodiceFiscalePrimaFirma, jsonParameters,
jsonParameters, controlloPraticaId, serviceContext); controlloPraticaId, serviceContext);
} }
return null; return null;
} }
public Avviso createStandardAvvisoPratica(long intPraticaId, String stato, String jsonParameters, @Override
long classPk, String className, ServiceContext serviceContext, String tipoAvviso, public Avviso createStandardAvvisoPratica(long intPraticaId, String stato, String jsonParameters, long classPk,
String userCodiceFiscalePrimaFirma, long controlloPraticaId) throws SystemException, String className, ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma,
PortalException { long controlloPraticaId) throws SystemException, PortalException {
IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId); IntPratica intPratica = intPraticaLocalService.getIntPratica(intPraticaId);
@ -160,56 +158,54 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
varianteNonSostanziale = dettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIANTE) varianteNonSostanziale = dettPratica.getTipoIntegrazione().equals(TipoIntegrazioneUtil.VARIANTE)
&& !dettPratica.getVarianteSostanziale(); && !dettPratica.getVarianteSostanziale();
} }
String statoPraticaCode = varianteNonSostanziale ? "DPVNS" : PraticaUtil.getStatoPraticaCode(stato, String statoPraticaCode = varianteNonSostanziale ? "DPVNS" : PraticaUtil.getStatoPraticaCode(stato, intPratica);
intPratica);
String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(statoPraticaCode); String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get(statoPraticaCode);
long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong( long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(),
serviceContext.getCompanyId(), propertiesTemplate); propertiesTemplate);
_log.info("debugAvviso: " + propertiesTemplate + " (" + statoPraticaCode + ")" _log.info("debugAvviso: " + propertiesTemplate + " (" + statoPraticaCode + ")"
+ (varianteNonSostanziale ? " non sostanziale" : "")); + (varianteNonSostanziale ? " non sostanziale" : ""));
return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate, return addAvviso(intPraticaId, StringPool.BLANK, new Date(), tipoAvviso, stato, fileEntryIdTemplate, classPk,
classPk, className, userCodiceFiscalePrimaFirma, jsonParameters, controlloPraticaId, className, userCodiceFiscalePrimaFirma, jsonParameters, controlloPraticaId, serviceContext);
serviceContext);
} }
public Avviso createStandardAvvisoPratica(long intPraticaId, String stato, long classPk, @Override
String className, ServiceContext serviceContext, String tipoAvviso, public Avviso createStandardAvvisoPratica(long intPraticaId, String stato, long classPk, String className,
String userCodiceFiscalePrimaFirma, long controlloPraticaId) throws SystemException, ServiceContext serviceContext, String tipoAvviso, String userCodiceFiscalePrimaFirma,
PortalException { long controlloPraticaId) throws SystemException, PortalException {
return createStandardAvvisoPratica(intPraticaId, stato, null, classPk, className, serviceContext, return createStandardAvvisoPratica(intPraticaId, stato, null, classPk, className, serviceContext, tipoAvviso,
tipoAvviso, userCodiceFiscalePrimaFirma, controlloPraticaId); userCodiceFiscalePrimaFirma, controlloPraticaId);
} }
public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso, @Override
String tipoDocumento, long fileEntryIdTemplate, long classPk, String className, public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso, String tipoDocumento,
long controlloPraticaId, ServiceContext serviceContext) throws SystemException, PortalException { long fileEntryIdTemplate, long classPk, String className, long controlloPraticaId,
ServiceContext serviceContext) throws SystemException, PortalException {
return addAvviso(intPraticaId, descLong, dtAvviso, tipoAvviso, tipoDocumento, fileEntryIdTemplate, return addAvviso(intPraticaId, descLong, dtAvviso, tipoAvviso, tipoDocumento, fileEntryIdTemplate, classPk,
classPk, className, StringPool.BLANK, StringPool.BLANK, controlloPraticaId, serviceContext); className, StringPool.BLANK, StringPool.BLANK, controlloPraticaId, serviceContext);
} }
public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso, @Override
String tipoDocumento, long fileEntryIdTemplate, long classPk, String className, public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso, String tipoDocumento,
String userCodiceFiscalePrimaFirma, String jsonParameters, long controlloPraticaId, long fileEntryIdTemplate, long classPk, String className, String userCodiceFiscalePrimaFirma,
ServiceContext serviceContext) throws SystemException, PortalException { String jsonParameters, long controlloPraticaId, ServiceContext serviceContext) throws SystemException,
PortalException {
return addAvviso(intPraticaId, descLong, dtAvviso, tipoAvviso, tipoDocumento, fileEntryIdTemplate, return addAvviso(intPraticaId, descLong, dtAvviso, tipoAvviso, tipoDocumento, fileEntryIdTemplate, classPk,
classPk, className, userCodiceFiscalePrimaFirma, null, 0L, jsonParameters, className, userCodiceFiscalePrimaFirma, null, 0L, jsonParameters, controlloPraticaId, serviceContext);
controlloPraticaId, serviceContext);
} }
public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso, @Override
String tipoDocumento, long fileEntryIdTemplate, long classPk, String className, public Avviso addAvviso(long intPraticaId, String descLong, Date dtAvviso, String tipoAvviso, String tipoDocumento,
String userCodiceFiscalePrimaFirma, Long fileEntryIdBase, long fileEntryIdFirma, long fileEntryIdTemplate, long classPk, String className, String userCodiceFiscalePrimaFirma,
String jsonParameters, long controlloPraticaId, ServiceContext serviceContext) Long fileEntryIdBase, long fileEntryIdFirma, String jsonParameters, long controlloPraticaId,
throws SystemException, PortalException { ServiceContext serviceContext) throws SystemException, PortalException {
_log.info("addAvviso: descLong=\"" + descLong + "\", tipoAvviso=\"" + tipoAvviso _log.info("addAvviso: descLong=\"" + descLong + "\", tipoAvviso=\"" + tipoAvviso + "\", tipoDocumento=\""
+ "\", tipoDocumento=\"" + tipoDocumento + "\", className=\"" + className + tipoDocumento + "\", className=\"" + className + "\", jsonParameters=\"" + jsonParameters + "\"");
+ "\", jsonParameters=\"" + jsonParameters + "\"");
User user = userPersistence.fetchByPrimaryKey(serviceContext.getUserId()); User user = userPersistence.fetchByPrimaryKey(serviceContext.getUserId());
Date now = new Date(); Date now = new Date();
Avviso avviso = createAvviso(counterLocalService.increment(Avviso.class.getName())); Avviso avviso = createAvviso(counterLocalService.increment(Avviso.class.getName()));
@ -244,6 +240,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return addAvviso(avviso); return addAvviso(avviso);
} }
@Override
public Avviso addAvvisoForImport(String descLong, Date dtAvviso, String tipoAvviso, String tipoDocumento, public Avviso addAvvisoForImport(String descLong, Date dtAvviso, String tipoAvviso, String tipoDocumento,
long fileEntryIdTemplate, long classPk, String className, String userCodiceFiscalePrimaFirma, long fileEntryIdTemplate, long classPk, String className, String userCodiceFiscalePrimaFirma,
long fileEntryIdBase, String jsonParameters, long intPraticaId, long oldAvvisoId, String inviato, long fileEntryIdBase, String jsonParameters, long intPraticaId, long oldAvvisoId, String inviato,
@ -293,6 +290,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return super.addAvviso(avviso); return super.addAvviso(avviso);
} }
@Override
public List<Avviso> search(long[] groupIds, Long classPk, String keywords, int start, int end) public List<Avviso> search(long[] groupIds, Long classPk, String keywords, int start, int end)
throws SystemException { throws SystemException {
@ -301,6 +299,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
@Override
public int countSearch(long[] groupIds, Long classPk, String keywords) throws SystemException { public int countSearch(long[] groupIds, Long classPk, String keywords) throws SystemException {
return (int) avvisoPersistence.countWithDynamicQuery(searchDynamicQuery(groupIds, classPk, keywords)); return (int) avvisoPersistence.countWithDynamicQuery(searchDynamicQuery(groupIds, classPk, keywords));
@ -331,14 +330,15 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
public List<Avviso> getAvvisiFirmatiByCF(long companyId, String cf, int start, int end) @Override
throws SystemException { public List<Avviso> getAvvisiFirmatiByCF(long companyId, String cf, int start, int end) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiFirmatiByCF(companyId, cf); DynamicQuery dynamicQuery = getDynamicQueryAvvisiFirmatiByCF(companyId, cf);
dynamicQuery.addOrder(OrderFactoryUtil.desc("dtAvviso")); dynamicQuery.addOrder(OrderFactoryUtil.desc("dtAvviso"));
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
@Override
public int countAvvisiFirmatiByCF(long companyId, String cf) throws SystemException { public int countAvvisiFirmatiByCF(long companyId, String cf) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiFirmatiByCF(companyId, cf); DynamicQuery dynamicQuery = getDynamicQueryAvvisiFirmatiByCF(companyId, cf);
@ -361,6 +361,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public List<Avviso> getAvvisiDaFirmarePrimaFirmaByCF(long companyId, String cf, int start, int end) public List<Avviso> getAvvisiDaFirmarePrimaFirmaByCF(long companyId, String cf, int start, int end)
throws SystemException { throws SystemException {
@ -369,6 +370,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
@Override
public int countAvvisiDaFirmarePrimaFirmaByCF(long companyId, String cf) throws SystemException { public int countAvvisiDaFirmarePrimaFirmaByCF(long companyId, String cf) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirmaByCF(companyId, cf); DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirmaByCF(companyId, cf);
@ -428,23 +430,23 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
public List<Avviso> getAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, String cf, @Override
int start, int end) throws SystemException { public List<Avviso> getAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, String cf, int start,
int end) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirmaByNotCF(companyId, groupIds, cf); DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirmaByNotCF(companyId, groupIds, cf);
dynamicQuery.addOrder(OrderFactoryUtil.desc("dtAvviso")); dynamicQuery.addOrder(OrderFactoryUtil.desc("dtAvviso"));
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
public int countAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, String cf) @Override
throws SystemException { public int countAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, String cf) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirmaByNotCF(companyId, groupIds, cf); DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirmaByNotCF(companyId, groupIds, cf);
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery); return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
} }
private DynamicQuery getDynamicQueryAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, private DynamicQuery getDynamicQueryAvvisiDaFirmarePrimaFirmaByNotCF(long companyId, long[] groupIds, String cf) {
String cf) {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("companyId").eq(companyId)); dynamicQuery.add(PropertyFactoryUtil.forName("companyId").eq(companyId));
@ -453,8 +455,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
} else { } else {
dynamicQuery.add(PropertyFactoryUtil.forName("groupId").eq(0l)); dynamicQuery.add(PropertyFactoryUtil.forName("groupId").eq(0l));
} }
dynamicQuery.add(RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.ilike( dynamicQuery.add(RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.ilike("userCodiceFiscalePrimaFirma", cf)));
"userCodiceFiscalePrimaFirma", cf)));
dynamicQuery.add(RestrictionsFactoryUtil.isNotNull("userCodiceFiscalePrimaFirma")); dynamicQuery.add(RestrictionsFactoryUtil.isNotNull("userCodiceFiscalePrimaFirma"));
dynamicQuery.add(RestrictionsFactoryUtil.ne("userCodiceFiscalePrimaFirma", StringPool.BLANK)); dynamicQuery.add(RestrictionsFactoryUtil.ne("userCodiceFiscalePrimaFirma", StringPool.BLANK));
dynamicQuery.add(PropertyFactoryUtil.forName("fileEntryIdBase").ne(0L)); dynamicQuery.add(PropertyFactoryUtil.forName("fileEntryIdBase").ne(0L));
@ -467,6 +468,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public List<Avviso> getAvvisiDaFirmarePrimaFirma(long companyId, long[] groupIds, int start, int end) public List<Avviso> getAvvisiDaFirmarePrimaFirma(long companyId, long[] groupIds, int start, int end)
throws SystemException { throws SystemException {
@ -475,6 +477,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
@Override
public int countAvvisiDaFirmarePrimaFirma(long companyId, long[] groupIds) throws SystemException { public int countAvvisiDaFirmarePrimaFirma(long companyId, long[] groupIds) throws SystemException {
DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirma(companyId, groupIds); DynamicQuery dynamicQuery = getDynamicQueryAvvisiDaFirmarePrimaFirma(companyId, groupIds);
@ -506,12 +509,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public int countAvvisiGenerazioneDocumento() throws SystemException { public int countAvvisiGenerazioneDocumento() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiGenerazioneDocumento(); DynamicQuery dynamicQuery = dynamicQueryAvvisiGenerazioneDocumento();
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery); return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
} }
@Override
public List<Avviso> getAvvisiGenerazioneDocumento(int start, int end) throws SystemException { public List<Avviso> getAvvisiGenerazioneDocumento(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiGenerazioneDocumento(); DynamicQuery dynamicQuery = dynamicQueryAvvisiGenerazioneDocumento();
@ -519,6 +524,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
@Override
public DynamicQuery dynamicQueryAvvisiGenerazioneDocumento() throws SystemException { public DynamicQuery dynamicQueryAvvisiGenerazioneDocumento() throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -529,12 +535,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public int countAvvisiFirmaDocumento() throws SystemException { public int countAvvisiFirmaDocumento() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiFirmaDocumento(); DynamicQuery dynamicQuery = dynamicQueryAvvisiFirmaDocumento();
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery); return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
} }
@Override
public List<Avviso> getAvvisiFirmaDocumento(int start, int end) throws SystemException { public List<Avviso> getAvvisiFirmaDocumento(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiFirmaDocumento(); DynamicQuery dynamicQuery = dynamicQueryAvvisiFirmaDocumento();
@ -542,6 +550,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
@Override
public DynamicQuery dynamicQueryAvvisiFirmaDocumento() throws SystemException { public DynamicQuery dynamicQueryAvvisiFirmaDocumento() throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -559,12 +568,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public int countAvvisiInvioDocumento() throws SystemException { public int countAvvisiInvioDocumento() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioDocumento(); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioDocumento();
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery); return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
} }
@Override
public List<Avviso> getAvvisiInvioDocumento(int start, int end) throws SystemException { public List<Avviso> getAvvisiInvioDocumento(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioDocumento(); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioDocumento();
@ -572,6 +583,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
@Override
public DynamicQuery dynamicQueryAvvisiInvioDocumento() throws SystemException { public DynamicQuery dynamicQueryAvvisiInvioDocumento() throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -583,12 +595,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public int countAvvisiInvioSignal() throws SystemException { public int countAvvisiInvioSignal() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioSignal(null); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioSignal(null);
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery); return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
} }
@Override
public Avviso getAvvisoInvioSignal(long avvisoId) throws SystemException { public Avviso getAvvisoInvioSignal(long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioSignal(avvisoId); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioSignal(avvisoId);
@ -596,6 +610,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return !avviso.isEmpty() ? avviso.get(0) : null; return !avviso.isEmpty() ? avviso.get(0) : null;
} }
@Override
public List<Avviso> getAvvisiInvioSignal(int start, int end) throws SystemException { public List<Avviso> getAvvisiInvioSignal(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioSignal(null); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioSignal(null);
@ -603,6 +618,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
@Override
public DynamicQuery dynamicQueryAvvisiInvioSignal(Long avvisoId) throws SystemException { public DynamicQuery dynamicQueryAvvisiInvioSignal(Long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -622,12 +638,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public int countAvvisiTempistica() throws SystemException { public int countAvvisiTempistica() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiTempistica(null); DynamicQuery dynamicQuery = dynamicQueryAvvisiTempistica(null);
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery); return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
} }
@Override
public Avviso getAvvisoTempistica(long avvisoId) throws SystemException { public Avviso getAvvisoTempistica(long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiTempistica(avvisoId); DynamicQuery dynamicQuery = dynamicQueryAvvisiTempistica(avvisoId);
@ -635,6 +653,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return !avviso.isEmpty() ? avviso.get(0) : null; return !avviso.isEmpty() ? avviso.get(0) : null;
} }
@Override
public List<Avviso> getAvvisiTempistica(int start, int end) throws SystemException { public List<Avviso> getAvvisiTempistica(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiTempistica(null); DynamicQuery dynamicQuery = dynamicQueryAvvisiTempistica(null);
@ -642,6 +661,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
@Override
public DynamicQuery dynamicQueryAvvisiTempistica(Long avvisoId) throws SystemException { public DynamicQuery dynamicQueryAvvisiTempistica(Long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -656,6 +676,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public Avviso updateAvvisoDlFileEntryFirma(long avvisoId, long fileEntryFirma) throws SystemException { public Avviso updateAvvisoDlFileEntryFirma(long avvisoId, long fileEntryFirma) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -664,8 +685,8 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
public Avviso updateAvvisoPrimaFirma(long avvisoId, String transactionId) throws PortalException, @Override
SystemException { public Avviso updateAvvisoPrimaFirma(long avvisoId, String transactionId) throws PortalException, SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
if (Validator.isNotNull(avviso.getTransactionIdPrimaFirma())) { if (Validator.isNotNull(avviso.getTransactionIdPrimaFirma())) {
@ -676,6 +697,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso updateAvvisoRollbackPrimaFirma(long avvisoId) throws SystemException { public Avviso updateAvvisoRollbackPrimaFirma(long avvisoId) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -684,6 +706,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso updateAvvisoDlFileEntryIdBase(long avvisoId, long fileEntryIdBase) throws SystemException { public Avviso updateAvvisoDlFileEntryIdBase(long avvisoId, long fileEntryIdBase) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -691,16 +714,17 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
public Avviso updateAvvisoDlFileEntryIdBaseSingola(long avvisoId, long fileEntryIdBase) @Override
throws SystemException { public Avviso updateAvvisoDlFileEntryIdBaseSingola(long avvisoId, long fileEntryIdBase) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
avviso.setFileEntryIdBase(fileEntryIdBase); avviso.setFileEntryIdBase(fileEntryIdBase);
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
public Avviso updateAvvisoDlFileEntryIdBaseAndInvio(long avvisoId, long fileEntryId, @Override
Date dtCreateFileEntryInvio) throws SystemException { public Avviso updateAvvisoDlFileEntryIdBaseAndInvio(long avvisoId, long fileEntryId, Date dtCreateFileEntryInvio)
throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
avviso.setFileEntryIdBase(fileEntryId); avviso.setFileEntryIdBase(fileEntryId);
@ -711,8 +735,9 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
public Avviso updateAvvisoDlFileEntryIdInvio(long avvisoId, long fileEntryIdInvio, @Override
Date dtCreateFileEntryInvio) throws SystemException { public Avviso updateAvvisoDlFileEntryIdInvio(long avvisoId, long fileEntryIdInvio, Date dtCreateFileEntryInvio)
throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
avviso.setFileEntryIdInvio(fileEntryIdInvio); avviso.setFileEntryIdInvio(fileEntryIdInvio);
@ -721,6 +746,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso updateAvvisoInvio(long avvisoId) throws SystemException { public Avviso updateAvvisoInvio(long avvisoId) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -729,6 +755,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso updateAvvisoErrore(long avvisoId, boolean errore) throws SystemException { public Avviso updateAvvisoErrore(long avvisoId, boolean errore) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -736,6 +763,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso updateAvvisoAnnullato(long avvisoId, boolean annullato) throws SystemException { public Avviso updateAvvisoAnnullato(long avvisoId, boolean annullato) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -743,6 +771,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso updateAvvisoSignal(long avvisoId, Date dtInvioSignal) throws SystemException { public Avviso updateAvvisoSignal(long avvisoId, Date dtInvioSignal) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -750,6 +779,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso updateAvvisoSignal(long avvisoId, boolean signal) throws SystemException { public Avviso updateAvvisoSignal(long avvisoId, boolean signal) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -757,6 +787,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso updateAvvisoTempistica(long avvisoId, Date dtTempistica) throws SystemException { public Avviso updateAvvisoTempistica(long avvisoId, Date dtTempistica) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -764,6 +795,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso updateAvvisoTempistica(long avvisoId, boolean tempistica) throws SystemException { public Avviso updateAvvisoTempistica(long avvisoId, boolean tempistica) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -771,6 +803,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso updateAvvisoProtocollo(long avvisoId, String protocollo) throws SystemException { public Avviso updateAvvisoProtocollo(long avvisoId, String protocollo) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -786,6 +819,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso getAvvisoInvioTecnico(long avvisoId) throws SystemException { public Avviso getAvvisoInvioTecnico(long avvisoId) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnico(avvisoId); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnico(avvisoId);
@ -793,12 +827,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisi.isEmpty() ? null : avvisi.get(0); return avvisi.isEmpty() ? null : avvisi.get(0);
} }
@Override
public int countAvvisiInvioTecnico() throws SystemException { public int countAvvisiInvioTecnico() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnico(null); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnico(null);
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery); return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
} }
@Override
public List<Avviso> getAvvisiInvioTecnico(int start, int end) throws SystemException { public List<Avviso> getAvvisiInvioTecnico(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnico(null); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnico(null);
@ -810,9 +846,8 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("inviatoTecnico").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("inviatoTecnico").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento") dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in(
.in(new String[] { StatoPraticaConstants.VIDIMATA, new String[] { StatoPraticaConstants.VIDIMATA, StatoPraticaConstants.INTEGRAZIONE_ACCETTATA }));
StatoPraticaConstants.INTEGRAZIONE_ACCETTATA }));
dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false));
if (Validator.isNotNull(avvisoId)) { if (Validator.isNotNull(avvisoId)) {
@ -821,11 +856,13 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public Avviso fetchAvvisoByOldAvvisoId(long oldAvvisoId) throws SystemException { public Avviso fetchAvvisoByOldAvvisoId(long oldAvvisoId) throws SystemException {
return avvisoPersistence.fetchByoldAvvisoId(oldAvvisoId); return avvisoPersistence.fetchByoldAvvisoId(oldAvvisoId);
} }
@Override
public Avviso updateAvvisoInviatoTecnico(long avvisoId, boolean inviatoTecnico) throws SystemException { public Avviso updateAvvisoInviatoTecnico(long avvisoId, boolean inviatoTecnico) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -833,26 +870,28 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
public List<Avviso> findByClassPk_tipoDocumento(Long classPk, String tipoDocumento) @Override
throws SystemException { public List<Avviso> findByClassPk_tipoDocumento(Long classPk, String tipoDocumento) throws SystemException {
return avvisoPersistence.findByClassPk_tipoDocumento(classPk, tipoDocumento); return avvisoPersistence.findByClassPk_tipoDocumento(classPk, tipoDocumento);
} }
@Override
public List<Avviso> findByIntPraticaId_tipoDocumento(Long intPraticaId, String tipoDocumento) public List<Avviso> findByIntPraticaId_tipoDocumento(Long intPraticaId, String tipoDocumento)
throws SystemException { throws SystemException {
return avvisoPersistence.findByIntPraticaId_tipoDocumento(intPraticaId, tipoDocumento); return avvisoPersistence.findByIntPraticaId_tipoDocumento(intPraticaId, tipoDocumento);
} }
@Override
public List<Avviso> findByIntPraticaIds_tipoDocumento(long[] intPraticaIds, String tipoDocumento) public List<Avviso> findByIntPraticaIds_tipoDocumento(long[] intPraticaIds, String tipoDocumento)
throws SystemException { throws SystemException {
return avvisoPersistence.findByIntPraticaIds_tipoDocumento(intPraticaIds, tipoDocumento); return avvisoPersistence.findByIntPraticaIds_tipoDocumento(intPraticaIds, tipoDocumento);
} }
public List<Avviso> findByClassPk_ExcludeTipoDocumento(Long classPk, String tipoDocumento) @Override
throws SystemException { public List<Avviso> findByClassPk_ExcludeTipoDocumento(Long classPk, String tipoDocumento) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.ne("tipoDocumento", tipoDocumento)); dynamicQuery.add(RestrictionsFactoryUtil.ne("tipoDocumento", tipoDocumento));
@ -860,26 +899,28 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery); return avvisoPersistence.findWithDynamicQuery(dynamicQuery);
} }
public List<Avviso> findByIntPratica(long intPraticaId, int start, int end, @Override
OrderByComparator orderByComparator) throws SystemException { public List<Avviso> findByIntPratica(long intPraticaId, int start, int end, OrderByComparator orderByComparator)
throws SystemException {
return avvisoPersistence.findByIntPratica(intPraticaId, start, end, orderByComparator); return avvisoPersistence.findByIntPratica(intPraticaId, start, end, orderByComparator);
} }
@Override
public List<Avviso> findByIntPratica_Inviato(long intPraticaId, String inviato, int start, int end, public List<Avviso> findByIntPratica_Inviato(long intPraticaId, String inviato, int start, int end,
OrderByComparator orderByComparator) throws SystemException { OrderByComparator orderByComparator) throws SystemException {
return avvisoPersistence.findByIntPratica_Inviato(intPraticaId, inviato, start, end, return avvisoPersistence.findByIntPratica_Inviato(intPraticaId, inviato, start, end, orderByComparator);
orderByComparator);
} }
@Override
public int countByIntPratica(long intPraticaId) throws SystemException { public int countByIntPratica(long intPraticaId) throws SystemException {
return avvisoPersistence.countByIntPratica(intPraticaId); return avvisoPersistence.countByIntPratica(intPraticaId);
} }
public boolean containsFileEntry(long companyId, long[] groupIds, long fileEntryId) @Override
throws SystemException { public boolean containsFileEntry(long companyId, long[] groupIds, long fileEntryId) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(RestrictionsFactoryUtil.eq("companyId", companyId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("companyId", companyId));
@ -897,11 +938,13 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return count > 0; return count > 0;
} }
@Override
public List<Avviso> findByUUID(String uuid, int start, int end) throws SystemException { public List<Avviso> findByUUID(String uuid, int start, int end) throws SystemException {
return avvisoPersistence.findByUuid(uuid, start, end); return avvisoPersistence.findByUuid(uuid, start, end);
} }
@Override
public int countAvvisoByClassPk(long classPk) throws SystemException { public int countAvvisoByClassPk(long classPk) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -909,6 +952,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery); return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
} }
@Override
public int countAvvisoByClassPk_ClassName(long classPk, String className) throws SystemException { public int countAvvisoByClassPk_ClassName(long classPk, String className) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -917,26 +961,28 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery); return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
} }
@Override
public Avviso findByProtocollo(long companyId, long groupId, String protocollo) throws PortalException, public Avviso findByProtocollo(long companyId, long groupId, String protocollo) throws PortalException,
SystemException { SystemException {
return avvisoPersistence.findByC_G_Protocollo(companyId, groupId, protocollo); return avvisoPersistence.findByC_G_Protocollo(companyId, groupId, protocollo);
} }
@Override
public Avviso fetchByProtocollo(long companyId, long groupId, String protocollo) throws PortalException, public Avviso fetchByProtocollo(long companyId, long groupId, String protocollo) throws PortalException,
SystemException { SystemException {
return avvisoPersistence.fetchByC_G_Protocollo(companyId, groupId, protocollo); return avvisoPersistence.fetchByC_G_Protocollo(companyId, groupId, protocollo);
} }
@Override
public Avviso fetchByProtocollo(String protocollo) throws PortalException, SystemException { public Avviso fetchByProtocollo(String protocollo) throws PortalException, SystemException {
return avvisoPersistence.fetchByProtocollo(protocollo); return avvisoPersistence.fetchByProtocollo(protocollo);
} }
/* /*
* Utilizzato nell'override di update e add per automatizzazione campo * Utilizzato nell'override di update e add per automatizzazione campo signal (default false)
* signal (default false)
*/ */
private void updateSignalAndTempistica(Avviso avviso) { private void updateSignalAndTempistica(Avviso avviso) {
@ -953,6 +999,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
avviso.setTempistica(tempistica); avviso.setTempistica(tempistica);
} }
@Override
public Avviso fetchLastAvvisoByIntPraticaPerStatoFinale(long intPraticaId) throws SystemException { public Avviso fetchLastAvvisoByIntPraticaPerStatoFinale(long intPraticaId) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -975,6 +1022,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
} }
@Override
public List<Avviso> getListaAvvisiPerApplet(String codFisc) throws SystemException { public List<Avviso> getListaAvvisiPerApplet(String codFisc) throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -983,27 +1031,30 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
dynamicQuery.add(RestrictionsFactoryUtil.eq("fileEntryIdInvio", 0l)); dynamicQuery.add(RestrictionsFactoryUtil.eq("fileEntryIdInvio", 0l));
dynamicQuery.add(RestrictionsFactoryUtil.ne("fileEntryIdBase", 0l)); dynamicQuery.add(RestrictionsFactoryUtil.ne("fileEntryIdBase", 0l));
dynamicQuery.add(RestrictionsFactoryUtil.eq("rifiutato", false)); dynamicQuery.add(RestrictionsFactoryUtil.eq("rifiutato", false));
List<Avviso> avvisi = (List<Avviso>) avvisoPersistence.findWithDynamicQuery(dynamicQuery); List<Avviso> avvisi = avvisoPersistence.findWithDynamicQuery(dynamicQuery);
return avvisi; return avvisi;
} }
@Override
public Map<String, String> getAllTipoDocumentoFolderProps() { public Map<String, String> getAllTipoDocumentoFolderProps() {
return AvvisoUtil.getAllTipoDocumentoFolderProps(); return AvvisoUtil.getAllTipoDocumentoFolderProps();
} }
@Override
public String getFileNameAvviso(long classPk, String tipoDocumento, Long idAvviso, String doc) { public String getFileNameAvviso(long classPk, String tipoDocumento, Long idAvviso, String doc) {
String filename = StringUtils.leftPad(String.valueOf(classPk), 10, '0') String filename = StringUtils.leftPad(String.valueOf(classPk), 10, '0')
+ (Validator.isNotNull(tipoDocumento) ? StringPool.UNDERLINE + tipoDocumento + (Validator.isNotNull(tipoDocumento) ? StringPool.UNDERLINE + tipoDocumento : StringPool.BLANK)
: StringPool.BLANK) + StringPool.UNDERLINE + doc + StringPool.UNDERLINE + StringPool.UNDERLINE + doc + StringPool.UNDERLINE
+ (Validator.isNotNull(idAvviso) ? idAvviso : System.currentTimeMillis()); + (Validator.isNotNull(idAvviso) ? idAvviso : System.currentTimeMillis());
return filename; return filename;
} }
@Override
public Avviso rilasciaFirma(long avvisoId) throws SystemException { public Avviso rilasciaFirma(long avvisoId) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -1015,6 +1066,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public Avviso assegnaFirma(long avvisoId, String cf) throws SystemException { public Avviso assegnaFirma(long avvisoId, String cf) throws SystemException {
Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId); Avviso avviso = avvisoPersistence.fetchByPrimaryKey(avvisoId);
@ -1026,6 +1078,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.updateAvviso(avviso); return avvisoLocalService.updateAvviso(avviso);
} }
@Override
public List<Avviso> getAvvisiWithOldFileEntryIdInvio(int start, int end) throws SystemException { public List<Avviso> getAvvisiWithOldFileEntryIdInvio(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Avviso.class); DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Avviso.class);
@ -1035,6 +1088,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.dynamicQuery(dynamicQuery, start, end); return avvisoLocalService.dynamicQuery(dynamicQuery, start, end);
} }
@Override
public List<Avviso> getAvvisiWithOldFileEntryIdBase(int start, int end) throws SystemException { public List<Avviso> getAvvisiWithOldFileEntryIdBase(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Avviso.class); DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Avviso.class);
@ -1044,8 +1098,8 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.dynamicQuery(dynamicQuery, start, end); return avvisoLocalService.dynamicQuery(dynamicQuery, start, end);
} }
public List<Avviso> getAvvisiRifiutatiByControlloPraticaId(long controlloPraticaId) @Override
throws SystemException { public List<Avviso> getAvvisiRifiutatiByControlloPraticaId(long controlloPraticaId) throws SystemException {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Avviso.class); DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Avviso.class);
dynamicQuery.add(RestrictionsFactoryUtil.eq("controlloPraticaId", controlloPraticaId)); dynamicQuery.add(RestrictionsFactoryUtil.eq("controlloPraticaId", controlloPraticaId));
@ -1056,15 +1110,14 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoLocalService.dynamicQuery(dynamicQuery); return avvisoLocalService.dynamicQuery(dynamicQuery);
} }
@Override
public Avviso addFileFirmato(long avvisoId, long classPk, String fileToSave, ServiceContext serviceContext) public Avviso addFileFirmato(long avvisoId, long classPk, String fileToSave, ServiceContext serviceContext)
throws Exception { throws Exception {
Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(avvisoId); Avviso avviso = AvvisoLocalServiceUtil.fetchAvviso(avvisoId);
// DettPratica dettPratica =
// DettPraticaLocalServiceUtil.fetchDettPratica(dettPraticaId);
long folderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(avviso.getCompanyId(), long folderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(avviso.getCompanyId(), avvisoLocalService
avvisoLocalService.getAllTipoDocumentoFolderProps().get(avviso.getTipoDocumento())); .getAllTipoDocumentoFolderProps().get(avviso.getTipoDocumento()));
String fileName = getFileNameAvviso(classPk, avviso.getTipoDocumento(), avviso.getAvvisoId(), "F"); String fileName = getFileNameAvviso(classPk, avviso.getTipoDocumento(), avviso.getAvvisoId(), "F");
@ -1075,17 +1128,15 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
byte[] bytes = Base64.decode(fileToSave); byte[] bytes = Base64.decode(fileToSave);
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(avviso.getUserId(), FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(avviso.getUserId(), folder.getRepositoryId(),
folder.getRepositoryId(), folderId, fileName, folderId, fileName, MimeTypesUtil.getContentType(fileName + ".p7m"), fileName + ".p7m",
MimeTypesUtil.getContentType(fileName + ".p7m"), fileName + ".p7m", "", "", bytes, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
serviceContext);
avviso.setFileEntryIdInvio(fileEntry.getFileEntryId()); avviso.setFileEntryIdInvio(fileEntry.getFileEntryId());
avviso = avvisoLocalService.updateAvviso(avviso); avviso = avvisoLocalService.updateAvviso(avviso);
if (Validator.isNull(avviso.getProtocollo())) { if (Validator.isNull(avviso.getProtocollo())) {
String protocollo = ProtocollazioneUtil.protocollaPartenza(avviso, String protocollo = ProtocollazioneUtil.protocollaPartenza(avviso, fileEntry.getFileEntryId());
fileEntry.getFileEntryId());
avviso = avvisoLocalService.updateAvvisoProtocollo(avviso.getAvvisoId(), protocollo); 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, @Override
int end) throws ParseException, SystemException { public List<Avviso> protocolliSearch(String dataDa, String dataA, String numeroProtocollo, int start, int end)
throws ParseException, SystemException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
@ -1145,8 +1197,8 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
} }
if ((numeroProtocollo != null && !numeroProtocollo.equals("")) if ((numeroProtocollo != null && !numeroProtocollo.equals("")) || (dataDa != null && !dataDa.equals(""))
|| (dataDa != null && !dataDa.equals("")) || (dataA != null && !dataA.equals(""))) { || (dataA != null && !dataA.equals(""))) {
Order defaultOrder = OrderFactoryUtil.asc("dtProtocollo"); Order defaultOrder = OrderFactoryUtil.asc("dtProtocollo");
query.addOrder(defaultOrder); query.addOrder(defaultOrder);
@ -1157,8 +1209,9 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return lista; return lista;
} }
public int countProtocolliSearch(String dataDa, String dataA, String numeroProtocollo) @Override
throws SystemException, ParseException { public int countProtocolliSearch(String dataDa, String dataA, String numeroProtocollo) throws SystemException,
ParseException {
int count = 0; int count = 0;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
@ -1201,14 +1254,15 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
} }
if ((numeroProtocollo != null && !numeroProtocollo.equals("")) if ((numeroProtocollo != null && !numeroProtocollo.equals("")) || (dataDa != null && !dataDa.equals(""))
|| (dataDa != null && !dataDa.equals("")) || (dataA != null && !dataA.equals(""))) { || (dataA != null && !dataA.equals(""))) {
count = (int) avvisoPersistence.countWithDynamicQuery(query); count = (int) avvisoPersistence.countWithDynamicQuery(query);
} }
return count; return count;
} }
@Override
public List<Avviso> getAvvisiPerAggiuntaProtocollo(int start, int end) throws SystemException { public List<Avviso> getAvvisiPerAggiuntaProtocollo(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAggiuntaProtocollo(); DynamicQuery dynamicQuery = dynamicQueryAggiuntaProtocollo();
@ -1216,6 +1270,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end); return avvisoPersistence.findWithDynamicQuery(dynamicQuery, start, end);
} }
@Override
public DynamicQuery dynamicQueryAggiuntaProtocollo() throws SystemException { public DynamicQuery dynamicQueryAggiuntaProtocollo() throws SystemException {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
@ -1230,6 +1285,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
return dynamicQuery; return dynamicQuery;
} }
@Override
public List<Avviso> findByClassPk(long classPk) throws SystemException { public List<Avviso> findByClassPk(long classPk) throws SystemException {
return avvisoPersistence.findByClassPk(classPk); return avvisoPersistence.findByClassPk(classPk);
@ -1242,6 +1298,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
/** /**
* ADT * ADT
*/ */
@Override
public int countAvvisiInvioTecnicoNew() throws SystemException { public int countAvvisiInvioTecnicoNew() throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnicoNew(null); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnicoNew(null);
return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery); return (int) avvisoPersistence.countWithDynamicQuery(dynamicQuery);
@ -1249,8 +1306,9 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
/** /**
* ADT * ADT
* *
*/ */
@Override
public List<Avviso> getAvvisiInvioTecnicoNew(int start, int end) throws SystemException { public List<Avviso> getAvvisiInvioTecnicoNew(int start, int end) throws SystemException {
DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnicoNew(null); DynamicQuery dynamicQuery = dynamicQueryAvvisiInvioTecnicoNew(null);
@ -1260,9 +1318,9 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
} }
/** /**
* *
* ADT * ADT
* *
* @param avvisoId * @param avvisoId
* @return * @return
* @throws SystemException * @throws SystemException
@ -1272,8 +1330,7 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery(); DynamicQuery dynamicQuery = avvisoLocalService.dynamicQuery();
dynamicQuery.add(PropertyFactoryUtil.forName("inviatoTecnico").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("inviatoTecnico").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in( dynamicQuery.add(PropertyFactoryUtil.forName("tipoDocumento").in(
new String[] { StatoPraticaConstants.SOTTOPOSTA_A_PARERE, new String[] { StatoPraticaConstants.SOTTOPOSTA_A_PARERE, StatoPraticaConstants.CAMBIO_ISTRUTTORE }));
StatoPraticaConstants.CAMBIO_ISTRUTTORE }));
dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("errore").eq(false));
dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false)); dynamicQuery.add(PropertyFactoryUtil.forName("annullato").eq(false));
if (Validator.isNotNull(avvisoId)) { if (Validator.isNotNull(avvisoId)) {
@ -1294,12 +1351,13 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
/** /**
* ADT * ADT
* *
* @param intPraticaId * @param intPraticaId
* @param dettPraticaID * @param dettPraticaID
* @return * @return
* @throws SystemException * @throws SystemException
*/ */
@Override
public Avviso getAvvisoVidimazione(long intPraticaId, long dettPraticaID) throws SystemException { public Avviso getAvvisoVidimazione(long intPraticaId, long dettPraticaID) throws SystemException {
DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery(); DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery();
@ -1323,12 +1381,13 @@ public class AvvisoLocalServiceImpl extends AvvisoLocalServiceBaseImpl {
} }
/** /**
* *
* *
* @param intPraticaId * @param intPraticaId
* @return * @return
* @throws SystemException * @throws SystemException
*/ */
@Override
public Avviso getLastAvvisoIntegrazione(long intPraticaId) throws SystemException { public Avviso getLastAvvisoIntegrazione(long intPraticaId) throws SystemException {
DynamicQuery dynamicQuery = AvvisoLocalServiceUtil.dynamicQuery(); 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> <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 class="text-center">(resa ai sensi del D.P.R. n° 445 del 28.12.2000 e ss.mm.ii.)</p>
<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: delle sanzioni civili e penali previste dalla normativa vigente a seguito di dichiarazioni mendaci, dichiara:
</p> </p>
<ul> <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.namespace=portos_bo
build.number=2552 build.number=2555
build.date=1614942025006 build.date=1615540150045
build.auto.upgrade=true build.auto.upgrade=true
## ##

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

File diff soppresso perché troppo grande Load Diff

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

@ -1,36 +1,37 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<beans <beans default-destroy-method="destroy" default-init-method="afterPropertiesSet"
default-destroy-method="destroy" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
default-init-method="afterPropertiesSet" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
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 --> <!-- 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 --> <!-- Destinations -->
<bean id="destination.tref.liferay.portos.report_sync" class="com.liferay.portal.kernel.messaging.SynchronousDestination"> <bean id="destination.tref.liferay.portos.report_sync"
<property name="name" value="liferay/tref/portos/report_sync" /> class="com.liferay.portal.kernel.messaging.SynchronousDestination">
</bean> <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">
<property name="name" value="liferay/tref/portos/protocollo_sync" /> <bean id="destination.tref.liferay.portos.protocollo_sync"
</bean> class="com.liferay.portal.kernel.messaging.SynchronousDestination">
<property name="name" value="liferay/tref/portos/protocollo_sync" />
<bean id="destination.tref.liferay.portos.report_serial" class="com.liferay.portal.kernel.messaging.SerialDestination"> </bean>
<property name="name" value="liferay/tref/portos/report_serial" />
</bean> <bean id="destination.tref.liferay.portos.report_serial" class="com.liferay.portal.kernel.messaging.SerialDestination">
<property name="name" value="liferay/tref/portos/report_serial" />
</bean>
<!-- Configurator --> <!-- 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"> <property name="messageListeners">
<map key-type="java.lang.String" value-type="java.util.List"> <map key-type="java.lang.String" value-type="java.util.List">
<entry key="liferay/tref/portos/report_sync"> <entry key="liferay/tref/portos/report_sync">
@ -51,12 +52,12 @@
</map> </map>
</property> </property>
<property name="destinations"> <property name="destinations">
<list> <list>
<ref bean="destination.tref.liferay.portos.report_sync"/> <ref bean="destination.tref.liferay.portos.report_sync" />
<ref bean="destination.tref.liferay.portos.report_serial"/> <ref bean="destination.tref.liferay.portos.report_serial" />
<ref bean="destination.tref.liferay.portos.protocollo_sync"/> <ref bean="destination.tref.liferay.portos.protocollo_sync" />
</list> </list>
</property> </property>
</bean> </bean>
</beans> </beans>

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; 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.Element;
import com.itextpdf.text.Font; import com.itextpdf.text.Font;
import com.itextpdf.text.FontFactory; import com.itextpdf.text.FontFactory;
import com.itextpdf.text.Phrase; import com.itextpdf.text.Phrase;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.ColumnText; import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfLayer; 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.DuplicateFileException;
import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil; 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 { public class ProtocolloMessageListener extends BaseMessageListener {
@ -63,9 +65,8 @@ public class ProtocolloMessageListener extends BaseMessageListener {
long companyId = message.getLong(ReportConstants.COMPANY_ID); long companyId = message.getLong(ReportConstants.COMPANY_ID);
long userId = message.getLong(ReportConstants.USER_ID); long userId = message.getLong(ReportConstants.USER_ID);
Map<String, Serializable> taskContextMap = (Map<String, Serializable>) message @SuppressWarnings("unchecked")
.get(ReportConstants.PARAMATERS); Map<String, Serializable> taskContextMap = (Map<String, Serializable>) message.get(ReportConstants.PARAMATERS);
User user = UserLocalServiceUtil.getRoleUsers( User user = UserLocalServiceUtil.getRoleUsers(
RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR).getRoleId()).get(0); RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR).getRoleId()).get(0);
try { try {
@ -75,95 +76,67 @@ public class ProtocolloMessageListener extends BaseMessageListener {
} }
try { try {
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(MapUtil.getString(taskContextMap, JSONArray jsonArray = JSONFactoryUtil.createJSONArray(MapUtil.getString(taskContextMap,
ReportConstants.PARAM_REPORTS)); ReportConstants.PARAM_REPORTS));
JSONObject jsonObject = jsonArray.getJSONObject(0); JSONObject jsonObject = jsonArray.getJSONObject(0);
ReportDto reportDto = JSONFactoryUtil.looseDeserialize(jsonObject.toString(), ReportDto.class); ReportDto reportDto = JSONFactoryUtil.looseDeserialize(jsonObject.toString(), ReportDto.class);
String protocolloToAttach = StringPool.BLANK;
String protocolloToAttach = ""; long dtPraticaLong = 0L;
long dtPraticaString = 0L; String oggetto = StringPool.BLANK;
String oggetto = "";
if (reportDto.getParameters() != null) { if (reportDto.getParameters() != null) {
protocolloToAttach = (String) reportDto.getParameters().get("protocollo"); protocolloToAttach = (String) reportDto.getParameters().get("protocollo");
dtPraticaString = (Long) reportDto.getParameters().get("dtProtocollo"); dtPraticaLong = (Long) reportDto.getParameters().get("dtProtocollo");
oggetto = (String) reportDto.getParameters().get("oggetto"); oggetto = (String) reportDto.getParameters().get("oggetto");
} }
Date dtPratica = new Date(dtPraticaString); protocolloToAttach = finalizzaProtocollazione(companyId, protocolloToAttach, new Date(dtPraticaLong));
protocolloToAttach = finalizzaProtocollazione(companyId, protocolloToAttach, dtPratica);
long fileEntryId = reportDto.getFileEntryIds()[0]; long fileEntryId = reportDto.getFileEntryIds()[0];
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId); FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId);
if (Validator.isNotNull(fileEntry)) { if (Validator.isNotNull(fileEntry)) {
InputStream is = fileEntry.getContentStream(); InputStream is = fileEntry.getContentStream();
byte[] targetArray = new byte[is.available()]; byte[] targetArray = new byte[is.available()];
is.read(targetArray); is.read(targetArray);
String tempFileNameCopy = System.getProperty(SystemProperties.TMP_DIR) + File.separator String tempFileNameCopy = System.getProperty(SystemProperties.TMP_DIR) + File.separator
+ "copied-files" + System.currentTimeMillis() + ".pdf"; + "copied-files" + System.currentTimeMillis() + ".pdf";
File tempFileCopy = new File(tempFileNameCopy); File tempFileCopy = new File(tempFileNameCopy);
OutputStream outStreamCopiedFile = new FileOutputStream(tempFileCopy); OutputStream outStreamCopiedFile = new FileOutputStream(tempFileCopy);
outStreamCopiedFile.write(targetArray); outStreamCopiedFile.write(targetArray);
is.close(); is.close();
outStreamCopiedFile.close(); outStreamCopiedFile.close();
String tempFileNameModified = System.getProperty(SystemProperties.TMP_DIR) + File.separator String tempFileNameModified = System.getProperty(SystemProperties.TMP_DIR) + File.separator
+ "modified-files" + System.currentTimeMillis() + ".pdf"; + "modified-files" + System.currentTimeMillis() + ".pdf";
File tempFileModified = new File(tempFileNameModified); File tempFileModified = new File(tempFileNameModified);
FileOutputStream fileOutputStream = new FileOutputStream(tempFileModified); FileOutputStream fileOutputStream = new FileOutputStream(tempFileModified);
PdfReader reader = new PdfReader(tempFileNameCopy); PdfReader reader = new PdfReader(tempFileNameCopy);
PdfStamper stamper = new PdfStamper(reader, fileOutputStream); PdfStamper stamper = new PdfStamper(reader, fileOutputStream);
PdfWriter writer = stamper.getWriter(); PdfWriter writer = stamper.getWriter();
for (int i = 1; i <= reader.getNumberOfPages(); i++) { for (int i = 1; i <= reader.getNumberOfPages(); i++) {
PdfContentByte cb = stamper.getOverContent(i); PdfContentByte cb = stamper.getOverContent(i);
PdfLayer protocollo = new PdfLayer("not printed", writer); PdfLayer protocollo = new PdfLayer("not printed", writer);
protocollo.setOnPanel(false); protocollo.setOnPanel(false);
protocollo.setPrint("Print", false); protocollo.setPrint("Print", false);
cb.beginLayer(protocollo); cb.beginLayer(protocollo);
Font font = FontFactory.getFont(FontFactory.COURIER, 9.0F);
Font font = FontFactory.getFont(FontFactory.COURIER, 9.0f);
// Gestione stringa protocollo // Gestione stringa protocollo
float xProtocollo = cb.getPdfDocument().getPageSize().getWidth() - 8; Rectangle pageSize = reader.getPageSize(i);
float yProtocollo = cb.getPdfDocument().getPageSize().getHeight() / 3; float xProtocollo = pageSize.getWidth() - 8;
float yProtocollo = pageSize.getHeight() / 3;
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(protocolloToAttach, font), ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(protocolloToAttach, font),
xProtocollo, yProtocollo, 90); xProtocollo, yProtocollo, 90);
// Gestione stringa oggetto
// Gestion stringa oggetto float xOggetto = pageSize.getWidth() - 8;
float xOggetto = cb.getPdfDocument().getPageSize().getWidth() - 8; float yOggetto = pageSize.getHeight() - 30;
float yOggetto = cb.getPdfDocument().getPageSize().getHeight() - 30;
if (oggetto != null) { if (oggetto != null) {
if (oggetto.length() >= 75) { if (oggetto.length() >= 75) {
oggetto = oggetto.substring(0, 75); oggetto = oggetto.substring(0, 75);
} }
} else { } else {
oggetto = ""; oggetto = StringPool.BLANK;
} }
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(oggetto, font), xOggetto, yOggetto,
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(oggetto, font), xOggetto, 90);
yOggetto, 90);
cb.endLayer(); cb.endLayer();
} }
stamper.close(); stamper.close();
reader.close(); reader.close();
@ -172,55 +145,39 @@ public class ProtocolloMessageListener extends BaseMessageListener {
serviceContext.setCompanyId(companyId); serviceContext.setCompanyId(companyId);
byte[] newFilesBytes = Files.readAllBytes(tempFileModified.toPath()); byte[] newFilesBytes = Files.readAllBytes(tempFileModified.toPath());
fileOutputStream.close(); fileOutputStream.close();
tempFileCopy.delete(); tempFileCopy.delete();
tempFileModified.delete(); tempFileModified.delete();
// ADT: BUG BO ID=28
FileEntry newFileEntry = null; FileEntry newFileEntry = null;
try { try {
newFileEntry = DLAppLocalServiceUtil.addFileEntry(userId, fileEntry.getRepositoryId(), newFileEntry = DLAppLocalServiceUtil.addFileEntry(userId, fileEntry.getRepositoryId(),
fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", "application/pdf", fileEntry.getFolderId(), reportDto.getFileName() + ".pdf", "application/pdf",
reportDto.getFileName(), "", "", newFilesBytes, serviceContext); reportDto.getFileName(), "", "", newFilesBytes, serviceContext);
} catch (DuplicateFileException e) { } catch (DuplicateFileException e) {
FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), FileEntry fe = DLAppServiceUtil.getFileEntry(fileEntry.getGroupId(), fileEntry.getFolderId(),
fileEntry.getFolderId(), reportDto.getFileName()); reportDto.getFileName());
// DLAppLocalServiceUtil.deleteFileEntry(fe.getFileEntryId()); // DLAppLocalServiceUtil.deleteFileEntry(fe.getFileEntryId());
_log.info("File duplicato : " + fe.getFileEntryId()); _log.info("File duplicato : " + fe.getFileEntryId());
return; return;
} }
tempFileCopy.delete(); tempFileCopy.delete();
tempFileModified.delete(); tempFileModified.delete();
if (Validator.isNotNull(newFileEntry)) { if (Validator.isNotNull(newFileEntry)) {
long[] fileEntryIds = new long[0]; long[] fileEntryIds = new long[0];
fileEntryIds = ArrayUtil.append(fileEntryIds, newFileEntry.getFileEntryId()); fileEntryIds = ArrayUtil.append(fileEntryIds, newFileEntry.getFileEntryId());
ReportResultDto dto = new ReportResultDto(0L, fileEntryIds, ReportResult.SUCCESSFUL.toString(),
ReportResultDto dto = new ReportResultDto(0L, fileEntryIds, null);
ReportResult.SUCCESSFUL.toString(), null);
Message responseMessage = MessageBusUtil.createResponseMessage(message); Message responseMessage = MessageBusUtil.createResponseMessage(message);
responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto)); responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto));
MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage); MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage);
} }
} }
} catch (Exception e) { } catch (Exception e) {
_log.error(e, e); _log.error(e, e);
ReportResultDto dto = new ReportResultDto(0L, null, ReportResult.FAILED.toString(), ReportResultDto dto = new ReportResultDto(0L, null, ReportResult.FAILED.toString(), e.getMessage());
e.getMessage());
Message responseMessage = MessageBusUtil.createResponseMessage(message); Message responseMessage = MessageBusUtil.createResponseMessage(message);
responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto)); responseMessage.setPayload(JSONFactoryUtil.looseSerializeDeep(dto));
MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage); MessageBusUtil.sendMessage(responseMessage.getDestinationName(), responseMessage);
} }
} }
@ -229,11 +186,8 @@ public class ProtocolloMessageListener extends BaseMessageListener {
throws SystemException { throws SystemException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Company company = CompanyLocalServiceUtil.fetchCompany(companyId); Company company = CompanyLocalServiceUtil.fetchCompany(companyId);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append((String) company.getExpandoBridge().getAttribute( sb.append((String) company.getExpandoBridge().getAttribute(
Constants.COMPANY_CUSTOM_FIELD_PROTOCOLLO_CODICE_INIZIALE_LABEL, false)); Constants.COMPANY_CUSTOM_FIELD_PROTOCOLLO_CODICE_INIZIALE_LABEL, false));
sb.append(StringPool.SLASH); sb.append(StringPool.SLASH);
@ -241,10 +195,8 @@ public class ProtocolloMessageListener extends BaseMessageListener {
sb.append(StringPool.SLASH); sb.append(StringPool.SLASH);
sb.append((String) company.getExpandoBridge().getAttribute( sb.append((String) company.getExpandoBridge().getAttribute(
Constants.COMPANY_CUSTOM_FIELD_PROTOCOLLO_CODICE_SEGUENTE_LABEL, false)); Constants.COMPANY_CUSTOM_FIELD_PROTOCOLLO_CODICE_SEGUENTE_LABEL, false));
sb.append(" del "); sb.append(" del ");
sb.append(sdf.format(dtProtocollo)); sb.append(sdf.format(dtProtocollo));
return sb.toString(); 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. * 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 * The contents of this file are subject to the terms of the Liferay Enterprise Subscription License ("License"). You
* ("License"). You may not use this file except in compliance with the License. You can obtain a * may not use this file except in compliance with the License. You can obtain a copy of the License by contacting
* copy of the License by contacting Liferay, Inc. See the License for the specific language * Liferay, Inc. See the License for the specific language governing permissions and limitations under the License,
* governing permissions and limitations under the License, including but not limited to * including but not limited to distribution rights of the Software.
* distribution rights of the Software.
* *
* *
* *
@ -13,25 +12,6 @@
package it.tref.liferay.portos.report.service.impl; 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.html.core.HtmlToPdfEngine;
import it.tref.liferay.portos.report.jasper.core.provider.JasperPdfProvider; import it.tref.liferay.portos.report.jasper.core.provider.JasperPdfProvider;
import it.tref.liferay.portos.report.jasper.core.report.BeanReport; 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.List;
import java.util.Map; 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. * The implementation of the report task manager remote service.
* <p> * <p>
* All custom service methods should be put in this class. Whenever methods are * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy
* added, rerun ServiceBuilder to copy their definitions into the * their definitions into the {@link it.tref.liferay.portos.report.service.ReportTaskManagerService} interface.
* {@link it.tref.liferay.portos.report.service.ReportTaskManagerService}
* interface.
* <p> * <p>
* This is a remote service. Methods of this service are expected to have * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS
* security checks based on the propagated JAAS credentials because this service * credentials because this service can be accessed remotely.
* can be accessed remotely.
* </p> * </p>
* *
* @author * @author
@ -73,8 +70,8 @@ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseIm
private final static Log _log = LogFactoryUtil.getLog(ReportTaskManagerServiceImpl.class); private final static Log _log = LogFactoryUtil.getLog(ReportTaskManagerServiceImpl.class);
@Override @Override
public long[] doReport(long companyId, long userId, Map<String, Serializable> taskContextMap, public long[] doReport(long companyId, long userId, Map<String, Serializable> taskContextMap, Object dataSource)
Object dataSource) throws PortalException, SystemException { throws PortalException, SystemException {
long[] fileEntryIds = new long[0]; long[] fileEntryIds = new long[0];
@ -84,121 +81,83 @@ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseIm
ReportConstants.PARAM_REPORTS)); ReportConstants.PARAM_REPORTS));
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(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(); long[] fileEntryTemplateIds = reportDto.getFileEntryIds();
ReportType reportType = reportDto.getReportType(); ReportType reportType = reportDto.getReportType();
List<byte[]> rawReports = new ArrayList<byte[]>(fileEntryTemplateIds.length); List<byte[]> rawReports = new ArrayList<byte[]>(fileEntryTemplateIds.length);
for (long fileEntryTemplateId : fileEntryTemplateIds) { for (long fileEntryTemplateId : fileEntryTemplateIds) {
Map<String, Object> reportParameters = reportDto.getParameters(); Map<String, Object> reportParameters = reportDto.getParameters();
InputStream templateInputStream = null; InputStream templateInputStream = null;
try { try {
// recupero da document library il template // recupero da document library il template
FileEntry fileEntryTemplate = dlAppLocalService.getFileEntry(fileEntryTemplateId); FileEntry fileEntryTemplate = dlAppLocalService.getFileEntry(fileEntryTemplateId);
templateInputStream = DLFileEntryLocalServiceUtil.getFileAsStream( templateInputStream = DLFileEntryLocalServiceUtil.getFileAsStream(
fileEntryTemplate.getFileEntryId(), fileEntryTemplate.getVersion(), false); fileEntryTemplate.getFileEntryId(), fileEntryTemplate.getVersion(), false);
// generazione report // generazione report
if (reportType.equals(ReportType.JRXML_TO_PDF)) { if (reportType.equals(ReportType.JRXML_TO_PDF)) {
// Object dataSource = reportDto.getDataSource();
ReportInterface reportInterface = null; ReportInterface reportInterface = null;
if (dataSource != null) { if (dataSource != null) {
reportInterface = new BeanReport(dataSource); reportInterface = new BeanReport(dataSource);
} }
HashMap<String, Object> params = new HashMap<String, Object>(); HashMap<String, Object> params = new HashMap<String, Object>();
if (reportParameters != null) { if (reportParameters != null) {
params.putAll(reportParameters); params.putAll(reportParameters);
} }
JasperPdfProvider pdfProvider = new JasperPdfProvider(); JasperPdfProvider pdfProvider = new JasperPdfProvider();
pdfProvider.doReport(templateInputStream, params, reportInterface); pdfProvider.doReport(templateInputStream, params, reportInterface);
rawReports.add(pdfProvider.getBytes()); rawReports.add(pdfProvider.getBytes());
} else if (reportType.equals(ReportType.ODT_TO_PDF)) { } else if (reportType.equals(ReportType.ODT_TO_PDF)) {
ByteArrayOutputStream baosOdt = new ByteArrayOutputStream(); ByteArrayOutputStream baosOdt = new ByteArrayOutputStream();
OdtToPdfEngine odtEngine = new OdtToPdfEngine(); OdtToPdfEngine odtEngine = new OdtToPdfEngine();
odtEngine.createPdfFile(templateInputStream, reportParameters, baosOdt); odtEngine.createPdfFile(templateInputStream, reportParameters, baosOdt);
rawReports.add(baosOdt.toByteArray()); rawReports.add(baosOdt.toByteArray());
} else if (reportType.equals(ReportType.VELOCITY_TO_PDF) } else if (reportType.equals(ReportType.VELOCITY_TO_PDF)
|| reportType.equals(ReportType.HTML_TO_PDF)) { || reportType.equals(ReportType.HTML_TO_PDF)) {
String[] css = reportDto.getCss(); String[] css = reportDto.getCss();
String baseURL = reportDto.getPortalURL(); String baseURL = reportDto.getPortalURL();
String html = StringUtil.read(templateInputStream); String html = StringUtil.read(templateInputStream);
if (reportType.equals(ReportType.VELOCITY_TO_PDF)) { if (reportType.equals(ReportType.VELOCITY_TO_PDF)) {
html = VelocityUtil.evaluate(html, reportParameters); html = VelocityUtil.evaluate(html, reportParameters);
} }
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
HtmlToPdfEngine engine = new HtmlToPdfEngine(); HtmlToPdfEngine engine = new HtmlToPdfEngine();
engine.createPdfFile(html, css, baseURL, reportDto.getHeader(), engine.createPdfFile(html, css, baseURL, reportDto.getHeader(),
reportDto.getHeaderHeight(), reportDto.getFooter(), reportDto.getHeaderHeight(), reportDto.getFooter(), reportDto.getFooterHeight(),
reportDto.getFooterHeight(), baos); baos);
rawReports.add(baos.toByteArray()); rawReports.add(baos.toByteArray());
} }
} finally { } finally {
StreamUtil.cleanUp(templateInputStream); StreamUtil.cleanUp(templateInputStream);
} }
} }
byte[] bytes = PdfUtil.mergePdf(rawReports, reportDto.isShowNumberOfPage()); byte[] bytes = PdfUtil.mergePdf(rawReports, reportDto.isShowNumberOfPage());
// recupero folder dove inserire report generato // recupero folder dove inserire report generato
long folderId = reportDto.getFolderId(); long folderId = reportDto.getFolderId();
Folder folder = DLAppLocalServiceUtil.getFolder(folderId); Folder folder = DLAppLocalServiceUtil.getFolder(folderId);
long groupId = folder.getGroupId(); long groupId = folder.getGroupId();
long repositoryId = folder.getRepositoryId(); long repositoryId = folder.getRepositoryId();
String title = reportDto.getFileName(); String title = reportDto.getFileName();
String fileName = title + StringPool.PERIOD + "pdf"; String fileName = title + StringPool.PERIOD + "pdf";
String mimeType = MimeTypesUtil.getContentType(fileName); String mimeType = MimeTypesUtil.getContentType(fileName);
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(companyId); serviceContext.setCompanyId(companyId);
serviceContext.setUserId(userId); serviceContext.setUserId(userId);
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW }); serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
_log.info("addFileEntry userId=" + userId + ", repositoryId=" + repositoryId + ", folderId="
+ folderId + ", sourceFileName=" + fileName + ", mimeType=" + mimeType + ", title="
+ title);
FileEntry fileEntry = null; FileEntry fileEntry = null;
try { try {
fileEntry = DLAppLocalServiceUtil.getFileEntry(groupId, folderId, title); fileEntry = DLAppLocalServiceUtil.getFileEntry(groupId, folderId, title);
fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntry.getFileEntryId(), fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntry.getFileEntryId(), fileName,
fileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, false, bytes, mimeType, title, StringPool.BLANK, StringPool.BLANK, false, bytes, serviceContext);
serviceContext);
} catch (PortalException e) { } catch (PortalException e) {
fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, fileName, fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, fileName, mimeType,
mimeType, title, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext); title, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
} }
fileEntryIds = ArrayUtil.append(fileEntryIds, fileEntry.getFileEntryId()); fileEntryIds = ArrayUtil.append(fileEntryIds, fileEntry.getFileEntryId());
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return fileEntryIds; 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.namespace=portos_rep
build.number=28 build.number=30
build.date=1603814144806 build.date=1615540264646
build.auto.upgrade=true build.auto.upgrade=true
## ##

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

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

Caricamento…
Annulla
Salva