|
|
@ -26,7 +26,6 @@ import it.tref.liferay.portos.bo.model.DettPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.DocAggiuntiva; |
|
|
|
import it.tref.liferay.portos.bo.model.DocAggiuntiva; |
|
|
|
import it.tref.liferay.portos.bo.model.DocPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.DocPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.FineLavori; |
|
|
|
import it.tref.liferay.portos.bo.model.FineLavori; |
|
|
|
import it.tref.liferay.portos.bo.model.HistoryWorkflowAction; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.bo.model.IntPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.IntPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.Pagamento; |
|
|
|
import it.tref.liferay.portos.bo.model.Pagamento; |
|
|
|
import it.tref.liferay.portos.bo.model.ParereGeologo; |
|
|
|
import it.tref.liferay.portos.bo.model.ParereGeologo; |
|
|
@ -60,8 +59,6 @@ import it.tref.liferay.portos.bo.util.PraticaUtil; |
|
|
|
import it.tref.liferay.portos.bo.util.WorkflowConstants; |
|
|
|
import it.tref.liferay.portos.bo.util.WorkflowConstants; |
|
|
|
import it.tref.liferay.portos.bo.util.WorkflowUtil; |
|
|
|
import it.tref.liferay.portos.bo.util.WorkflowUtil; |
|
|
|
import it.tref.liferay.portos.kaleo.service.FormLogLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.kaleo.service.FormLogLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.mailmanager.model.Email; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.mailmanager.model.EmailAttachment; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.report.shared.constants.ReportConstants; |
|
|
|
import it.tref.liferay.portos.report.shared.constants.ReportConstants; |
|
|
|
import it.tref.liferay.portos.report.shared.dto.ReportDto; |
|
|
|
import it.tref.liferay.portos.report.shared.dto.ReportDto; |
|
|
|
import it.tref.liferay.portos.report.shared.dto.ReportResultDto; |
|
|
|
import it.tref.liferay.portos.report.shared.dto.ReportResultDto; |
|
|
@ -69,8 +66,6 @@ import it.tref.liferay.portos.report.shared.util.ReportUtil; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.Serializable; |
|
|
|
import java.io.Serializable; |
|
|
|
import java.sql.Connection; |
|
|
|
|
|
|
|
import java.sql.Statement; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Collections; |
|
|
@ -79,15 +74,9 @@ import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map.Entry; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.codec.digest.DigestUtils; |
|
|
|
import org.apache.commons.codec.digest.DigestUtils; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
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.dao.orm.Disjunction; |
|
|
|
import com.liferay.portal.kernel.dao.orm.Disjunction; |
|
|
|
import com.liferay.portal.kernel.dao.orm.DynamicQuery; |
|
|
|
import com.liferay.portal.kernel.dao.orm.DynamicQuery; |
|
|
|
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; |
|
|
|
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; |
|
|
@ -108,7 +97,6 @@ import com.liferay.portal.kernel.repository.model.FileEntry; |
|
|
|
import com.liferay.portal.kernel.repository.model.Folder; |
|
|
|
import com.liferay.portal.kernel.repository.model.Folder; |
|
|
|
import com.liferay.portal.kernel.search.Indexer; |
|
|
|
import com.liferay.portal.kernel.search.Indexer; |
|
|
|
import com.liferay.portal.kernel.search.IndexerRegistryUtil; |
|
|
|
import com.liferay.portal.kernel.search.IndexerRegistryUtil; |
|
|
|
import com.liferay.portal.kernel.servlet.DirectServletRegistryUtil; |
|
|
|
|
|
|
|
import com.liferay.portal.kernel.util.FastDateFormatFactoryUtil; |
|
|
|
import com.liferay.portal.kernel.util.FastDateFormatFactoryUtil; |
|
|
|
import com.liferay.portal.kernel.util.LocaleUtil; |
|
|
|
import com.liferay.portal.kernel.util.LocaleUtil; |
|
|
|
import com.liferay.portal.kernel.util.MimeTypesUtil; |
|
|
|
import com.liferay.portal.kernel.util.MimeTypesUtil; |
|
|
@ -130,12 +118,6 @@ import com.liferay.portal.workflow.kaleo.model.KaleoLog; |
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoTaskAssignmentInstance; |
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoTaskAssignmentInstance; |
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoTaskInstanceToken; |
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoTaskInstanceToken; |
|
|
|
import com.liferay.portlet.documentlibrary.NoSuchFolderException; |
|
|
|
import com.liferay.portlet.documentlibrary.NoSuchFolderException; |
|
|
|
import com.liferay.portlet.documentlibrary.model.DLFileEntry; |
|
|
|
|
|
|
|
import com.liferay.portlet.documentlibrary.model.DLFolder; |
|
|
|
|
|
|
|
import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; |
|
|
|
|
|
|
|
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; |
|
|
|
|
|
|
|
import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil; |
|
|
|
|
|
|
|
import com.liferay.portlet.social.model.SocialActivity; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The implementation of the int pratica local service. |
|
|
|
* The implementation of the int pratica local service. |
|
|
@ -340,140 +322,6 @@ public class IntPraticaLocalServiceImpl extends IntPraticaLocalServiceBaseImpl { |
|
|
|
return intPratica; |
|
|
|
return intPratica; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<String> svuotaDatabase(ServiceContext serviceContext) { |
|
|
|
|
|
|
|
List<String> esito = new ArrayList<String>(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
Connection connection = DataAccess.getUpgradeOptimizedConnection(); |
|
|
|
|
|
|
|
Statement statement = connection.createStatement(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Class<?>> svuotare = new HashMap<String, Class<?>>() { |
|
|
|
|
|
|
|
private static final long serialVersionUID = 1; |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
put("kaleoinstance", KaleoInstance.class); |
|
|
|
|
|
|
|
put("kaleoinstancetoken", KaleoInstanceToken.class); |
|
|
|
|
|
|
|
put("kaleolog", KaleoLog.class); |
|
|
|
|
|
|
|
put("kaleotaskassignmentinstance", KaleoTaskAssignmentInstance.class); |
|
|
|
|
|
|
|
put("kaleotaskinstancetoken", KaleoTaskInstanceToken.class); |
|
|
|
|
|
|
|
put("portos_bo_allegatomanuale", AllegatoManuale.class); |
|
|
|
|
|
|
|
put("portos_bo_asseverazione", Asseverazione.class); |
|
|
|
|
|
|
|
put("portos_bo_avviso", Avviso.class); |
|
|
|
|
|
|
|
put("portos_bo_collaudo", Collaudo.class); |
|
|
|
|
|
|
|
put("portos_bo_controllopratica", ControlloPratica.class); |
|
|
|
|
|
|
|
put("portos_bo_delega", Delega.class); |
|
|
|
|
|
|
|
put("portos_bo_dettpratica", DettPratica.class); |
|
|
|
|
|
|
|
put("portos_bo_docaggiuntiva", DocAggiuntiva.class); |
|
|
|
|
|
|
|
put("portos_bo_docpratica", DocPratica.class); |
|
|
|
|
|
|
|
put("portos_bo_finelavori", FineLavori.class); |
|
|
|
|
|
|
|
put("portos_bo_historyworkflowaction", HistoryWorkflowAction.class); |
|
|
|
|
|
|
|
put("portos_bo_intpratica", IntPratica.class); |
|
|
|
|
|
|
|
put("portos_bo_pagamento", Pagamento.class); |
|
|
|
|
|
|
|
put("portos_bo_pareregeo", ParereGeologo.class); |
|
|
|
|
|
|
|
put("portos_bo_soggetto", Soggetto.class); |
|
|
|
|
|
|
|
put("portos_bo_sorteggio", Sorteggio.class); |
|
|
|
|
|
|
|
put("portos_bo_tempistica", Tempistica.class); |
|
|
|
|
|
|
|
put("portos_mail_email", Email.class); |
|
|
|
|
|
|
|
put("portos_mail_emailattachment", EmailAttachment.class); |
|
|
|
|
|
|
|
put("socialactivity", SocialActivity.class); |
|
|
|
|
|
|
|
put("workflowinstancelink", WorkflowInstanceLink.class); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Entry<String, Class<?>> entry : svuotare.entrySet()) { |
|
|
|
|
|
|
|
String table = entry.getKey(); |
|
|
|
|
|
|
|
String className = entry.getValue().getName(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
statement.execute("TRUNCATE TABLE " + table); |
|
|
|
|
|
|
|
esitoLog(esito, "Tabella " + table + " svuotata"); |
|
|
|
|
|
|
|
counterLocalService.increment(className); |
|
|
|
|
|
|
|
counterLocalService.reset(className); |
|
|
|
|
|
|
|
esitoLog(esito, "Contatore di " + className + " azzerato"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
configurazioneLocalService.storeConfig(Constants.NUMERO_PROGETTO_KEY_DB, "1", serviceContext); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reset di tutte le cache
|
|
|
|
|
|
|
|
SingleVMPoolUtil.clear(); |
|
|
|
|
|
|
|
MultiVMPoolUtil.clear(); |
|
|
|
|
|
|
|
CacheRegistryUtil.clear(); |
|
|
|
|
|
|
|
DirectServletRegistryUtil.clearServlets(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Pulizia Document Library
|
|
|
|
|
|
|
|
int start = 0; |
|
|
|
|
|
|
|
int totali = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> folderDaSvuotare = new ArrayList<String>() { |
|
|
|
|
|
|
|
private static final long serialVersionUID = 1; |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
add("Allegati"); |
|
|
|
|
|
|
|
add("Avvisi"); |
|
|
|
|
|
|
|
add("MailManager_EmailAttachments"); |
|
|
|
|
|
|
|
add("Report_Sorteggio"); |
|
|
|
|
|
|
|
add("Report_Sorteggio_BO"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DLFileEntry> fileEntries; |
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
fileEntries = DLFileEntryLocalServiceUtil.getFileEntries(start, start + 1); |
|
|
|
|
|
|
|
totali++; |
|
|
|
|
|
|
|
for (DLFileEntry fileEntry : fileEntries) { |
|
|
|
|
|
|
|
DLFolder folder = fileEntry.getFolder(); |
|
|
|
|
|
|
|
DLFolder parent = folder; |
|
|
|
|
|
|
|
if (Validator.isNotNull(folder)) { |
|
|
|
|
|
|
|
while (Validator.isNotNull(parent.getParentFolderId())) { |
|
|
|
|
|
|
|
folder = parent; |
|
|
|
|
|
|
|
parent = parent.getParentFolder(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (folderDaSvuotare.contains(parent.getName())) { |
|
|
|
|
|
|
|
if (0 == folder.getParentFolderId()) { |
|
|
|
|
|
|
|
_log.info("Cancello il file " + fileEntry.getName()); |
|
|
|
|
|
|
|
DLAppLocalServiceUtil.deleteFileEntry(fileEntry.getFileEntryId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
_log.info("Cancello la cartella " + folder.getName()); |
|
|
|
|
|
|
|
DLAppLocalServiceUtil.deleteFolder(folder.getFolderId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
start--; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
_log.info("Mantengo il file " + fileEntry.getTitle()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
_log.info("Il file " + fileEntry.getName() + " non appartiene a nessuna cartella"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
start++; |
|
|
|
|
|
|
|
} while (fileEntries.size() > 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final int SLICE = 100; |
|
|
|
|
|
|
|
int cancellati = start = totali = 0; |
|
|
|
|
|
|
|
List<DLFolder> folders; |
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
folders = DLFolderLocalServiceUtil.getDLFolders(start, start + SLICE); |
|
|
|
|
|
|
|
int rimossi = 0; |
|
|
|
|
|
|
|
totali += folders.size(); |
|
|
|
|
|
|
|
for (DLFolder folder : folders) { |
|
|
|
|
|
|
|
int nFiles = DLFileEntryLocalServiceUtil.getFileEntriesCount(folder.getGroupId(), |
|
|
|
|
|
|
|
folder.getFolderId()); |
|
|
|
|
|
|
|
if ((0 == nFiles) && (0 != folder.getParentFolderId())) { |
|
|
|
|
|
|
|
DLAppLocalServiceUtil.deleteFolder(folder.getFolderId()); |
|
|
|
|
|
|
|
cancellati++; |
|
|
|
|
|
|
|
rimossi++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
start += folders.size() - rimossi; |
|
|
|
|
|
|
|
_log.info("Analizzate " + totali + " cartelle, cancellate " + cancellati); |
|
|
|
|
|
|
|
} while (folders.size() > 0); |
|
|
|
|
|
|
|
esitoLog(esito, "Analizzate " + totali + " cartelle, cancellate " + cancellati); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
esitoLog(esito, "Errore: " + e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_log.info("Elaborazione terminata correttamente"); |
|
|
|
|
|
|
|
return esito; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void esitoLog(List<String> esito, String msg) { |
|
|
|
|
|
|
|
esito.add(msg); |
|
|
|
|
|
|
|
_log.info(msg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void clearDb() throws Exception { |
|
|
|
public void clearDb() throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
User user = PermissionThreadLocal.getPermissionChecker().getUser(); |
|
|
|
User user = PermissionThreadLocal.getPermissionChecker().getUser(); |
|
|
|