Sfoglia il codice sorgente

Nuova gestione firme

master
Salvatore La Manna 4 anni fa
parent
commit
4456f5280d
  1. 6
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/portlet.xml
  2. 3
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalService.java
  3. 523
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalServiceClp.java
  4. 5
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalServiceUtil.java
  5. 6
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalServiceWrapper.java
  6. 18
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java
  7. 311
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/PuliziaDatabase.java
  8. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/PortosAdministrationPortlet.java
  9. 553
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/IntPraticaLocalServiceClpInvoker.java
  10. 158
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java
  11. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties
  12. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp
  13. 144
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/FirmeBean.java
  14. 97
      liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/FirmeUtil.java

6
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/portlet.xml

@ -404,7 +404,7 @@
</portlet> </portlet>
<portlet> <portlet>
<portlet-name>portos-administration</portlet-name> <portlet-name>portos-administration</portlet-name>
<display-name>Amministrazione Sismica</display-name> <display-name>Amministrazione Paesaggistica</display-name>
<portlet-class> <portlet-class>
it.tref.liferay.portos.bo.portlet.PortosAdministrationPortlet it.tref.liferay.portos.bo.portlet.PortosAdministrationPortlet
</portlet-class> </portlet-class>
@ -418,8 +418,8 @@
<portlet-mode>view</portlet-mode> <portlet-mode>view</portlet-mode>
</supports> </supports>
<portlet-info> <portlet-info>
<title>Amministrazione Sismica</title> <title>Amministrazione Paesaggistica</title>
<short-title>Amministrazione Sismica</short-title> <short-title>Amministrazione Paesaggistica</short-title>
<keywords></keywords> <keywords></keywords>
</portlet-info> </portlet-info>
<security-role-ref> <security-role-ref>

3
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalService.java

@ -355,9 +355,6 @@ public interface IntPraticaLocalService extends BaseLocalService,
throws com.liferay.portal.kernel.exception.PortalException, throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException; com.liferay.portal.kernel.exception.SystemException;
public java.util.List<java.lang.String> svuotaDatabase(
com.liferay.portal.service.ServiceContext serviceContext);
public java.util.List<java.lang.String> svuotaDatabase2( public java.util.List<java.lang.String> svuotaDatabase2(
com.liferay.portal.service.ServiceContext serviceContext); com.liferay.portal.service.ServiceContext serviceContext);

523
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalServiceClp.java

File diff soppresso perché troppo grande Load Diff

5
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalServiceUtil.java

@ -392,11 +392,6 @@ public class IntPraticaLocalServiceUtil {
esitoControllo, dtPratica, oldIntPraticaId, serviceContext); esitoControllo, dtPratica, oldIntPraticaId, serviceContext);
} }
public static java.util.List<java.lang.String> svuotaDatabase(
com.liferay.portal.service.ServiceContext serviceContext) {
return getService().svuotaDatabase(serviceContext);
}
public static java.util.List<java.lang.String> svuotaDatabase2( public static java.util.List<java.lang.String> svuotaDatabase2(
com.liferay.portal.service.ServiceContext serviceContext) { com.liferay.portal.service.ServiceContext serviceContext) {
return getService().svuotaDatabase2(serviceContext); return getService().svuotaDatabase2(serviceContext);

6
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/IntPraticaLocalServiceWrapper.java

@ -417,12 +417,6 @@ public class IntPraticaLocalServiceWrapper implements IntPraticaLocalService,
oldIntPraticaId, serviceContext); oldIntPraticaId, serviceContext);
} }
@Override
public java.util.List<java.lang.String> svuotaDatabase(
com.liferay.portal.service.ServiceContext serviceContext) {
return _intPraticaLocalService.svuotaDatabase(serviceContext);
}
@Override @Override
public java.util.List<java.lang.String> svuotaDatabase2( public java.util.List<java.lang.String> svuotaDatabase2(
com.liferay.portal.service.ServiceContext serviceContext) { com.liferay.portal.service.ServiceContext serviceContext) {

18
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java

@ -18,6 +18,7 @@ import it.tref.liferay.portos.bo.service.IntPraticaServiceUtil;
import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil; import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil;
import it.tref.liferay.portos.bo.shared.bean.FirmeBean; import it.tref.liferay.portos.bo.shared.bean.FirmeBean;
import it.tref.liferay.portos.bo.shared.bean.FirmeDetail;
import it.tref.liferay.portos.bo.shared.util.Constants; import it.tref.liferay.portos.bo.shared.util.Constants;
import it.tref.liferay.portos.bo.shared.util.FirmeUtil; import it.tref.liferay.portos.bo.shared.util.FirmeUtil;
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants;
@ -990,23 +991,26 @@ public class ValidazionePraticaUtil {
long intPraticaId = dettPratica.getIntPraticaId(); long intPraticaId = dettPratica.getIntPraticaId();
IntPratica intPratica = IntPraticaServiceUtil.getIntPratica(intPraticaId); IntPratica intPratica = IntPraticaServiceUtil.getIntPratica(intPraticaId);
List<String> obbligatori = DocumentiPraticaUtil.getDocObbligatoriDomanda(intPratica, dettPratica); List<String> docObbligatori = DocumentiPraticaUtil.getDocObbligatoriDomanda(intPratica, dettPratica);
for (String obbligatorio : obbligatori) { for (String docObbligatorio : docObbligatori) {
List<DocPratica> docs = DocPraticaLocalServiceUtil.getValidTmpByIntPratica_Tipologia( List<DocPratica> docs = DocPraticaLocalServiceUtil.getValidTmpByIntPratica_Tipologia(
intPraticaId, obbligatorio, QueryUtil.ALL_POS, QueryUtil.ALL_POS); intPraticaId, docObbligatorio, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
if (docs.isEmpty()) { if (docs.isEmpty()) {
notCompleted.add("Nessun Allegato per " notCompleted.add("Nessun Allegato per "
+ LanguageUtil.get(LocaleUtil.getDefault(), "label-documenti-tipologia-" + LanguageUtil.get(LocaleUtil.getDefault(), "label-documenti-tipologia-"
+ obbligatorio)); + docObbligatorio));
} else { } else {
for (DocPratica doc : docs) { for (DocPratica doc : docs) {
FirmeBean firmeBean = FirmeUtil.deserialize(doc.getJsonFirmatari()); FirmeBean firmeBean = FirmeUtil.deserialize(doc.getJsonFirmatari());
List<String> firme = firmeBean.allSignatures(); List<String> firme = firmeBean.allSignatures();
List<String> firmeObbligatorie = getFirmeObbligatorie(docObbligatorio);
_log.info("Per l'allegato " _log.info("Per l'allegato "
+ LanguageUtil.get(LocaleUtil.getDefault(), "label-documenti-tipologia-" + LanguageUtil.get(LocaleUtil.getDefault(), "label-documenti-tipologia-"
+ obbligatorio) + " servono le firme di:"); + docObbligatorio) + " servono le firme di:");
for (String firma : firme) { for (String firmaObbligatoria : firmeObbligatorie) {
_log.info(" " + LanguageUtil.get(LocaleUtil.getDefault(), "gc-soggetto-" + firma)); _log.info(" "
+ LanguageUtil.get(LocaleUtil.getDefault(), "gc-soggetto-"
+ firmaObbligatoria));
} }
} }
} }

311
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/PuliziaDatabase.java

@ -0,0 +1,311 @@
/**
*
* @author Salvatore La Manna, Manifattura Web Group per Regione Siciliana
*
*/
package it.mwg.sismica.bo.util;
import it.tref.liferay.portos.bo.model.ControlloPratica;
import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.cache.MultiVMPoolUtil;
import com.liferay.portal.kernel.cache.SingleVMPoolUtil;
import com.liferay.portal.kernel.dao.jdbc.DataAccess;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.servlet.DirectServletRegistryUtil;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.Organization;
import com.liferay.portal.model.User;
import com.liferay.portal.service.ClassNameLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portlet.documentlibrary.model.DLFileEntry;
import com.liferay.portlet.documentlibrary.model.DLFileEntryMetadata;
import com.liferay.portlet.documentlibrary.model.DLFolder;
import com.liferay.portlet.documentlibrary.model.DLSyncConstants;
import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil;
import com.liferay.portlet.dynamicdatamapping.model.DDMContent;
import com.liferay.portlet.dynamicdatamapping.model.DDMStorageLink;
import com.liferay.portlet.messageboards.model.MBDiscussion;
public class PuliziaDatabase {
private static final Log _log = LogFactoryUtil.getLog(PuliziaDatabase.class);
private static final int SLICE = 1000;
public static List<String> pulisci(ServiceContext serviceContext) {
List<String> esito = new ArrayList<>();
esito.addAll(puliziaDocumentLibrary());
esito.addAll(svuotaDatabase(serviceContext));
try {
SingleVMPoolUtil.clear();
MultiVMPoolUtil.clear();
CacheRegistryUtil.clear();
DirectServletRegistryUtil.clearServlets();
} catch (IllegalStateException e) {
}
return esito;
}
private static List<String> svuotaDatabase(ServiceContext serviceContext) {
List<String> esito = new ArrayList<>();
int rows = 0;
try {
Connection connection = DataAccess.getUpgradeOptimizedConnection();
Statement s = connection.createStatement();
long controlloPraticaClassNameId = ClassNameLocalServiceUtil.getClassName(
ControlloPratica.class.getName()).getClassNameId();
long dettPraticaClassNameId = ClassNameLocalServiceUtil.getClassName(DettPratica.class.getName())
.getClassNameId();
long ddmContentClassNameId = ClassNameLocalServiceUtil.getClassName(DDMContent.class.getName())
.getClassNameId();
long dlFileEntryClassNameId = ClassNameLocalServiceUtil.getClassName(DLFileEntry.class.getName())
.getClassNameId();
long dlFileEntryMetadataClassNameId = ClassNameLocalServiceUtil.getClassName(
DLFileEntryMetadata.class.getName()).getClassNameId();
long dlFolderClassNameId = ClassNameLocalServiceUtil.getClassName(DLFolder.class.getName())
.getClassNameId();
long groupClassNameId = ClassNameLocalServiceUtil.getClassName(Group.class.getName())
.getClassNameId();
long mbDiscussionClassNameId = ClassNameLocalServiceUtil.getClassName(
MBDiscussion.class.getName()).getClassNameId();
long organizationClassNameId = ClassNameLocalServiceUtil.getClassName(
Organization.class.getName()).getClassNameId();
long userClassNameId = ClassNameLocalServiceUtil.getClassName(User.class.getName())
.getClassNameId();
rows = s.executeUpdate("DELETE FROM portos_bo_avviso WHERE avvisoid IN ("
+ "SELECT avvisoid FROM portos_bo_avviso a LEFT JOIN portos_bo_dettpratica d "
+ "ON a.classpk=d.dettpraticaid WHERE classname='" + DettPratica.class.getName()
+ "' AND d.dettpraticaid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da portos_bo_avviso");
rows = s.executeUpdate("DELETE FROM group_ WHERE groupid IN (SELECT groupid FROM group_ "
+ "LEFT JOIN user_ ON group_.classpk=user_.userid WHERE classnameid=" + userClassNameId
+ " AND user_.userid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da group_");
rows = s.executeUpdate("DELETE FROM contact_ WHERE contactid IN ("
+ "SELECT c.contactid FROM contact_ c LEFT JOIN user_ u "
+ "ON c.contactid=u.contactid WHERE u.userid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da contact_");
rows = s.executeUpdate("DELETE FROM usergroup WHERE usergroupid IN ("
+ "SELECT usergroupid FROM usergroup g LEFT JOIN user_ u ON g.userid=u.userid "
+ "WHERE u.userid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da usergroup");
rows = s.executeUpdate("DELETE FROM usergrouprole WHERE userid IN ("
+ "SELECT DISTINCT x.userid FROM usergrouprole x "
+ "LEFT JOIN user_ u ON x.userid=u.userid " + "WHERE u.userid IS NULL) OR groupid IN ("
+ "SELECT DISTINCT x.groupid FROM usergrouprole x "
+ "LEFT JOIN group_ g ON x.groupid=g.groupid "
+ "WHERE g.groupid IS NULL) OR roleid IN ("
+ "SELECT DISTINCT x.roleid FROM usergrouprole x "
+ "LEFT JOIN role_ r ON x.roleid=r.roleid " + "WHERE r.roleid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da usergrouprole");
rows = s.executeUpdate("DELETE FROM ddmcontent WHERE contentid IN ("
+ "SELECT contentid FROM ddmcontent LEFT JOIN dlfileentrymetadata "
+ "ON ddmcontent.contentid=dlfileentrymetadata.ddmstorageid WHERE name='"
+ DDMStorageLink.class.getName()
+ "' AND dlfileentrymetadata.fileentrymetadataid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da ddmcontent");
rows = s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN dlfileentry b "
+ "ON a.classpk=b.fileentryid WHERE a.classnameid=" + dlFileEntryClassNameId
+ " AND b.fileentryid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN dlfolder b ON a.classpk=b.folderid "
+ "WHERE a.classnameid=" + dlFolderClassNameId + " AND b.folderid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN group_ b ON a.classpk=b.groupid "
+ "WHERE a.classnameid=" + groupClassNameId + " AND b.groupid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN mbdiscussion b "
+ "ON a.classpk=b.discussionid WHERE a.classnameid=" + mbDiscussionClassNameId
+ " AND b.discussionid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN organization_ b "
+ "ON a.classpk=b.organizationid WHERE a.classnameid=" + organizationClassNameId
+ " AND b.organizationid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN portos_bo_controllopratica b "
+ "ON a.classpk=b.controllopraticaid WHERE a.classnameid=" + controlloPraticaClassNameId
+ " AND b.controllopraticaid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN portos_bo_dettpratica b "
+ "ON a.classpk=b.dettpraticaid WHERE a.classnameid=" + dettPraticaClassNameId
+ " AND b.dettpraticaid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN user_ b ON a.classpk=b.userid "
+ "WHERE a.classnameid=" + userClassNameId + " AND b.userid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da assetentry");
rows = s.executeUpdate("DELETE FROM resourcepermission WHERE resourcepermissionid IN ("
+ "SELECT resourcepermissionid FROM resourcepermission a LEFT JOIN dlfileentry b "
+ "ON a.primkey=b.fileentryid::TEXT WHERE a.name='" + DLFileEntry.class.getName()
+ "' AND b.fileentryid IS NULL)");
rows += s.executeUpdate("DELETE FROM resourcepermission WHERE resourcepermissionid IN ("
+ "SELECT resourcepermissionid FROM resourcepermission a LEFT JOIN dlfolder b "
+ "ON a.primkey=b.folderid::TEXT WHERE a.name='" + DLFolder.class.getName()
+ "' AND b.folderid IS NULL)");
rows += s.executeUpdate("DELETE FROM resourcepermission WHERE resourcepermissionid IN ("
+ "SELECT resourcepermissionid FROM resourcepermission a "
+ "LEFT JOIN portos_bo_controllopratica b "
+ "ON a.primkey=b.controllopraticaid::TEXT WHERE a.name='"
+ ControlloPratica.class.getName() + "' AND b.controllopraticaid IS NULL)");
rows += s.executeUpdate("DELETE FROM resourcepermission WHERE resourcepermissionid IN ("
+ "SELECT resourcepermissionid FROM resourcepermission a LEFT JOIN user_ b "
+ "ON a.primkey=b.userid::TEXT WHERE a.name='" + User.class.getName()
+ "' AND b.userid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da resourcepermission");
rows = s.executeUpdate("DELETE FROM syncdlobject WHERE syncdlobjectid IN ("
+ "SELECT syncdlobjectid FROM syncdlobject LEFT JOIN dlfileentry "
+ "ON syncdlobject.typepk=dlfileentry.fileentryid WHERE type_='"
+ DLSyncConstants.TYPE_FILE + "' AND dlfileentry.fileentryid IS NULL)");
rows += s.executeUpdate("DELETE FROM syncdlobject WHERE syncdlobjectid IN ("
+ "SELECT syncdlobjectid FROM syncdlobject LEFT JOIN dlfolder "
+ "ON syncdlobject.typepk=dlfolder.folderid WHERE type_='" + DLSyncConstants.TYPE_FOLDER
+ "' AND dlfolder.folderid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da syncdlobject");
rows = s.executeUpdate("DELETE FROM ratingsstats WHERE statsid IN ("
+ "SELECT statsid FROM ratingsstats a LEFT JOIN dlfileentry b "
+ "ON a.classpk=b.fileentryid WHERE a.classnameid=" + dlFileEntryClassNameId
+ " AND b.fileentryid IS NULL)");
rows += s.executeUpdate("DELETE FROM ratingsstats WHERE statsid IN ("
+ "SELECT statsid FROM ratingsstats a LEFT JOIN dlfolder b "
+ "ON a.classpk=b.folderid WHERE a.classnameid=" + dlFolderClassNameId
+ " AND b.folderid IS NULL)");
rows += s.executeUpdate("DELETE FROM ratingsstats WHERE statsid IN ("
+ "SELECT statsid FROM ratingsstats a LEFT JOIN portos_bo_controllopratica b "
+ "ON a.classpk=b.controllopraticaid WHERE a.classnameid=" + controlloPraticaClassNameId
+ " AND b.controllopraticaid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da ratingsstats");
rows = s.executeUpdate("DELETE FROM mbmessage WHERE messageid IN ("
+ "SELECT messageid FROM mbmessage a LEFT JOIN dlfileentry b "
+ "ON a.classpk=b.fileentryid WHERE a.classnameid=" + dlFileEntryClassNameId
+ " AND b.fileentryid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da mbmessage");
rows = s.executeUpdate("DELETE FROM mbdiscussion WHERE discussionid IN ("
+ "SELECT discussionid FROM mbdiscussion a LEFT JOIN dlfileentry b "
+ "ON a.classpk=b.fileentryid WHERE a.classnameid=" + dlFileEntryClassNameId
+ " AND b.fileentryid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da mbdiscussion");
rows = s.executeUpdate("DELETE FROM mbthread WHERE threadid IN ("
+ "SELECT DISTINCT mbthread.threadid FROM mbthread LEFT JOIN mbmessage "
+ "ON mbthread.threadid=mbmessage.threadid WHERE mbmessage.messageid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da mbthread");
rows = s.executeUpdate("DELETE FROM dlfileentrymetadata WHERE fileentrymetadataid IN ("
+ "SELECT fileentrymetadataid FROM dlfileentrymetadata a LEFT JOIN dlfileentry b "
+ "ON a.fileentryid=b.fileentryid WHERE b.fileentryid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da dlfileentrymetadata");
rows = s.executeUpdate("DELETE FROM ddmstructurelink WHERE structurelinkid IN ("
+ "SELECT structurelinkid FROM ddmstructurelink a LEFT JOIN dlfileentrymetadata b "
+ "ON a.classpk=b.fileentrymetadataid WHERE a.classnameid="
+ dlFileEntryMetadataClassNameId + " AND b.fileentrymetadataid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da ddmstructurelink");
rows = s.executeUpdate("DELETE FROM ddmstoragelink WHERE storagelinkid IN ("
+ "SELECT storagelinkid FROM ddmstoragelink a LEFT JOIN ddmcontent b "
+ "ON a.classpk=b.contentid WHERE a.classnameid=" + ddmContentClassNameId
+ " AND b.contentid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da ddmstoragelink");
rows = s.executeUpdate("DELETE FROM socialactivity WHERE activityid IN ("
+ "SELECT activityid FROM socialactivity a LEFT JOIN dlfileentry b "
+ "ON a.classpk=b.fileentryid WHERE a.classnameid=" + dlFileEntryClassNameId
+ " AND b.fileentryid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da socialactivity");
rows = s.executeUpdate("DELETE FROM systemevent WHERE systemeventid IN ("
+ "SELECT systemeventid FROM systemevent a LEFT JOIN dlfileentry b "
+ "ON a.classpk=b.fileentryid WHERE a.classnameid=" + dlFileEntryClassNameId
+ " AND b.fileentryid IS NULL)");
rows += s.executeUpdate("DELETE FROM systemevent WHERE systemeventid IN ("
+ "SELECT systemeventid FROM systemevent a LEFT JOIN dlfolder b "
+ "ON a.classpk=b.folderid WHERE a.classnameid=" + dlFolderClassNameId
+ " AND b.folderid IS NULL)");
rows += s.executeUpdate("DELETE FROM systemevent WHERE systemeventid IN ("
+ "SELECT systemeventid FROM systemevent a LEFT JOIN portos_bo_controllopratica b "
+ "ON a.classpk=b.controllopraticaid WHERE a.classnameid=" + controlloPraticaClassNameId
+ " AND b.controllopraticaid IS NULL)");
rows += s.executeUpdate("DELETE FROM systemevent WHERE systemeventid IN ("
+ "SELECT systemeventid FROM systemevent a LEFT JOIN portos_bo_dettpratica b "
+ "ON a.classpk=b.dettpraticaid WHERE a.classnameid=" + dettPraticaClassNameId
+ " AND b.dettpraticaid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da systemevent");
} catch (SQLException | SystemException e) {
esitoLog(esito, "Interrotto per errore: " + e.getMessage());
}
return esito;
}
private static List<String> puliziaDocumentLibrary() {
List<String> esito = new ArrayList<>();
try {
int cancellati = 0;
int start = 0;
int totali = 0;
List<DLFolder> folders;
do {
folders = DLFolderLocalServiceUtil.getDLFolders(start, start + SLICE);
int rimossi = 0;
totali += folders.size();
for (DLFolder folder : folders) {
DLFolder parent = folder.getParentFolder();
if (Validator.isNotNull(parent)) {
switch (parent.getName()) {
case "Allegati":
long[] ids = StringUtil.split(folder.getName(), "_", 0L);
if ((ids.length == 2) && (ids[0] == ids[1])) {
try {
DettPraticaLocalServiceUtil.getDettPratica(ids[0]);
} catch (PortalException e) {
_log.info("Cancello la cartella " + folder.getName());
cancellati++;
rimossi++;
DLAppLocalServiceUtil.deleteFolder(folder.getFolderId());
}
}
break;
}
}
}
start += folders.size() - rimossi;
} while (folders.size() > 0);
esitoLog(esito, "Analizzate " + totali + " cartelle, cancellate " + cancellati);
} catch (PortalException | SystemException e) {
esitoLog(esito, "Errore durante l'elaborazione. " + e.getMessage());
}
return esito;
}
private static void esitoLog(List<String> esito, String msg) {
_log.info(msg);
esito.add(msg);
}
}

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

@ -1,11 +1,13 @@
package it.tref.liferay.portos.bo.portlet; package it.tref.liferay.portos.bo.portlet;
import it.mwg.sismica.bo.util.PuliziaDatabase;
import it.mwg.sismica.bo.util.SismicaUtil; import it.mwg.sismica.bo.util.SismicaUtil;
import it.mwg.sismica.bo.util.SorteggioPraticaUtil; import it.mwg.sismica.bo.util.SorteggioPraticaUtil;
import it.tref.liferay.portos.bo.model.ControlloPratica; import it.tref.liferay.portos.bo.model.ControlloPratica;
import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.service.ConfigurazioneServiceUtil; import it.tref.liferay.portos.bo.service.ConfigurazioneServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -98,7 +100,7 @@ public class PortosAdministrationPortlet extends MVCPortlet {
public void svuotaDatabase(ActionRequest actionRequest, ActionResponse actionResponse) public void svuotaDatabase(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortalException, SystemException { throws PortalException, SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
List<String> esito = IntPraticaLocalServiceUtil.svuotaDatabase(serviceContext); List<String> esito = PuliziaDatabase.pulisci(serviceContext);
actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()]));
} }

553
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/IntPraticaLocalServiceClpInvoker.java

File diff soppresso perché troppo grande Load Diff

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

@ -354,164 +354,6 @@ public class IntPraticaLocalServiceImpl extends IntPraticaLocalServiceBaseImpl {
return intPratica; return intPratica;
} }
public List<String> svuotaDatabase(ServiceContext serviceContext) {
List<String> esito = new ArrayList<>();
int rows = 0;
try {
Connection connection = DataAccess.getUpgradeOptimizedConnection();
Statement s = connection.createStatement();
long controlloPraticaClassNameId = ClassNameLocalServiceUtil.getClassName(
ControlloPratica.class.getName()).getClassNameId();
long dettPraticaClassNameId = ClassNameLocalServiceUtil.getClassName(DettPratica.class.getName())
.getClassNameId();
long dlFileEntryClassNameId = ClassNameLocalServiceUtil.getClassName(DLFileEntry.class.getName())
.getClassNameId();
long dlFolderClassNameId = ClassNameLocalServiceUtil.getClassName(DLFolder.class.getName())
.getClassNameId();
long groupClassNameId = ClassNameLocalServiceUtil.getClassName(Group.class.getName())
.getClassNameId();
long mbDiscussionClassNameId = ClassNameLocalServiceUtil.getClassName(
MBDiscussion.class.getName()).getClassNameId();
long organizationClassNameId = ClassNameLocalServiceUtil.getClassName(
Organization.class.getName()).getClassNameId();
long userClassNameId = ClassNameLocalServiceUtil.getClassName(User.class.getName())
.getClassNameId();
rows = s.executeUpdate("DELETE FROM portos_bo_avviso WHERE avvisoid IN ("
+ "SELECT avvisoid FROM portos_bo_avviso a LEFT JOIN portos_bo_dettpratica d "
+ "ON a.classpk=d.dettpraticaid WHERE classname='" + DettPratica.class.getName()
+ "' AND d.dettpraticaid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da portos_bo_avviso");
rows = s.executeUpdate("DELETE FROM group_ WHERE groupid IN (SELECT groupid FROM group_ "
+ "LEFT JOIN user_ ON group_.classpk=user_.userid WHERE classnameid=" + userClassNameId
+ " AND user_.userid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da group_");
rows = s.executeUpdate("DELETE FROM contact_ WHERE contactid IN ("
+ "SELECT c.contactid FROM contact_ c LEFT JOIN user_ u "
+ "ON c.contactid=u.contactid WHERE u.userid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da contact_");
rows = s.executeUpdate("DELETE FROM usergroup WHERE usergroupid IN ("
+ "SELECT usergroupid FROM usergroup g LEFT JOIN user_ u ON g.userid=u.userid "
+ "WHERE u.userid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da usergroup");
rows = s.executeUpdate("DELETE FROM usergrouprole WHERE userid IN ("
+ "SELECT DISTINCT x.userid FROM usergrouprole x "
+ "LEFT JOIN user_ u ON x.userid=u.userid " + "WHERE u.userid IS NULL) OR groupid IN ("
+ "SELECT DISTINCT x.groupid FROM usergrouprole x "
+ "LEFT JOIN group_ g ON x.groupid=g.groupid "
+ "WHERE g.groupid IS NULL) OR roleid IN ("
+ "SELECT DISTINCT x.roleid FROM usergrouprole x "
+ "LEFT JOIN role_ r ON x.roleid=r.roleid " + "WHERE r.roleid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da usergrouprole");
rows = s.executeUpdate("DELETE FROM ddmcontent WHERE contentid IN ("
+ "SELECT contentid FROM ddmcontent LEFT JOIN dlfileentrymetadata "
+ "ON ddmcontent.contentid=dlfileentrymetadata.ddmstorageid WHERE name='"
+ DDMStorageLink.class.getName()
+ "' AND dlfileentrymetadata.fileentrymetadataid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da ddmcontent");
rows = s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN dlfileentry b "
+ "ON a.classpk=b.fileentryid WHERE a.classnameid=" + dlFileEntryClassNameId
+ " AND b.fileentryid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN dlfolder b ON a.classpk=b.folderid "
+ "WHERE a.classnameid=" + dlFolderClassNameId + " AND b.folderid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN group_ b ON a.classpk=b.groupid "
+ "WHERE a.classnameid=" + groupClassNameId + " AND b.groupid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN mbdiscussion b "
+ "ON a.classpk=b.discussionid WHERE a.classnameid=" + mbDiscussionClassNameId
+ " AND b.discussionid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN organization_ b "
+ "ON a.classpk=b.organizationid WHERE a.classnameid=" + organizationClassNameId
+ " AND b.organizationid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN portos_bo_controllopratica b "
+ "ON a.classpk=b.controllopraticaid WHERE a.classnameid=" + controlloPraticaClassNameId
+ " AND b.controllopraticaid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN portos_bo_dettpratica b "
+ "ON a.classpk=b.dettpraticaid WHERE a.classnameid=" + dettPraticaClassNameId
+ " AND b.dettpraticaid IS NULL)");
rows += s.executeUpdate("DELETE FROM assetentry WHERE entryid IN ("
+ "SELECT entryid FROM assetentry a LEFT JOIN user_ b ON a.classpk=b.userid "
+ "WHERE a.classnameid=" + userClassNameId + " AND b.userid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da assetentry");
rows = s.executeUpdate("DELETE FROM resourcepermission WHERE resourcepermissionid IN ("
+ "SELECT resourcepermissionid FROM resourcepermission a LEFT JOIN dlfileentry b "
+ "ON a.primkey=b.fileentryid::TEXT WHERE a.name='" + DLFileEntry.class.getName()
+ "' AND b.fileentryid IS NULL)");
rows += s.executeUpdate("DELETE FROM resourcepermission WHERE resourcepermissionid IN ("
+ "SELECT resourcepermissionid FROM resourcepermission a LEFT JOIN dlfolder b "
+ "ON a.primkey=b.folderid::TEXT WHERE a.name='" + DLFolder.class.getName()
+ "' AND b.folderid IS NULL)");
rows += s
.executeUpdate("DELETE FROM resourcepermission WHERE resourcepermissionid IN ("
+ "SELECT resourcepermissionid FROM resourcepermission a LEFT JOIN portos_bo_controllopratica b "
+ "ON a.primkey=b.controllopraticaid::TEXT WHERE a.name='"
+ ControlloPratica.class.getName() + "' AND b.controllopraticaid IS NULL)");
rows += s.executeUpdate("DELETE FROM resourcepermission WHERE resourcepermissionid IN ("
+ "SELECT resourcepermissionid FROM resourcepermission a LEFT JOIN user_ b "
+ "ON a.primkey=b.userid::TEXT WHERE a.name='" + User.class.getName()
+ "' AND b.userid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da resourcepermission");
rows = s.executeUpdate("DELETE FROM syncdlobject WHERE syncdlobjectid IN ("
+ "SELECT syncdlobjectid FROM syncdlobject LEFT JOIN dlfileentry "
+ "ON syncdlobject.typepk=dlfileentry.fileentryid WHERE type_='"
+ DLSyncConstants.TYPE_FILE + "' AND dlfileentry.fileentryid IS NULL)");
rows += s.executeUpdate("DELETE FROM syncdlobject WHERE syncdlobjectid IN ("
+ "SELECT syncdlobjectid FROM syncdlobject LEFT JOIN dlfolder "
+ "ON syncdlobject.typepk=dlfolder.folderid WHERE type_='" + DLSyncConstants.TYPE_FOLDER
+ "' AND dlfolder.folderid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da syncdlobject");
rows = s.executeUpdate("DELETE FROM ratingsstats WHERE statsid IN ("
+ "SELECT statsid FROM ratingsstats a LEFT JOIN dlfileentry b "
+ "ON a.classpk=b.fileentryid WHERE a.classnameid=" + dlFileEntryClassNameId
+ " AND b.fileentryid IS NULL)");
rows += s.executeUpdate("DELETE FROM ratingsstats WHERE statsid IN ("
+ "SELECT statsid FROM ratingsstats a LEFT JOIN dlfolder b "
+ "ON a.classpk=b.folderid WHERE a.classnameid=" + dlFolderClassNameId
+ " AND b.folderid IS NULL)");
rows += s.executeUpdate("DELETE FROM ratingsstats WHERE statsid IN ("
+ "SELECT statsid FROM ratingsstats a LEFT JOIN portos_bo_controllopratica b "
+ "ON a.classpk=b.controllopraticaid WHERE a.classnameid=" + controlloPraticaClassNameId
+ " AND b.controllopraticaid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da ratingsstats");
rows = s.executeUpdate("DELETE FROM mbmessage WHERE messageid IN ("
+ "SELECT messageid FROM mbmessage a LEFT JOIN dlfileentry b "
+ "ON a.classpk=b.fileentryid WHERE a.classnameid="
+ dlFileEntryClassNameId + " AND b.fileentryid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da mbmessage");
rows = s.executeUpdate("DELETE FROM mbdiscussion WHERE discussionid IN ("
+ "SELECT discussionid FROM mbdiscussion a LEFT JOIN dlfileentry b "
+ "ON a.classpk=b.fileentryid WHERE a.classnameid="
+ dlFileEntryClassNameId + " AND b.fileentryid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da mbdiscussion");
rows = s.executeUpdate("DELETE FROM mbthread WHERE threadid IN ("
+ "SELECT DISTINCT mbthread.threadid FROM mbthread LEFT JOIN mbmessage "
+ "ON mbthread.threadid=mbmessage.threadid WHERE mbmessage.messageid IS NULL)");
esitoLog(esito, "Cancellate " + rows + " righe da mbthread");
} catch (SQLException | SystemException e) {
esitoLog(esito, "Interrotto per errore: " + e.getMessage());
}
return esito;
}
public List<String> svuotaDatabase2(ServiceContext serviceContext) { public List<String> svuotaDatabase2(ServiceContext serviceContext) {
List<String> esito = new ArrayList<>(); List<String> esito = new ArrayList<>();
try { try {

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=2536 build.number=2539
build.date=1599139129864 build.date=1599216162979
build.auto.upgrade=true build.auto.upgrade=true
## ##

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

@ -95,7 +95,7 @@ String dataProssimoSorteggio =
<div style="font-weight: bold; font-size: 18px; margin-bottom: 10px;">Test interno</div> <div style="font-weight: bold; font-size: 18px; margin-bottom: 10px;">Test interno</div>
<aui:form action="<%=svuotaDatabaseURL%>" method="post" name="fmSvuotaDatabase"> <aui:form action="<%=svuotaDatabaseURL%>" method="post" name="fmSvuotaDatabase">
<div> <div>
<aui:button cssClass="btn-danger" type="submit" value="Svuota Database" /> <aui:button cssClass="btn-danger" type="submit" value="Manutenzione Database" />
</div> </div>
</aui:form> </aui:form>
</div> </div>

144
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/bean/FirmeBean.java

@ -8,87 +8,87 @@ import java.util.List;
public class FirmeBean implements Serializable { public class FirmeBean implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private List<FirmeDetail> firmeDigitali = new UniqueList<FirmeDetail>(); private List<FirmeDetail> firmeDigitali = new UniqueList<FirmeDetail>();
private List<FirmeDetail> firmeApplicativo = new UniqueList<FirmeDetail>(); private List<FirmeDetail> firmeApplicativo = new UniqueList<FirmeDetail>();
public List<FirmeDetail> getFirmeDigitali() { public List<FirmeDetail> getFirmeDigitali() {
return new UnmodifiableList<>(firmeDigitali); return new UnmodifiableList<>(firmeDigitali);
} }
public void setFirmeDigitali(List<FirmeDetail> firmeDigitali) { public void setFirmeDigitali(List<FirmeDetail> firmeDigitali) {
this.firmeDigitali = new UniqueList<FirmeDetail>(); this.firmeDigitali = new UniqueList<FirmeDetail>();
for (FirmeDetail firmaDigitale : firmeDigitali) { for (FirmeDetail firmaDigitale : firmeDigitali) {
this.firmeDigitali.add(firmaDigitale); this.firmeDigitali.add(firmaDigitale);
} }
} }
public List<FirmeDetail> getFirmeApplicativo() { public List<FirmeDetail> getFirmeApplicativo() {
return new UnmodifiableList<>(firmeApplicativo); return new UnmodifiableList<>(firmeApplicativo);
} }
public void setFirmeApplicativo(List<FirmeDetail> firmeApplicativo) { public void setFirmeApplicativo(List<FirmeDetail> firmeApplicativo) {
this.firmeApplicativo = new UniqueList<FirmeDetail>(); this.firmeApplicativo = new UniqueList<FirmeDetail>();
for (FirmeDetail firmaApplicativo : firmeApplicativo) { for (FirmeDetail firmaApplicativo : firmeApplicativo) {
this.firmeApplicativo.add(firmaApplicativo); this.firmeApplicativo.add(firmaApplicativo);
} }
} }
public boolean firmaIsPresent(String codiceFiscale) { public boolean firmaIsPresent(String codiceFiscale) {
for (FirmeDetail firmaDigitale : firmeDigitali) { for (FirmeDetail firmaDigitale : firmeDigitali) {
if (firmaDigitale.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) { if (firmaDigitale.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) {
return true; return true;
} }
} }
for (FirmeDetail firmaApplicativo : firmeApplicativo) { for (FirmeDetail firmaApplicativo : firmeApplicativo) {
if (firmaApplicativo.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) { if (firmaApplicativo.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) {
return true; return true;
} }
} }
return false; return false;
} }
public boolean firmaIsAnnullabile(String codiceFiscale) { public boolean firmaIsAnnullabile(String codiceFiscale) {
for (FirmeDetail firmaApplicativo : firmeApplicativo) { for (FirmeDetail firmaApplicativo : firmeApplicativo) {
if (firmaApplicativo.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) { if (firmaApplicativo.getCfFirmatario().equalsIgnoreCase(codiceFiscale)) {
return true; return true;
} }
} }
return false; return false;
} }
public int numeroFirme() { public int numeroFirme() {
List<String> allSignatures = allSignatures(); List<String> allSignatures = allSignatures();
return allSignatures.size(); return allSignatures.size();
} }
public List<String> allSignatures() { public List<String> allSignatures() {
List<String> all = new UniqueList<String>(); List<String> all = new UniqueList<String>();
for (FirmeDetail firmaDigitale : firmeDigitali) { for (FirmeDetail firmaDigitale : firmeDigitali) {
all.add(firmaDigitale.getCfFirmatario().toLowerCase()); all.add(firmaDigitale.getCfFirmatario().toLowerCase());
} }
for (FirmeDetail firmaApplicativo : firmeApplicativo) { for (FirmeDetail firmaApplicativo : firmeApplicativo) {
all.add(firmaApplicativo.getCfFirmatario().toLowerCase()); all.add(firmaApplicativo.getCfFirmatario().toLowerCase());
} }
return all; return all;
} }
public List<FirmeDetail> allFirmeDetails() { public List<FirmeDetail> allFirmeDetails() {
List<FirmeDetail> all = new UniqueList<FirmeDetail>(); List<FirmeDetail> all = new UniqueList<FirmeDetail>();
all.addAll(firmeDigitali); all.addAll(firmeDigitali);
all.addAll(firmeApplicativo); all.addAll(firmeApplicativo);
return all; return all;
} }
public void removeFirmeApplicativo(String codiceFiscale) { public void removeFirmeApplicativo(String codiceFiscale) {
FirmeDetail firmeDetailToRemove = null; FirmeDetail firmeDetailToRemove = null;
for (FirmeDetail firmeDetail : firmeApplicativo) { for (FirmeDetail firmeDetail : firmeApplicativo) {
if (codiceFiscale.equalsIgnoreCase(firmeDetail.getCfFirmatario())) { if (codiceFiscale.equalsIgnoreCase(firmeDetail.getCfFirmatario())) {
firmeDetailToRemove = firmeDetail; firmeDetailToRemove = firmeDetail;
break; break;
} }
} }
firmeApplicativo.remove(firmeDetailToRemove); firmeApplicativo.remove(firmeDetailToRemove);
} }
} }

97
liferay-plugins-sdk-6.2/shared/portos-bo-shared/src/it/tref/liferay/portos/bo/shared/util/FirmeUtil.java

@ -3,11 +3,11 @@ package it.tref.liferay.portos.bo.shared.util;
import com.liferay.portal.kernel.json.JSONDeserializer; import com.liferay.portal.kernel.json.JSONDeserializer;
import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONSerializer; import com.liferay.portal.kernel.json.JSONSerializer;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.UniqueList; import com.liferay.portal.kernel.util.UniqueList;
import it.tref.liferay.portos.bo.shared.bean.FirmeBean; import it.tref.liferay.portos.bo.shared.bean.FirmeBean;
import it.tref.liferay.portos.bo.shared.bean.FirmeDetail; import it.tref.liferay.portos.bo.shared.bean.FirmeDetail;
import java.util.Date; import java.util.Date;
@ -15,59 +15,58 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class FirmeUtil { public class FirmeUtil {
public static String addFirma(FirmeBean firmeBean, String codiceFiscale) {
Date now = new Date();
List<FirmeDetail> firme = new UniqueList<FirmeDetail>();
firme.addAll(firmeBean.getFirmeApplicativo());
firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), now));
firmeBean.setFirmeApplicativo(firme);
return serialize(firmeBean);
}
public static String addFirma(FirmeBean firmeBean, String codiceFiscale) { public static String addFirmaDigitale(FirmeBean firmeBean, String codiceFiscale) {
Date now = new Date(); Date now = null;
List<FirmeDetail> firme = new UniqueList<FirmeDetail>(); List<FirmeDetail> firme = new UniqueList<FirmeDetail>();
firme.addAll(firmeBean.getFirmeApplicativo()); firme.addAll(firmeBean.getFirmeDigitali());
firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), now)); firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), now));
firmeBean.setFirmeApplicativo(firme); firmeBean.setFirmeDigitali(firme);
return serialize(firmeBean); return serialize(firmeBean);
} }
public static String addFirmaDigitale(FirmeBean firmeBean, String codiceFiscale) {
Date now = null;
List<FirmeDetail> firme = new UniqueList<FirmeDetail>();
firme.addAll(firmeBean.getFirmeDigitali());
firme.add(new FirmeDetail(codiceFiscale.toLowerCase(), now));
firmeBean.setFirmeDigitali(firme);
return serialize(firmeBean);
}
public static String addFirma(String jsonFirmatari, String codiceFiscale) { public static String addFirma(String jsonFirmatari, String codiceFiscale) {
FirmeBean firmeBean = deserialize(jsonFirmatari); FirmeBean firmeBean = deserialize(jsonFirmatari);
return addFirma(firmeBean, codiceFiscale); return addFirma(firmeBean, codiceFiscale);
} }
public static String addFirmaDigitale(String jsonFirmatari, String codiceFiscale) { public static String addFirmaDigitale(String jsonFirmatari, String codiceFiscale) {
FirmeBean firmeBean = deserialize(jsonFirmatari); FirmeBean firmeBean = deserialize(jsonFirmatari);
return addFirmaDigitale(firmeBean, codiceFiscale); return addFirmaDigitale(firmeBean, codiceFiscale);
} }
public static String removeFirma(FirmeBean firmeBean, String codiceFiscale) { public static String removeFirma(FirmeBean firmeBean, String codiceFiscale) {
firmeBean.removeFirmeApplicativo(codiceFiscale); firmeBean.removeFirmeApplicativo(codiceFiscale);
JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer().exclude("class"); JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer().exclude("class");
return jsonSerializer.serializeDeep(firmeBean); return jsonSerializer.serializeDeep(firmeBean);
} }
public static String removeFirma(String jsonFirmatari, String codiceFiscale) { public static String removeFirma(String jsonFirmatari, String codiceFiscale) {
FirmeBean firmeBean = deserialize(jsonFirmatari); FirmeBean firmeBean = deserialize(jsonFirmatari);
return removeFirma(firmeBean, codiceFiscale); return removeFirma(firmeBean, codiceFiscale);
} }
public static String serialize(FirmeBean firmeBean) { public static String serialize(FirmeBean firmeBean) {
JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer().exclude("class"); JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer().exclude("class");
return jsonSerializer.serializeDeep(firmeBean); return jsonSerializer.serializeDeep(firmeBean);
} }
public static FirmeBean deserialize(String jsonFirmatari) { public static FirmeBean deserialize(String jsonFirmatari) {
JSONDeserializer<Object> jsonSerializer = JSONFactoryUtil.createJSONDeserializer(); JSONDeserializer<Object> jsonSerializer = JSONFactoryUtil.createJSONDeserializer();
Map<String, List<FirmeDetail>> deserialized = Map<String, List<FirmeDetail>> deserialized = (Map<String, List<FirmeDetail>>) jsonSerializer
(Map<String, List<FirmeDetail>>) jsonSerializer.deserialize(jsonFirmatari); .deserialize(jsonFirmatari);
FirmeBean firmeBean = new FirmeBean(); FirmeBean firmeBean = new FirmeBean();
firmeBean.setFirmeApplicativo(deserialized.get("firmeApplicativo")); firmeBean.setFirmeApplicativo(deserialized.get("firmeApplicativo"));
firmeBean.setFirmeDigitali(deserialized.get("firmeDigitali")); firmeBean.setFirmeDigitali(deserialized.get("firmeDigitali"));
return firmeBean; return firmeBean;
} }
} }

Caricamento…
Annulla
Salva