|
|
|
@ -19,6 +19,8 @@ import it.tref.liferay.portos.bo.model.IntPratica;
|
|
|
|
|
import it.tref.liferay.portos.bo.model.Pagamento; |
|
|
|
|
import it.tref.liferay.portos.bo.model.ParereGeologo; |
|
|
|
|
import it.tref.liferay.portos.bo.model.Soggetto; |
|
|
|
|
import it.tref.liferay.portos.bo.model.Sorteggio; |
|
|
|
|
import it.tref.liferay.portos.bo.model.StoricoSoggettoPratica; |
|
|
|
|
import it.tref.liferay.portos.bo.model.Tempistica; |
|
|
|
|
import it.tref.liferay.portos.bo.service.AllegatoManualeLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.service.AsseverazioneLocalServiceUtil; |
|
|
|
@ -35,26 +37,40 @@ import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
|
|
|
|
|
import it.tref.liferay.portos.bo.service.PagamentoLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.service.ParereGeologoLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.service.SorteggioLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.service.StoricoSoggettoPraticaLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.service.TempisticaLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; |
|
|
|
|
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; |
|
|
|
|
import it.tref.liferay.portos.bo.util.AvvisoUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.util.Constants; |
|
|
|
|
import it.tref.liferay.portos.mailmanager.model.Email; |
|
|
|
|
import it.tref.liferay.portos.mailmanager.model.EmailAttachment; |
|
|
|
|
import it.tref.liferay.portos.mailmanager.model.EmailConstants; |
|
|
|
|
import it.tref.liferay.portos.mailmanager.model.EmailTemplate; |
|
|
|
|
import it.tref.liferay.portos.mailmanager.service.EmailAttachmentLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.mailmanager.service.EmailLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.mailmanager.service.EmailTemplateLocalServiceUtil; |
|
|
|
|
|
|
|
|
|
import java.sql.Connection; |
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
import java.sql.Statement; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashSet; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
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.repository.model.FileEntry; |
|
|
|
|
import com.liferay.portal.kernel.servlet.DirectServletRegistryUtil; |
|
|
|
|
import com.liferay.portal.kernel.util.StringPool; |
|
|
|
|
import com.liferay.portal.kernel.util.StringUtil; |
|
|
|
|
import com.liferay.portal.kernel.util.Validator; |
|
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowInstance; |
|
|
|
@ -67,9 +83,11 @@ import com.liferay.portal.model.Layout;
|
|
|
|
|
import com.liferay.portal.model.LayoutPrototype; |
|
|
|
|
import com.liferay.portal.model.LayoutSetPrototype; |
|
|
|
|
import com.liferay.portal.model.Organization; |
|
|
|
|
import com.liferay.portal.model.PasswordPolicy; |
|
|
|
|
import com.liferay.portal.model.ResourceConstants; |
|
|
|
|
import com.liferay.portal.model.ResourcePermission; |
|
|
|
|
import com.liferay.portal.model.Role; |
|
|
|
|
import com.liferay.portal.model.RoleConstants; |
|
|
|
|
import com.liferay.portal.model.SystemEvent; |
|
|
|
|
import com.liferay.portal.model.User; |
|
|
|
|
import com.liferay.portal.model.UserPersonalSite; |
|
|
|
@ -81,17 +99,24 @@ import com.liferay.portal.service.LayoutLocalServiceUtil;
|
|
|
|
|
import com.liferay.portal.service.LayoutPrototypeLocalServiceUtil; |
|
|
|
|
import com.liferay.portal.service.LayoutSetPrototypeLocalServiceUtil; |
|
|
|
|
import com.liferay.portal.service.OrganizationLocalServiceUtil; |
|
|
|
|
import com.liferay.portal.service.PasswordPolicyLocalServiceUtil; |
|
|
|
|
import com.liferay.portal.service.ResourcePermissionLocalServiceUtil; |
|
|
|
|
import com.liferay.portal.service.RoleLocalServiceUtil; |
|
|
|
|
import com.liferay.portal.service.ServiceContext; |
|
|
|
|
import com.liferay.portal.service.SystemEventLocalServiceUtil; |
|
|
|
|
import com.liferay.portal.service.UserLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.asset.model.AssetEntry; |
|
|
|
|
import com.liferay.portlet.asset.model.AssetTag; |
|
|
|
|
import com.liferay.portlet.asset.model.AssetVocabulary; |
|
|
|
|
import com.liferay.portlet.asset.service.AssetEntryLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.asset.service.AssetTagLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.asset.service.AssetVocabularyLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.documentlibrary.model.DLFileEntry; |
|
|
|
|
import com.liferay.portlet.documentlibrary.model.DLFileEntryType; |
|
|
|
|
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.DLAppServiceUtil; |
|
|
|
|
import com.liferay.portlet.documentlibrary.service.DLFileEntryTypeLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; |
|
|
|
@ -101,8 +126,10 @@ import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUti
|
|
|
|
|
import com.liferay.portlet.expando.model.ExpandoColumn; |
|
|
|
|
import com.liferay.portlet.expando.service.ExpandoColumnLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.journal.model.JournalArticle; |
|
|
|
|
import com.liferay.portlet.journal.model.JournalArticleResource; |
|
|
|
|
import com.liferay.portlet.journal.model.JournalFolder; |
|
|
|
|
import com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.journal.service.JournalArticleResourceLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.journal.service.JournalFolderLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.messageboards.model.MBDiscussion; |
|
|
|
|
import com.liferay.portlet.messageboards.model.MBMessage; |
|
|
|
@ -110,8 +137,12 @@ import com.liferay.portlet.messageboards.model.MBThread;
|
|
|
|
|
import com.liferay.portlet.messageboards.service.MBDiscussionLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.messageboards.service.MBThreadLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.ratings.model.RatingsStats; |
|
|
|
|
import com.liferay.portlet.ratings.service.RatingsStatsLocalServiceUtil; |
|
|
|
|
import com.liferay.portlet.wiki.model.WikiNode; |
|
|
|
|
import com.liferay.portlet.wiki.service.WikiNodeLocalServiceUtil; |
|
|
|
|
import com.liferay.sync.model.SyncDLObject; |
|
|
|
|
import com.liferay.sync.service.SyncDLObjectLocalServiceUtil; |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
* |
|
|
|
@ -127,20 +158,51 @@ import com.liferay.portlet.wiki.service.WikiNodeLocalServiceUtil;
|
|
|
|
|
* DELETE FROM "users_groups" WHERE "userid" IN (SELECT DISTINCT "ug"."userid" FROM "users_groups" "ug" LEFT JOIN "user_" "u" ON "ug"."userid"="u"."userid" WHERE "u"."userid" IS NULL); |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public class SvuotaDatabase { |
|
|
|
|
private static final Log _log = LogFactoryUtil.getLog(SvuotaDatabase.class); |
|
|
|
|
public class ManutenzioneDatabase { |
|
|
|
|
private static final Log _log = LogFactoryUtil.getLog(ManutenzioneDatabase.class); |
|
|
|
|
private static final int SLICE = 1000; |
|
|
|
|
|
|
|
|
|
public static List<String> pulisci(ServiceContext serviceContext) throws SystemException, PortalException { |
|
|
|
|
// !Run!IntPratica!User!Reset!
|
|
|
|
|
// 115202,115301,115502,115701,115702,115703,115704,115705,115801,115802,116001,116202,117214,126312,126313,133162,136606,139218,139453,139454
|
|
|
|
|
public static List<String> pulisci(ServiceContext serviceContext, String mode) throws SystemException, |
|
|
|
|
PortalException { |
|
|
|
|
List<String> esito = new ArrayList<>(); |
|
|
|
|
if (Validator.isNotNull(esito)) { |
|
|
|
|
esito.add("Operazione non consentita"); |
|
|
|
|
return esito; |
|
|
|
|
long companyId = serviceContext.getCompanyId(); |
|
|
|
|
if (mode.contains("!Pulisci!")) { |
|
|
|
|
esito.addAll(puliziaDocumentLibrary(companyId)); |
|
|
|
|
esitoLog( |
|
|
|
|
esito, |
|
|
|
|
puliziaAllegati(companyId, ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, |
|
|
|
|
ConfigurazioneConstants.ATTACHMENT_FOLDER_ID))); |
|
|
|
|
esitoLog( |
|
|
|
|
esito, |
|
|
|
|
puliziaAllegati(companyId, ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, |
|
|
|
|
AvvisoUtil.getAllTipoDocumentoFolderProps().get(StatoPraticaConstants.CONFORME)))); |
|
|
|
|
if (mode.contains("!IntPratica!")) { |
|
|
|
|
esitoLog(esito, svuotaIntPraticaDettPratica()); |
|
|
|
|
} |
|
|
|
|
if (mode.contains("!User!")) { |
|
|
|
|
esitoLog(esito, svuotaUser(companyId)); |
|
|
|
|
} |
|
|
|
|
esito.addAll(svuotaDatabase(companyId)); |
|
|
|
|
if (mode.contains("!Reset!")) { |
|
|
|
|
ConfigurazioneLocalServiceUtil.storeConfig(Constants.NUMERO_PROGETTO_KEY_DB, "1", |
|
|
|
|
serviceContext); |
|
|
|
|
} |
|
|
|
|
clearCache(); |
|
|
|
|
_log.info("Elaborazione completata correttamente."); |
|
|
|
|
} |
|
|
|
|
if (mode.contains("!Integrazioni!")) { |
|
|
|
|
SismicaUtil.integrazioniScadute(); |
|
|
|
|
} |
|
|
|
|
esito.addAll(puliziaDocumentLibrary()); |
|
|
|
|
esito.addAll(svuotaDatabase(serviceContext)); |
|
|
|
|
ConfigurazioneLocalServiceUtil.storeConfig(Constants.NUMERO_PROGETTO_KEY_DB, "1", serviceContext); |
|
|
|
|
if (mode.startsWith("!Workflow!")) { |
|
|
|
|
String[] pezzi = StringUtil.split(mode, '!'); |
|
|
|
|
esito.addAll(SismicaUtil.aggiungiWorkflow(pezzi[2], pezzi[3])); |
|
|
|
|
} |
|
|
|
|
return esito; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void clearCache() { |
|
|
|
|
try { |
|
|
|
|
SingleVMPoolUtil.clear(); |
|
|
|
|
MultiVMPoolUtil.clear(); |
|
|
|
@ -148,42 +210,49 @@ public class SvuotaDatabase {
|
|
|
|
|
DirectServletRegistryUtil.clearServlets(); |
|
|
|
|
} catch (IllegalStateException e) { |
|
|
|
|
} |
|
|
|
|
return esito; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static List<String> svuotaDatabase(ServiceContext serviceContext) throws SystemException, |
|
|
|
|
PortalException { |
|
|
|
|
private static List<String> svuotaDatabase(long companyId) throws SystemException, PortalException { |
|
|
|
|
List<String> esito = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
esitoLog(esito, svuotaDettPratica()); |
|
|
|
|
|
|
|
|
|
esitoLog(esito, svuotaAllegatoManuale()); |
|
|
|
|
esitoLog(esito, svuotaAssetEntry(companyId)); |
|
|
|
|
esitoLog(esito, svuotaAsseverazione()); |
|
|
|
|
esitoLog(esito, svuotaAvviso()); |
|
|
|
|
esitoLog(esito, svuotaAvviso(companyId)); |
|
|
|
|
esitoLog(esito, svuotaCollaudo()); |
|
|
|
|
esitoLog(esito, svuotaContact()); |
|
|
|
|
esitoLog(esito, svuotaContact(companyId)); |
|
|
|
|
esitoLog(esito, svuotaControlloPratica()); |
|
|
|
|
esitoLog(esito, svuotaDelega()); |
|
|
|
|
esitoLog(esito, svuotaDocAggiuntiva()); |
|
|
|
|
esitoLog(esito, svuotaDocPratica()); |
|
|
|
|
esitoLog(esito, svuotaEmail()); |
|
|
|
|
esitoLog(esito, svuotaEmail(companyId)); |
|
|
|
|
esitoLog(esito, svuotaEmailAttachment()); |
|
|
|
|
esitoLog(esito, svuotaFineLavori()); |
|
|
|
|
esitoLog(esito, svuotaGroup()); |
|
|
|
|
esitoLog(esito, svuotaMBDiscussion()); |
|
|
|
|
esitoLog(esito, svuotaMBMessage()); |
|
|
|
|
esitoLog(esito, svuotaGroup(companyId)); |
|
|
|
|
esitoLog(esito, svuotaMBDiscussion(companyId)); |
|
|
|
|
esitoLog(esito, svuotaMBMessage(companyId)); |
|
|
|
|
esitoLog(esito, svuotaMBThread()); |
|
|
|
|
esitoLog(esito, svuotaPagamento()); |
|
|
|
|
esitoLog(esito, svuotaResourcePermission(serviceContext.getCompanyId())); |
|
|
|
|
esitoLog(esito, svuotaPagamento(companyId)); |
|
|
|
|
esitoLog(esito, svuotaParereGeologo()); |
|
|
|
|
esitoLog(esito, svuotaRatingsStats(companyId)); |
|
|
|
|
esitoLog(esito, svuotaResourcePermission(companyId)); |
|
|
|
|
esitoLog(esito, svuotaSoggetto()); |
|
|
|
|
esitoLog(esito, svuotaSystemEvent()); |
|
|
|
|
esitoLog(esito, svuotaStoricoSoggettoPratica()); |
|
|
|
|
esitoLog(esito, svuotaSyncDLObject()); |
|
|
|
|
esitoLog(esito, svuotaSystemEvent(companyId)); |
|
|
|
|
esitoLog(esito, svuotaTempistica()); |
|
|
|
|
return esito; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static List<String> puliziaDocumentLibrary() { |
|
|
|
|
private static List<String> puliziaDocumentLibrary(long companyId) { |
|
|
|
|
List<String> esito = new ArrayList<>(); |
|
|
|
|
Set<String> parentFolderNames = new HashSet<>(); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
long allegatiFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId, |
|
|
|
|
ConfigurazioneConstants.ATTACHMENT_FOLDER_ID); |
|
|
|
|
int cancellati = 0; |
|
|
|
|
int start = 0; |
|
|
|
|
int totali = 0; |
|
|
|
@ -195,20 +264,49 @@ public class SvuotaDatabase {
|
|
|
|
|
for (DLFolder folder : folders) { |
|
|
|
|
DLFolder parent = folder.getParentFolder(); |
|
|
|
|
if (Validator.isNotNull(parent)) { |
|
|
|
|
switch (parent.getName()) { |
|
|
|
|
case "Allegati": |
|
|
|
|
parentFolderNames.add(parent.getName()); |
|
|
|
|
if (parent.getFolderId() == allegatiFolderId) { |
|
|
|
|
long[] ids = StringUtil.split(folder.getName(), "_", 0L); |
|
|
|
|
if ((ids.length == 2) && (ids[0] == ids[1])) { |
|
|
|
|
try { |
|
|
|
|
DettPraticaLocalServiceUtil.getDettPratica(ids[0]); |
|
|
|
|
} catch (PortalException e) { |
|
|
|
|
if (!esiste(DETTPRATICA_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(DOCPRATICA_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(ALLEGATOMANUALE_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(ASSEVERAZIONE_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(AVVISO_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(COLLAUDO_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(CONTROLLOPRATICA_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(DELEGA_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(DOCAGGIUNTIVA_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(FINELAVORI_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(INTPRATICA_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(PAGAMENTO_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(PAREREGEOLOGO_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(SOGGETTO_CLASS_NAME, ids[0]) |
|
|
|
|
&& !esiste(SORTEGGIO_CLASS_NAME, ids[0])) { |
|
|
|
|
_log.info("Cancello la cartella " + folder.getName()); |
|
|
|
|
DLAppLocalServiceUtil.deleteFolder(folder.getFolderId()); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
DLAppLocalServiceUtil.deleteFolder(folder.getFolderId()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
_log.info("Mantengo la cartella " + folder.getName()); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} else if (parent.getName().equals(EmailConstants.DEFAULT_ATTACHMENTS_FOLDER_NAME)) { |
|
|
|
|
long emailId = 0; |
|
|
|
|
try { |
|
|
|
|
emailId = Long.parseLong(folder.getName()); |
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
} |
|
|
|
|
if (Validator.isNotNull(emailId) |
|
|
|
|
&& String.valueOf(emailId).equals(folder.getName()) |
|
|
|
|
&& !esiste(EMAIL_CLASS_NAME, emailId)) { |
|
|
|
|
_log.info("Cancello la cartella " + folder.getName()); |
|
|
|
|
DLAppLocalServiceUtil.deleteFolder(folder.getFolderId()); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
_log.info("Non allegato " + folder.getName() + " in " + parent.getName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -218,9 +316,84 @@ public class SvuotaDatabase {
|
|
|
|
|
} catch (PortalException | SystemException e) { |
|
|
|
|
esitoLog(esito, "Errore durante l'elaborazione. " + e.getMessage()); |
|
|
|
|
} |
|
|
|
|
for (String parentFolderName : parentFolderNames) { |
|
|
|
|
_log.info("Parent: " + parentFolderName); |
|
|
|
|
} |
|
|
|
|
return esito; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static List<Long> avvisiFileEntries() throws SystemException { |
|
|
|
|
List<Long> result = new ArrayList<>(); |
|
|
|
|
int start = 0; |
|
|
|
|
List<Avviso> avvisi = null; |
|
|
|
|
do { |
|
|
|
|
avvisi = AvvisoLocalServiceUtil.getAvvisos(start, start + SLICE); |
|
|
|
|
for (Avviso avviso : avvisi) { |
|
|
|
|
result.add(avviso.getFileEntryIdBase()); |
|
|
|
|
result.add(avviso.getFileEntryIdProtocollo()); |
|
|
|
|
result.add(avviso.getFileEntryIdInvio()); |
|
|
|
|
} |
|
|
|
|
start += SLICE; |
|
|
|
|
} while (avvisi.size() > 0); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String puliziaAllegati(long companyId, long folderId) throws SystemException, |
|
|
|
|
PortalException { |
|
|
|
|
List<Long> avvisiFileEntries = avvisiFileEntries(); |
|
|
|
|
long repositoryId = DLAppLocalServiceUtil.getFolder(folderId).getRepositoryId(); |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<FileEntry> fileEntries = null; |
|
|
|
|
do { |
|
|
|
|
int rimossi = 0; |
|
|
|
|
fileEntries = DLAppServiceUtil.getFileEntries(repositoryId, folderId, start, start + SLICE); |
|
|
|
|
for (FileEntry fileEntry : fileEntries) { |
|
|
|
|
String[] parti = StringUtil.split(fileEntry.getTitle(), '_'); |
|
|
|
|
String strId1 = parti[0]; |
|
|
|
|
String tipo = StringPool.BLANK; |
|
|
|
|
String strId2 = StringPool.BLANK; |
|
|
|
|
switch (parti.length) { |
|
|
|
|
case 3: |
|
|
|
|
tipo = parti[1]; |
|
|
|
|
strId2 = parti[2]; |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
tipo = parti[1] + StringPool.UNDERLINE + parti[2]; |
|
|
|
|
strId2 = parti[3]; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if ((strId1.length() == 10) && (strId2.length() > 0) && SismicaUtil.isLong(strId1) |
|
|
|
|
&& SismicaUtil.isLong(strId2)) { |
|
|
|
|
long id1 = Long.parseLong(strId1); |
|
|
|
|
switch (tipo) { |
|
|
|
|
case "AS": |
|
|
|
|
if (!esiste(DETTPRATICA_CLASS_NAME, id1)) { |
|
|
|
|
DLAppLocalServiceUtil.deleteFileEntry(fileEntry.getFileEntryId()); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case "CO_B": |
|
|
|
|
if (!avvisiFileEntries.contains(fileEntry.getFileEntryId())) { |
|
|
|
|
DLAppLocalServiceUtil.deleteFileEntry(fileEntry.getFileEntryId()); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
_log.info("Tipo sconosciuto " + tipo + " (" + fileEntry.getTitle() + ")"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
_log.info("Nome sconosciuto " + fileEntry.getTitle()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
start += SLICE - rimossi; |
|
|
|
|
} while (fileEntries.size() > 0); |
|
|
|
|
return "Cancellati " + cancellati + " File orfani"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaAllegatoManuale() throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
@ -243,6 +416,29 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " AllegatoManuale"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaAssetEntry(long companyId) throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<AssetEntry> assetEntries = null; |
|
|
|
|
do { |
|
|
|
|
int rimossi = 0; |
|
|
|
|
assetEntries = AssetEntryLocalServiceUtil.getAssetEntries(start, start + SLICE); |
|
|
|
|
for (AssetEntry assetEntry : assetEntries) { |
|
|
|
|
String className = assetEntry.getClassName(); |
|
|
|
|
if (className.equals(JOURNALARTICLE_CLASS_NAME)) { |
|
|
|
|
className = JOURNALARTICLERESOURCE_CLASS_NAME; |
|
|
|
|
} |
|
|
|
|
if (!esiste(className, assetEntry.getClassPK(), companyId)) { |
|
|
|
|
AssetEntryLocalServiceUtil.deleteAssetEntry(assetEntry); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
start += SLICE - rimossi; |
|
|
|
|
} while (assetEntries.size() > 0); |
|
|
|
|
return "Cancellati " + cancellati + " AssetEntry"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaAsseverazione() throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
@ -264,7 +460,7 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " Asseverazione"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaAvviso() throws SystemException { |
|
|
|
|
private static String svuotaAvviso(long companyId) throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<Avviso> avvisi = null; |
|
|
|
@ -272,7 +468,7 @@ public class SvuotaDatabase {
|
|
|
|
|
int rimossi = 0; |
|
|
|
|
avvisi = AvvisoLocalServiceUtil.getAvvisos(start, start + SLICE); |
|
|
|
|
for (Avviso avviso : avvisi) { |
|
|
|
|
if (!esiste(avviso.getClassName(), avviso.getClassPk()) |
|
|
|
|
if (!esiste(avviso.getClassName(), avviso.getClassPk(), companyId) |
|
|
|
|
|| !esiste(INTPRATICA_CLASS_NAME, avviso.getIntPraticaId())) { |
|
|
|
|
deleteFileEntry(avviso.getFileEntryIdBase()); |
|
|
|
|
deleteFileEntry(avviso.getFileEntryIdInvio()); |
|
|
|
@ -306,6 +502,25 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " Collaudo"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaContact(long companyId) throws SystemException, PortalException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<Contact> contacts = null; |
|
|
|
|
do { |
|
|
|
|
int rimossi = 0; |
|
|
|
|
contacts = ContactLocalServiceUtil.getContacts(start, start + SLICE); |
|
|
|
|
for (Contact contact : contacts) { |
|
|
|
|
if (!esiste(contact.getClassName(), contact.getClassPK(), companyId)) { |
|
|
|
|
ContactLocalServiceUtil.deleteContact(contact); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
start += SLICE - rimossi; |
|
|
|
|
} while (contacts.size() > 0); |
|
|
|
|
return "Cancellati " + cancellati + " Contact"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaControlloPratica() throws SystemException, PortalException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
@ -346,25 +561,6 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " Delega"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaContact() throws SystemException, PortalException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<Contact> contacts = null; |
|
|
|
|
do { |
|
|
|
|
int rimossi = 0; |
|
|
|
|
contacts = ContactLocalServiceUtil.getContacts(start, start + SLICE); |
|
|
|
|
for (Contact contact : contacts) { |
|
|
|
|
if (!esiste(contact.getClassName(), contact.getClassPK())) { |
|
|
|
|
ContactLocalServiceUtil.deleteContact(contact); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
start += SLICE - rimossi; |
|
|
|
|
} while (contacts.size() > 0); |
|
|
|
|
return "Cancellati " + cancellati + " Contact"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaDettPratica() throws SystemException, PortalException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
@ -425,7 +621,7 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " DocPratica"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaEmail() throws SystemException, PortalException { |
|
|
|
|
private static String svuotaEmail(long companyId) throws SystemException, PortalException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<Email> emails = null; |
|
|
|
@ -433,7 +629,7 @@ public class SvuotaDatabase {
|
|
|
|
|
int rimossi = 0; |
|
|
|
|
emails = EmailLocalServiceUtil.getEmails(start, start + SLICE); |
|
|
|
|
for (Email email : emails) { |
|
|
|
|
if (!esiste(email.getClassName(), email.getClassPK())) { |
|
|
|
|
if (!esiste(email.getClassName(), email.getClassPK(), companyId)) { |
|
|
|
|
EmailLocalServiceUtil.deleteEmail(email); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
@ -483,7 +679,22 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " FineLavori"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaGroup() throws SystemException, PortalException { |
|
|
|
|
// Troncare le tabelle è l'unico modo possibile
|
|
|
|
|
private static String svuotaIntPraticaDettPratica() { |
|
|
|
|
int i = 0; |
|
|
|
|
int d = 0; |
|
|
|
|
try { |
|
|
|
|
Connection connection = DataAccess.getUpgradeOptimizedConnection(); |
|
|
|
|
Statement s = connection.createStatement(); |
|
|
|
|
i = s.executeUpdate("DELETE FROM portos_bo_intpratica"); |
|
|
|
|
d = s.executeUpdate("DELETE FROM portos_bo_dettpratica"); |
|
|
|
|
} catch (SQLException e) { |
|
|
|
|
} |
|
|
|
|
clearCache(); |
|
|
|
|
return "Cancellati " + i + " IntPratica, " + d + " DettPratica"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaGroup(long companyId) throws SystemException, PortalException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<Group> groups = null; |
|
|
|
@ -491,7 +702,7 @@ public class SvuotaDatabase {
|
|
|
|
|
int rimossi = 0; |
|
|
|
|
groups = GroupLocalServiceUtil.getGroups(start, start + SLICE); |
|
|
|
|
for (Group group : groups) { |
|
|
|
|
if (!esiste(group.getClassName(), group.getClassPK())) { |
|
|
|
|
if (!esiste(group.getClassName(), group.getClassPK(), companyId)) { |
|
|
|
|
GroupLocalServiceUtil.deleteGroup(group); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
@ -502,7 +713,7 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " Group"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaMBDiscussion() throws SystemException { |
|
|
|
|
private static String svuotaMBDiscussion(long companyId) throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<MBDiscussion> mbDiscussions = null; |
|
|
|
@ -510,8 +721,9 @@ public class SvuotaDatabase {
|
|
|
|
|
int rimossi = 0; |
|
|
|
|
mbDiscussions = MBDiscussionLocalServiceUtil.getMBDiscussions(start, start + SLICE); |
|
|
|
|
for (MBDiscussion mbDiscussion : mbDiscussions) { |
|
|
|
|
if (!esiste(mbDiscussion.getClassName(), mbDiscussion.getClassPK()) |
|
|
|
|
|| !esiste(MBTHREAD_CLASS_NAME, mbDiscussion.getThreadId())) { |
|
|
|
|
if (!esiste(mbDiscussion.getClassName(), mbDiscussion.getClassPK(), companyId) |
|
|
|
|
|| !esiste(MBTHREAD_CLASS_NAME, mbDiscussion.getThreadId()) |
|
|
|
|
|| !esiste(GROUP_CLASS_NAME, mbDiscussion.getGroupId())) { |
|
|
|
|
MBDiscussionLocalServiceUtil.deleteMBDiscussion(mbDiscussion); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
@ -522,7 +734,7 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " MBDiscussion"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaMBMessage() throws SystemException { |
|
|
|
|
private static String svuotaMBMessage(long companyId) throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<MBMessage> mbMessages = null; |
|
|
|
@ -530,8 +742,9 @@ public class SvuotaDatabase {
|
|
|
|
|
int rimossi = 0; |
|
|
|
|
mbMessages = MBMessageLocalServiceUtil.getMBMessages(start, start + SLICE); |
|
|
|
|
for (MBMessage mbMessage : mbMessages) { |
|
|
|
|
if (!esiste(mbMessage.getClassName(), mbMessage.getClassPK()) |
|
|
|
|
|| !esiste(MBTHREAD_CLASS_NAME, mbMessage.getThreadId())) { |
|
|
|
|
if (!esiste(mbMessage.getClassName(), mbMessage.getClassPK(), companyId) |
|
|
|
|
|| !esiste(MBTHREAD_CLASS_NAME, mbMessage.getThreadId()) |
|
|
|
|
|| !esiste(GROUP_CLASS_NAME, mbMessage.getGroupId())) { |
|
|
|
|
MBMessageLocalServiceUtil.deleteMBMessage(mbMessage); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
@ -550,7 +763,8 @@ public class SvuotaDatabase {
|
|
|
|
|
int rimossi = 0; |
|
|
|
|
mbThreads = MBThreadLocalServiceUtil.getMBThreads(start, start + SLICE); |
|
|
|
|
for (MBThread mbThread : mbThreads) { |
|
|
|
|
if (!esiste(MBMESSAGE_CLASS_NAME, mbThread.getRootMessageId())) { |
|
|
|
|
if (!esiste(MBMESSAGE_CLASS_NAME, mbThread.getRootMessageId()) |
|
|
|
|
|| !esiste(GROUP_CLASS_NAME, mbThread.getGroupId())) { |
|
|
|
|
MBThreadLocalServiceUtil.deleteMBThread(mbThread); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
@ -561,7 +775,7 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " MBThread"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaPagamento() throws SystemException, PortalException { |
|
|
|
|
private static String svuotaPagamento(long companyId) throws SystemException, PortalException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<Pagamento> pagamenti = null; |
|
|
|
@ -569,7 +783,7 @@ public class SvuotaDatabase {
|
|
|
|
|
int rimossi = 0; |
|
|
|
|
pagamenti = PagamentoLocalServiceUtil.getPagamentos(start, start + SLICE); |
|
|
|
|
for (Pagamento pagamento : pagamenti) { |
|
|
|
|
if (!esiste(pagamento.getClassName(), pagamento.getClassPk()) |
|
|
|
|
if (!esiste(pagamento.getClassName(), pagamento.getClassPk(), companyId) |
|
|
|
|
|| !esiste(INTPRATICA_CLASS_NAME, pagamento.getIntPraticaId())) { |
|
|
|
|
deleteFileEntry(pagamento.getFileEntryId()); |
|
|
|
|
PagamentoLocalServiceUtil.deletePagamento(pagamento); |
|
|
|
@ -582,6 +796,46 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " Pagamento"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaParereGeologo() throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<ParereGeologo> pareriGeologo = null; |
|
|
|
|
do { |
|
|
|
|
int rimossi = 0; |
|
|
|
|
pareriGeologo = ParereGeologoLocalServiceUtil.getParereGeologos(start, start + SLICE); |
|
|
|
|
for (ParereGeologo parereGeologo : pareriGeologo) { |
|
|
|
|
if (!esiste(INTPRATICA_CLASS_NAME, parereGeologo.getIntPraticaId()) |
|
|
|
|
|| !esiste(DETTPRATICA_CLASS_NAME, parereGeologo.getDettPraticaId())) { |
|
|
|
|
deleteFileEntry(parereGeologo.getFileEntryId()); |
|
|
|
|
ParereGeologoLocalServiceUtil.deleteParereGeologo(parereGeologo); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
start += SLICE - rimossi; |
|
|
|
|
} while (pareriGeologo.size() > 0); |
|
|
|
|
return "Cancellati " + cancellati + " ParereGeologo"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaRatingsStats(long companyId) throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<RatingsStats> ratingsStatses = null; |
|
|
|
|
do { |
|
|
|
|
int rimossi = 0; |
|
|
|
|
ratingsStatses = RatingsStatsLocalServiceUtil.getRatingsStatses(start, start + SLICE); |
|
|
|
|
for (RatingsStats ratingsStats : ratingsStatses) { |
|
|
|
|
if (!esiste(ratingsStats.getClassName(), ratingsStats.getClassPK(), companyId)) { |
|
|
|
|
RatingsStatsLocalServiceUtil.deleteRatingsStats(ratingsStats); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
start += SLICE - rimossi; |
|
|
|
|
} while (ratingsStatses.size() > 0); |
|
|
|
|
return "Cancellati " + cancellati + " RatingsStats"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaResourcePermission(long companyId) throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
@ -647,7 +901,28 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " Soggetto, " + docPraticaCancellati + " DocPratica"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaSystemEvent() throws SystemException { |
|
|
|
|
private static String svuotaStoricoSoggettoPratica() throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<StoricoSoggettoPratica> storicoSoggettiPratiche = null; |
|
|
|
|
do { |
|
|
|
|
int rimossi = 0; |
|
|
|
|
storicoSoggettiPratiche = StoricoSoggettoPraticaLocalServiceUtil.getStoricoSoggettoPraticas( |
|
|
|
|
start, start + SLICE); |
|
|
|
|
for (StoricoSoggettoPratica storicoSoggettoPratica : storicoSoggettiPratiche) { |
|
|
|
|
if (!esiste(INTPRATICA_CLASS_NAME, storicoSoggettoPratica.getIntPraticaId())) { |
|
|
|
|
StoricoSoggettoPraticaLocalServiceUtil |
|
|
|
|
.deleteStoricoSoggettoPratica(storicoSoggettoPratica); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
start += SLICE - rimossi; |
|
|
|
|
} while (storicoSoggettiPratiche.size() > 0); |
|
|
|
|
return "Cancellati " + cancellati + " StoricoSoggettoPratica"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaSystemEvent(long companyId) throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<SystemEvent> systemEvents = null; |
|
|
|
@ -655,7 +930,7 @@ public class SvuotaDatabase {
|
|
|
|
|
int rimossi = 0; |
|
|
|
|
systemEvents = SystemEventLocalServiceUtil.getSystemEvents(start, start + SLICE); |
|
|
|
|
for (SystemEvent systemEvent : systemEvents) { |
|
|
|
|
if (!esiste(systemEvent.getClassName(), systemEvent.getClassPK())) { |
|
|
|
|
if (!esiste(systemEvent.getClassName(), systemEvent.getClassPK(), companyId)) { |
|
|
|
|
SystemEventLocalServiceUtil.deleteSystemEvent(systemEvent); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
@ -666,6 +941,34 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " SystemEvent"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaSyncDLObject() throws SystemException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<SyncDLObject> syncDLObjects = null; |
|
|
|
|
do { |
|
|
|
|
int rimossi = 0; |
|
|
|
|
syncDLObjects = SyncDLObjectLocalServiceUtil.getSyncDLObjects(start, start + SLICE); |
|
|
|
|
for (SyncDLObject syncDLObject : syncDLObjects) { |
|
|
|
|
String className = null; |
|
|
|
|
switch (syncDLObject.getType()) { |
|
|
|
|
case DLSyncConstants.TYPE_FILE: |
|
|
|
|
className = DLFILEENTRY_CLASS_NAME; |
|
|
|
|
break; |
|
|
|
|
case DLSyncConstants.TYPE_FOLDER: |
|
|
|
|
className = DLFOLDER_CLASS_NAME; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (!esiste(className, syncDLObject.getTypePK())) { |
|
|
|
|
SyncDLObjectLocalServiceUtil.deleteSyncDLObject(syncDLObject); |
|
|
|
|
cancellati++; |
|
|
|
|
rimossi++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
start += SLICE - rimossi; |
|
|
|
|
} while (syncDLObjects.size() > 0); |
|
|
|
|
return "Cancellati " + cancellati + " SyncDLObject"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaTempistica() throws SystemException, PortalException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
@ -686,108 +989,143 @@ public class SvuotaDatabase {
|
|
|
|
|
return "Cancellati " + cancellati + " Tempistica"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String svuotaUser(long companyId) throws SystemException, PortalException { |
|
|
|
|
int start = 0; |
|
|
|
|
int cancellati = 0; |
|
|
|
|
List<User> users = null; |
|
|
|
|
Role adminRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR); |
|
|
|
|
do { |
|
|
|
|
int rimossi = 0; |
|
|
|
|
users = UserLocalServiceUtil.getUsers(start, start + SLICE); |
|
|
|
|
for (User user : users) { |
|
|
|
|
if (user.getRoles().contains(adminRole)) { |
|
|
|
|
_log.info("Non cancello utente " + user.getFullName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
start += SLICE - rimossi; |
|
|
|
|
} while (users.size() > 0); |
|
|
|
|
return "Cancellati " + cancellati + " User"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static boolean esiste(String className, long classPK) throws SystemException { |
|
|
|
|
return esiste(className, classPK, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static boolean esiste(String className, long classPK, long companyId) throws SystemException { |
|
|
|
|
try { |
|
|
|
|
if (ASSETVOCABULARY_CLASS_NAME.equals(className)) { |
|
|
|
|
AssetVocabularyLocalServiceUtil.getAssetVocabulary(classPK); |
|
|
|
|
} else if (ASSEVERAZIONE_CLASS_NAME.equals(className)) { |
|
|
|
|
AsseverazioneLocalServiceUtil.getAsseverazione(classPK); |
|
|
|
|
} else if (AVVISO_CLASS_NAME.equals(className)) { |
|
|
|
|
AvvisoLocalServiceUtil.getAvviso(classPK); |
|
|
|
|
} else if (COLLAUDO_CLASS_NAME.equals(className)) { |
|
|
|
|
CollaudoLocalServiceUtil.getCollaudo(classPK); |
|
|
|
|
} else if (COMPANY_CLASS_NAME.equals(className)) { |
|
|
|
|
CompanyLocalServiceUtil.getCompany(classPK); |
|
|
|
|
} else if (CONTROLLOPRATICA_CLASS_NAME.equals(className)) { |
|
|
|
|
ControlloPraticaLocalServiceUtil.getControlloPratica(classPK); |
|
|
|
|
} else if (DDMSTRUCTURE_CLASS_NAME.equals(className)) { |
|
|
|
|
DDMStructureLocalServiceUtil.getDDMStructure(classPK); |
|
|
|
|
} else if (DDMTEMPLATE_CLASS_NAME.equals(className)) { |
|
|
|
|
DDMTemplateLocalServiceUtil.getDDMTemplate(classPK); |
|
|
|
|
} else if (DELEGA_CLASS_NAME.equals(className)) { |
|
|
|
|
DelegaLocalServiceUtil.getDelega(classPK); |
|
|
|
|
} else if (DETTPRATICA_CLASS_NAME.equals(className)) { |
|
|
|
|
DettPraticaLocalServiceUtil.getDettPratica(classPK); |
|
|
|
|
} else if (DLFILEENTRY_CLASS_NAME.equals(className)) { |
|
|
|
|
DLAppLocalServiceUtil.getFileEntry(classPK); |
|
|
|
|
} else if (DLFILEENTRYTYPE_CLASS_NAME.equals(className)) { |
|
|
|
|
DLFileEntryTypeLocalServiceUtil.getDLFileEntryType(classPK); |
|
|
|
|
} else if (DLFOLDER_CLASS_NAME.equals(className)) { |
|
|
|
|
DLAppLocalServiceUtil.getFolder(classPK); |
|
|
|
|
} else if (EMAIL_CLASS_NAME.equals(className)) { |
|
|
|
|
EmailLocalServiceUtil.getEmail(classPK); |
|
|
|
|
} else if (EMAILADDRESS_CLASS_NAME.equals(className)) { |
|
|
|
|
EmailAddressLocalServiceUtil.getEmailAddress(classPK); |
|
|
|
|
} else if (EMAILTEMPLATE_CLASS_NAME.equals(className)) { |
|
|
|
|
EmailTemplateLocalServiceUtil.getEmailTemplate(classPK); |
|
|
|
|
} else if (EXPANDOCOLUMN_CLASS_NAME.equals(className)) { |
|
|
|
|
ExpandoColumnLocalServiceUtil.getExpandoColumn(classPK); |
|
|
|
|
} else if (FINELAVORI_CLASS_NAME.equals(className)) { |
|
|
|
|
FineLavoriLocalServiceUtil.getFineLavori(classPK); |
|
|
|
|
} else if (GROUP_CLASS_NAME.equals(className)) { |
|
|
|
|
GroupLocalServiceUtil.getGroup(classPK); |
|
|
|
|
} else if (INTPRATICA_CLASS_NAME.equals(className)) { |
|
|
|
|
IntPraticaLocalServiceUtil.getIntPratica(classPK); |
|
|
|
|
} else if (JOURNALARTICLE_CLASS_NAME.equals(className)) { |
|
|
|
|
JournalArticleLocalServiceUtil.getArticle(classPK); |
|
|
|
|
} else if (JOURNALFOLDER_CLASS_NAME.equals(className)) { |
|
|
|
|
JournalFolderLocalServiceUtil.getJournalFolder(classPK); |
|
|
|
|
} else if (LAYOUT_CLASS_NAME.equals(className)) { |
|
|
|
|
LayoutLocalServiceUtil.getLayout(classPK); |
|
|
|
|
} else if (LAYOUTPROTOTYPE_CLASS_NAME.equals(className)) { |
|
|
|
|
LayoutPrototypeLocalServiceUtil.getLayoutPrototype(classPK); |
|
|
|
|
} else if (LAYOUTSETPROTOTYPE_CLASS_NAME.equals(className)) { |
|
|
|
|
LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(classPK); |
|
|
|
|
} else if (MBMESSAGE_CLASS_NAME.equals(className)) { |
|
|
|
|
MBMessageLocalServiceUtil.getMBMessage(classPK); |
|
|
|
|
} else if (MBTHREAD_CLASS_NAME.equals(className)) { |
|
|
|
|
MBThreadLocalServiceUtil.getMBThread(classPK); |
|
|
|
|
} else if (ORGANIZATION_CLASS_NAME.equals(className)) { |
|
|
|
|
OrganizationLocalServiceUtil.getOrganization(classPK); |
|
|
|
|
} else if (PAREREGEOLOGO_CLASS_NAME.equals(className)) { |
|
|
|
|
ParereGeologoLocalServiceUtil.getParereGeologo(classPK); |
|
|
|
|
} else if (ROLE_CLASS_NAME.equals(className)) { |
|
|
|
|
RoleLocalServiceUtil.getRole(classPK); |
|
|
|
|
} else if (SOGGETTO_CLASS_NAME.equals(className)) { |
|
|
|
|
SoggettoLocalServiceUtil.getSoggetto(classPK); |
|
|
|
|
} else if (USER_CLASS_NAME.equals(className)) { |
|
|
|
|
UserLocalServiceUtil.getUser(classPK); |
|
|
|
|
} else if (USERPERSONALSITE_CLASS_NAME.equals(className)) { |
|
|
|
|
// Nop
|
|
|
|
|
} else if (WIKINODE_CLASS_NAME.equals(className)) { |
|
|
|
|
WikiNodeLocalServiceUtil.getWikiNode(classPK); |
|
|
|
|
} else if (WORKFLOWINSTANCE_CLASS_NAME.equals(className)) { |
|
|
|
|
if (Validator.isNotNull(companyId)) { |
|
|
|
|
WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, classPK); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (className.contains(".")) { |
|
|
|
|
switch (className) { |
|
|
|
|
case "com.liferay.portlet.asset": |
|
|
|
|
case "com.liferay.portlet.blogs": |
|
|
|
|
case "com.liferay.portlet.bookmarks": |
|
|
|
|
case "com.liferay.portlet.documentlibrary": |
|
|
|
|
case "com.liferay.portlet.journal": |
|
|
|
|
case "com.liferay.portlet.messageboards": |
|
|
|
|
case "com.liferay.portlet.polls": |
|
|
|
|
case "com.liferay.portlet.wiki": |
|
|
|
|
case "it.tref.liferay.portos.bo.controlloPratica": |
|
|
|
|
case "it.tref.liferay.portos.bo.dettpratica": |
|
|
|
|
case "it.tref.liferay.portos.bo.intpratiche": |
|
|
|
|
case "it.tref.liferay.portos.bo.pending_pagamenti": |
|
|
|
|
case "it.tref.liferay.portos.mailmanager.email": |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
_log.info("Classe non supportata: " + className); |
|
|
|
|
if (0 != classPK && Validator.isNotNull(className)) { |
|
|
|
|
try { |
|
|
|
|
if (ALLEGATOMANUALE_CLASS_NAME.equals(className)) { |
|
|
|
|
AllegatoManualeLocalServiceUtil.getAllegatoManuale(classPK); |
|
|
|
|
} else if (ASSETTAG_CLASS_NAME.equals(className)) { |
|
|
|
|
AssetTagLocalServiceUtil.getAssetTag(classPK); |
|
|
|
|
} else if (ASSETVOCABULARY_CLASS_NAME.equals(className)) { |
|
|
|
|
AssetVocabularyLocalServiceUtil.getAssetVocabulary(classPK); |
|
|
|
|
} else if (ASSEVERAZIONE_CLASS_NAME.equals(className)) { |
|
|
|
|
AsseverazioneLocalServiceUtil.getAsseverazione(classPK); |
|
|
|
|
} else if (AVVISO_CLASS_NAME.equals(className)) { |
|
|
|
|
AvvisoLocalServiceUtil.getAvviso(classPK); |
|
|
|
|
} else if (COLLAUDO_CLASS_NAME.equals(className)) { |
|
|
|
|
CollaudoLocalServiceUtil.getCollaudo(classPK); |
|
|
|
|
} else if (COMPANY_CLASS_NAME.equals(className)) { |
|
|
|
|
CompanyLocalServiceUtil.getCompany(classPK); |
|
|
|
|
} else if (CONTROLLOPRATICA_CLASS_NAME.equals(className)) { |
|
|
|
|
ControlloPraticaLocalServiceUtil.getControlloPratica(classPK); |
|
|
|
|
} else if (DOCAGGIUNTIVA_CLASS_NAME.equals(className)) { |
|
|
|
|
DocAggiuntivaLocalServiceUtil.getDocAggiuntiva(classPK); |
|
|
|
|
} else if (DOCPRATICA_CLASS_NAME.equals(className)) { |
|
|
|
|
DocPraticaLocalServiceUtil.getDocPratica(classPK); |
|
|
|
|
} else if (DDMSTRUCTURE_CLASS_NAME.equals(className)) { |
|
|
|
|
DDMStructureLocalServiceUtil.getDDMStructure(classPK); |
|
|
|
|
} else if (DDMTEMPLATE_CLASS_NAME.equals(className)) { |
|
|
|
|
DDMTemplateLocalServiceUtil.getDDMTemplate(classPK); |
|
|
|
|
} else if (DELEGA_CLASS_NAME.equals(className)) { |
|
|
|
|
DelegaLocalServiceUtil.getDelega(classPK); |
|
|
|
|
} else if (DETTPRATICA_CLASS_NAME.equals(className)) { |
|
|
|
|
DettPraticaLocalServiceUtil.getDettPratica(classPK); |
|
|
|
|
} else if (DLFILEENTRY_CLASS_NAME.equals(className)) { |
|
|
|
|
DLAppLocalServiceUtil.getFileEntry(classPK); |
|
|
|
|
} else if (DLFILEENTRYTYPE_CLASS_NAME.equals(className)) { |
|
|
|
|
DLFileEntryTypeLocalServiceUtil.getDLFileEntryType(classPK); |
|
|
|
|
} else if (DLFOLDER_CLASS_NAME.equals(className)) { |
|
|
|
|
DLAppLocalServiceUtil.getFolder(classPK); |
|
|
|
|
} else if (EMAIL_CLASS_NAME.equals(className)) { |
|
|
|
|
EmailLocalServiceUtil.getEmail(classPK); |
|
|
|
|
} else if (EMAILADDRESS_CLASS_NAME.equals(className)) { |
|
|
|
|
EmailAddressLocalServiceUtil.getEmailAddress(classPK); |
|
|
|
|
} else if (EMAILTEMPLATE_CLASS_NAME.equals(className)) { |
|
|
|
|
EmailTemplateLocalServiceUtil.getEmailTemplate(classPK); |
|
|
|
|
} else if (EXPANDOCOLUMN_CLASS_NAME.equals(className)) { |
|
|
|
|
ExpandoColumnLocalServiceUtil.getExpandoColumn(classPK); |
|
|
|
|
} else if (FINELAVORI_CLASS_NAME.equals(className)) { |
|
|
|
|
FineLavoriLocalServiceUtil.getFineLavori(classPK); |
|
|
|
|
} else if (GROUP_CLASS_NAME.equals(className)) { |
|
|
|
|
GroupLocalServiceUtil.getGroup(classPK); |
|
|
|
|
} else if (INTPRATICA_CLASS_NAME.equals(className)) { |
|
|
|
|
IntPraticaLocalServiceUtil.getIntPratica(classPK); |
|
|
|
|
} else if (JOURNALARTICLE_CLASS_NAME.equals(className)) { |
|
|
|
|
JournalArticleLocalServiceUtil.getArticle(classPK); |
|
|
|
|
} else if (JOURNALARTICLERESOURCE_CLASS_NAME.equals(className)) { |
|
|
|
|
JournalArticleResourceLocalServiceUtil.getJournalArticleResource(classPK); |
|
|
|
|
} else if (JOURNALFOLDER_CLASS_NAME.equals(className)) { |
|
|
|
|
JournalFolderLocalServiceUtil.getJournalFolder(classPK); |
|
|
|
|
} else if (LAYOUT_CLASS_NAME.equals(className)) { |
|
|
|
|
LayoutLocalServiceUtil.getLayout(classPK); |
|
|
|
|
} else if (LAYOUTPROTOTYPE_CLASS_NAME.equals(className)) { |
|
|
|
|
LayoutPrototypeLocalServiceUtil.getLayoutPrototype(classPK); |
|
|
|
|
} else if (LAYOUTSETPROTOTYPE_CLASS_NAME.equals(className)) { |
|
|
|
|
LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(classPK); |
|
|
|
|
} else if (MBDISCUSSION_CLASS_NAME.equals(className)) { |
|
|
|
|
MBDiscussionLocalServiceUtil.getMBDiscussion(classPK); |
|
|
|
|
} else if (MBMESSAGE_CLASS_NAME.equals(className)) { |
|
|
|
|
MBMessageLocalServiceUtil.getMBMessage(classPK); |
|
|
|
|
} else if (MBTHREAD_CLASS_NAME.equals(className)) { |
|
|
|
|
MBThreadLocalServiceUtil.getMBThread(classPK); |
|
|
|
|
} else if (ORGANIZATION_CLASS_NAME.equals(className)) { |
|
|
|
|
OrganizationLocalServiceUtil.getOrganization(classPK); |
|
|
|
|
} else if (PAGAMENTO_CLASS_NAME.equals(className)) { |
|
|
|
|
PagamentoLocalServiceUtil.getPagamento(classPK); |
|
|
|
|
} else if (PAREREGEOLOGO_CLASS_NAME.equals(className)) { |
|
|
|
|
ParereGeologoLocalServiceUtil.getParereGeologo(classPK); |
|
|
|
|
} else if (PASSWORDPOLICY_CLASS_NAME.equals(className)) { |
|
|
|
|
PasswordPolicyLocalServiceUtil.getPasswordPolicy(classPK); |
|
|
|
|
} else if (ROLE_CLASS_NAME.equals(className)) { |
|
|
|
|
RoleLocalServiceUtil.getRole(classPK); |
|
|
|
|
} else if (SOGGETTO_CLASS_NAME.equals(className)) { |
|
|
|
|
SoggettoLocalServiceUtil.getSoggetto(classPK); |
|
|
|
|
} else if (SORTEGGIO_CLASS_NAME.equals(className)) { |
|
|
|
|
SorteggioLocalServiceUtil.getSorteggio(classPK); |
|
|
|
|
} else if (USER_CLASS_NAME.equals(className)) { |
|
|
|
|
UserLocalServiceUtil.getUser(classPK); |
|
|
|
|
} else if (USERPERSONALSITE_CLASS_NAME.equals(className)) { |
|
|
|
|
// Nop
|
|
|
|
|
} else if (WIKINODE_CLASS_NAME.equals(className)) { |
|
|
|
|
WikiNodeLocalServiceUtil.getWikiNode(classPK); |
|
|
|
|
} else if (WORKFLOWINSTANCE_CLASS_NAME.equals(className)) { |
|
|
|
|
if (Validator.isNull(companyId)) { |
|
|
|
|
_log.info("CompanyId = " + companyId); |
|
|
|
|
; |
|
|
|
|
} else { |
|
|
|
|
WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, classPK); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (className.contains(".")) { |
|
|
|
|
switch (className) { |
|
|
|
|
case "com.liferay.portlet.blogs": |
|
|
|
|
case "com.liferay.portlet.documentlibrary": |
|
|
|
|
case "com.liferay.portlet.journal": |
|
|
|
|
case "com.liferay.portlet.messageboards": |
|
|
|
|
case "com.liferay.portlet.polls": |
|
|
|
|
case "com.liferay.portlet.wiki": |
|
|
|
|
case "it.tref.liferay.portos.bo.intpratiche": |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
_log.info("Classe non supportata: " + className); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (PortalException e) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} catch (PortalException e) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -804,6 +1142,8 @@ public class SvuotaDatabase {
|
|
|
|
|
esito.add(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static final String ALLEGATOMANUALE_CLASS_NAME = AllegatoManuale.class.getName(); |
|
|
|
|
private static final String ASSETTAG_CLASS_NAME = AssetTag.class.getName(); |
|
|
|
|
private static final String ASSETVOCABULARY_CLASS_NAME = AssetVocabulary.class.getName(); |
|
|
|
|
private static final String ASSEVERAZIONE_CLASS_NAME = Asseverazione.class.getName(); |
|
|
|
|
private static final String AVVISO_CLASS_NAME = Avviso.class.getName(); |
|
|
|
@ -817,6 +1157,8 @@ public class SvuotaDatabase {
|
|
|
|
|
private static final String DLFILEENTRY_CLASS_NAME = DLFileEntry.class.getName(); |
|
|
|
|
private static final String DLFILEENTRYTYPE_CLASS_NAME = DLFileEntryType.class.getName(); |
|
|
|
|
private static final String DLFOLDER_CLASS_NAME = DLFolder.class.getName(); |
|
|
|
|
private static final String DOCAGGIUNTIVA_CLASS_NAME = DocAggiuntiva.class.getName(); |
|
|
|
|
private static final String DOCPRATICA_CLASS_NAME = DocPratica.class.getName(); |
|
|
|
|
private static final String EMAIL_CLASS_NAME = Email.class.getName(); |
|
|
|
|
private static final String EMAILADDRESS_CLASS_NAME = EmailAddress.class.getName(); |
|
|
|
|
private static final String EMAILTEMPLATE_CLASS_NAME = EmailTemplate.class.getName(); |
|
|
|
@ -825,6 +1167,7 @@ public class SvuotaDatabase {
|
|
|
|
|
private static final String GROUP_CLASS_NAME = Group.class.getName(); |
|
|
|
|
private static final String INTPRATICA_CLASS_NAME = IntPratica.class.getName(); |
|
|
|
|
private static final String JOURNALARTICLE_CLASS_NAME = JournalArticle.class.getName(); |
|
|
|
|
private static final String JOURNALARTICLERESOURCE_CLASS_NAME = JournalArticleResource.class.getName(); |
|
|
|
|
private static final String JOURNALFOLDER_CLASS_NAME = JournalFolder.class.getName(); |
|
|
|
|
private static final String LAYOUT_CLASS_NAME = Layout.class.getName(); |
|
|
|
|
private static final String LAYOUTPROTOTYPE_CLASS_NAME = LayoutPrototype.class.getName(); |
|
|
|
@ -833,9 +1176,12 @@ public class SvuotaDatabase {
|
|
|
|
|
private static final String MBMESSAGE_CLASS_NAME = MBMessage.class.getName(); |
|
|
|
|
private static final String MBTHREAD_CLASS_NAME = MBThread.class.getName(); |
|
|
|
|
private static final String ORGANIZATION_CLASS_NAME = Organization.class.getName(); |
|
|
|
|
private static final String PAGAMENTO_CLASS_NAME = Pagamento.class.getName(); |
|
|
|
|
private static final String PAREREGEOLOGO_CLASS_NAME = ParereGeologo.class.getName(); |
|
|
|
|
private static final String PASSWORDPOLICY_CLASS_NAME = PasswordPolicy.class.getName(); |
|
|
|
|
private static final String ROLE_CLASS_NAME = Role.class.getName(); |
|
|
|
|
private static final String SOGGETTO_CLASS_NAME = Soggetto.class.getName(); |
|
|
|
|
private static final String SORTEGGIO_CLASS_NAME = Sorteggio.class.getName(); |
|
|
|
|
private static final String USER_CLASS_NAME = User.class.getName(); |
|
|
|
|
private static final String USERPERSONALSITE_CLASS_NAME = UserPersonalSite.class.getName(); |
|
|
|
|
private static final String WIKINODE_CLASS_NAME = WikiNode.class.getName(); |