Sfoglia il codice sorgente

Cambio branch

master
Salvatore La Manna 4 anni fa
parent
commit
2f8068a7ae
  1. 490
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java
  2. 7
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/PortosAdministrationPortlet.java
  3. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/sismica_administration/view.jsp
  4. 23
      portos-camel-document-processor/.project
  5. 36
      portos-protocollazione-service/.project
  6. 36
      portos-versioning/.project

490
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/SvuotaDatabase.java → liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java

@ -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.Pagamento;
import it.tref.liferay.portos.bo.model.ParereGeologo; import it.tref.liferay.portos.bo.model.ParereGeologo;
import it.tref.liferay.portos.bo.model.Soggetto; 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.model.Tempistica;
import it.tref.liferay.portos.bo.service.AllegatoManualeLocalServiceUtil; import it.tref.liferay.portos.bo.service.AllegatoManualeLocalServiceUtil;
import it.tref.liferay.portos.bo.service.AsseverazioneLocalServiceUtil; 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.PagamentoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.ParereGeologoLocalServiceUtil; import it.tref.liferay.portos.bo.service.ParereGeologoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil; 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.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.bo.util.Constants;
import it.tref.liferay.portos.mailmanager.model.Email; import it.tref.liferay.portos.mailmanager.model.Email;
import it.tref.liferay.portos.mailmanager.model.EmailAttachment; 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.model.EmailTemplate;
import it.tref.liferay.portos.mailmanager.service.EmailAttachmentLocalServiceUtil; import it.tref.liferay.portos.mailmanager.service.EmailAttachmentLocalServiceUtil;
import it.tref.liferay.portos.mailmanager.service.EmailLocalServiceUtil; import it.tref.liferay.portos.mailmanager.service.EmailLocalServiceUtil;
import it.tref.liferay.portos.mailmanager.service.EmailTemplateLocalServiceUtil; 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.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import com.liferay.portal.kernel.cache.CacheRegistryUtil; import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.cache.MultiVMPoolUtil; import com.liferay.portal.kernel.cache.MultiVMPoolUtil;
import com.liferay.portal.kernel.cache.SingleVMPoolUtil; 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.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.repository.model.FileEntry;
import com.liferay.portal.kernel.servlet.DirectServletRegistryUtil; 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.StringUtil;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.workflow.WorkflowInstance; 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.LayoutPrototype;
import com.liferay.portal.model.LayoutSetPrototype; import com.liferay.portal.model.LayoutSetPrototype;
import com.liferay.portal.model.Organization; import com.liferay.portal.model.Organization;
import com.liferay.portal.model.PasswordPolicy;
import com.liferay.portal.model.ResourceConstants; import com.liferay.portal.model.ResourceConstants;
import com.liferay.portal.model.ResourcePermission; import com.liferay.portal.model.ResourcePermission;
import com.liferay.portal.model.Role; import com.liferay.portal.model.Role;
import com.liferay.portal.model.RoleConstants;
import com.liferay.portal.model.SystemEvent; import com.liferay.portal.model.SystemEvent;
import com.liferay.portal.model.User; import com.liferay.portal.model.User;
import com.liferay.portal.model.UserPersonalSite; 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.LayoutPrototypeLocalServiceUtil;
import com.liferay.portal.service.LayoutSetPrototypeLocalServiceUtil; import com.liferay.portal.service.LayoutSetPrototypeLocalServiceUtil;
import com.liferay.portal.service.OrganizationLocalServiceUtil; import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.PasswordPolicyLocalServiceUtil;
import com.liferay.portal.service.ResourcePermissionLocalServiceUtil; import com.liferay.portal.service.ResourcePermissionLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.SystemEventLocalServiceUtil; import com.liferay.portal.service.SystemEventLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil; 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.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.asset.service.AssetVocabularyLocalServiceUtil;
import com.liferay.portlet.documentlibrary.model.DLFileEntry; import com.liferay.portlet.documentlibrary.model.DLFileEntry;
import com.liferay.portlet.documentlibrary.model.DLFileEntryType; import com.liferay.portlet.documentlibrary.model.DLFileEntryType;
import com.liferay.portlet.documentlibrary.model.DLFolder; 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.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLFileEntryTypeLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLFileEntryTypeLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil;
import com.liferay.portlet.dynamicdatamapping.model.DDMStructure; 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.model.ExpandoColumn;
import com.liferay.portlet.expando.service.ExpandoColumnLocalServiceUtil; import com.liferay.portlet.expando.service.ExpandoColumnLocalServiceUtil;
import com.liferay.portlet.journal.model.JournalArticle; 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.model.JournalFolder;
import com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil; 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.journal.service.JournalFolderLocalServiceUtil;
import com.liferay.portlet.messageboards.model.MBDiscussion; import com.liferay.portlet.messageboards.model.MBDiscussion;
import com.liferay.portlet.messageboards.model.MBMessage; 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.MBDiscussionLocalServiceUtil;
import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil; import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil;
import com.liferay.portlet.messageboards.service.MBThreadLocalServiceUtil; 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.model.WikiNode;
import com.liferay.portlet.wiki.service.WikiNodeLocalServiceUtil; 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); * 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 { public class ManutenzioneDatabase {
private static final Log _log = LogFactoryUtil.getLog(SvuotaDatabase.class); private static final Log _log = LogFactoryUtil.getLog(ManutenzioneDatabase.class);
private static final int SLICE = 1000; 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<>(); List<String> esito = new ArrayList<>();
if (Validator.isNotNull(esito)) { long companyId = serviceContext.getCompanyId();
esito.add("Operazione non consentita"); 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();
}
if (mode.startsWith("!Workflow!")) {
String[] pezzi = StringUtil.split(mode, '!');
esito.addAll(SismicaUtil.aggiungiWorkflow(pezzi[2], pezzi[3]));
}
return esito; return esito;
} }
esito.addAll(puliziaDocumentLibrary());
esito.addAll(svuotaDatabase(serviceContext));
ConfigurazioneLocalServiceUtil.storeConfig(Constants.NUMERO_PROGETTO_KEY_DB, "1", serviceContext);
private static void clearCache() {
try { try {
SingleVMPoolUtil.clear(); SingleVMPoolUtil.clear();
MultiVMPoolUtil.clear(); MultiVMPoolUtil.clear();
@ -148,42 +210,49 @@ public class SvuotaDatabase {
DirectServletRegistryUtil.clearServlets(); DirectServletRegistryUtil.clearServlets();
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
} }
return esito;
} }
private static List<String> svuotaDatabase(ServiceContext serviceContext) throws SystemException, private static List<String> svuotaDatabase(long companyId) throws SystemException, PortalException {
PortalException {
List<String> esito = new ArrayList<>(); List<String> esito = new ArrayList<>();
esitoLog(esito, svuotaDettPratica()); esitoLog(esito, svuotaDettPratica());
esitoLog(esito, svuotaAllegatoManuale()); esitoLog(esito, svuotaAllegatoManuale());
esitoLog(esito, svuotaAssetEntry(companyId));
esitoLog(esito, svuotaAsseverazione()); esitoLog(esito, svuotaAsseverazione());
esitoLog(esito, svuotaAvviso()); esitoLog(esito, svuotaAvviso(companyId));
esitoLog(esito, svuotaCollaudo()); esitoLog(esito, svuotaCollaudo());
esitoLog(esito, svuotaContact()); esitoLog(esito, svuotaContact(companyId));
esitoLog(esito, svuotaControlloPratica()); esitoLog(esito, svuotaControlloPratica());
esitoLog(esito, svuotaDelega()); esitoLog(esito, svuotaDelega());
esitoLog(esito, svuotaDocAggiuntiva()); esitoLog(esito, svuotaDocAggiuntiva());
esitoLog(esito, svuotaDocPratica()); esitoLog(esito, svuotaDocPratica());
esitoLog(esito, svuotaEmail()); esitoLog(esito, svuotaEmail(companyId));
esitoLog(esito, svuotaEmailAttachment()); esitoLog(esito, svuotaEmailAttachment());
esitoLog(esito, svuotaFineLavori()); esitoLog(esito, svuotaFineLavori());
esitoLog(esito, svuotaGroup()); esitoLog(esito, svuotaGroup(companyId));
esitoLog(esito, svuotaMBDiscussion()); esitoLog(esito, svuotaMBDiscussion(companyId));
esitoLog(esito, svuotaMBMessage()); esitoLog(esito, svuotaMBMessage(companyId));
esitoLog(esito, svuotaMBThread()); esitoLog(esito, svuotaMBThread());
esitoLog(esito, svuotaPagamento()); esitoLog(esito, svuotaPagamento(companyId));
esitoLog(esito, svuotaResourcePermission(serviceContext.getCompanyId())); esitoLog(esito, svuotaParereGeologo());
esitoLog(esito, svuotaRatingsStats(companyId));
esitoLog(esito, svuotaResourcePermission(companyId));
esitoLog(esito, svuotaSoggetto()); esitoLog(esito, svuotaSoggetto());
esitoLog(esito, svuotaSystemEvent()); esitoLog(esito, svuotaStoricoSoggettoPratica());
esitoLog(esito, svuotaSyncDLObject());
esitoLog(esito, svuotaSystemEvent(companyId));
esitoLog(esito, svuotaTempistica()); esitoLog(esito, svuotaTempistica());
return esito; return esito;
} }
private static List<String> puliziaDocumentLibrary() { private static List<String> puliziaDocumentLibrary(long companyId) {
List<String> esito = new ArrayList<>(); List<String> esito = new ArrayList<>();
Set<String> parentFolderNames = new HashSet<>();
try { try {
long allegatiFolderId = ConfigurazioneLocalServiceUtil.findByC_ChiaveLong(companyId,
ConfigurazioneConstants.ATTACHMENT_FOLDER_ID);
int cancellati = 0; int cancellati = 0;
int start = 0; int start = 0;
int totali = 0; int totali = 0;
@ -195,20 +264,49 @@ public class SvuotaDatabase {
for (DLFolder folder : folders) { for (DLFolder folder : folders) {
DLFolder parent = folder.getParentFolder(); DLFolder parent = folder.getParentFolder();
if (Validator.isNotNull(parent)) { if (Validator.isNotNull(parent)) {
switch (parent.getName()) { parentFolderNames.add(parent.getName());
case "Allegati": if (parent.getFolderId() == allegatiFolderId) {
long[] ids = StringUtil.split(folder.getName(), "_", 0L); long[] ids = StringUtil.split(folder.getName(), "_", 0L);
if ((ids.length == 2) && (ids[0] == ids[1])) { if ((ids.length == 2) && (ids[0] == ids[1])) {
try { if (!esiste(DETTPRATICA_CLASS_NAME, ids[0])
DettPraticaLocalServiceUtil.getDettPratica(ids[0]); && !esiste(DOCPRATICA_CLASS_NAME, ids[0])
} catch (PortalException e) { && !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()); _log.info("Cancello la cartella " + folder.getName());
DLAppLocalServiceUtil.deleteFolder(folder.getFolderId());
cancellati++; cancellati++;
rimossi++; 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) { } catch (PortalException | SystemException e) {
esitoLog(esito, "Errore durante l'elaborazione. " + e.getMessage()); esitoLog(esito, "Errore durante l'elaborazione. " + e.getMessage());
} }
for (String parentFolderName : parentFolderNames) {
_log.info("Parent: " + parentFolderName);
}
return esito; 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 { private static String svuotaAllegatoManuale() throws SystemException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
@ -243,6 +416,29 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " AllegatoManuale"; 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 { private static String svuotaAsseverazione() throws SystemException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
@ -264,7 +460,7 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " Asseverazione"; return "Cancellati " + cancellati + " Asseverazione";
} }
private static String svuotaAvviso() throws SystemException { private static String svuotaAvviso(long companyId) throws SystemException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
List<Avviso> avvisi = null; List<Avviso> avvisi = null;
@ -272,7 +468,7 @@ public class SvuotaDatabase {
int rimossi = 0; int rimossi = 0;
avvisi = AvvisoLocalServiceUtil.getAvvisos(start, start + SLICE); avvisi = AvvisoLocalServiceUtil.getAvvisos(start, start + SLICE);
for (Avviso avviso : avvisi) { for (Avviso avviso : avvisi) {
if (!esiste(avviso.getClassName(), avviso.getClassPk()) if (!esiste(avviso.getClassName(), avviso.getClassPk(), companyId)
|| !esiste(INTPRATICA_CLASS_NAME, avviso.getIntPraticaId())) { || !esiste(INTPRATICA_CLASS_NAME, avviso.getIntPraticaId())) {
deleteFileEntry(avviso.getFileEntryIdBase()); deleteFileEntry(avviso.getFileEntryIdBase());
deleteFileEntry(avviso.getFileEntryIdInvio()); deleteFileEntry(avviso.getFileEntryIdInvio());
@ -306,6 +502,25 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " Collaudo"; 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 { private static String svuotaControlloPratica() throws SystemException, PortalException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
@ -346,25 +561,6 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " Delega"; 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 { private static String svuotaDettPratica() throws SystemException, PortalException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
@ -425,7 +621,7 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " DocPratica"; return "Cancellati " + cancellati + " DocPratica";
} }
private static String svuotaEmail() throws SystemException, PortalException { private static String svuotaEmail(long companyId) throws SystemException, PortalException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
List<Email> emails = null; List<Email> emails = null;
@ -433,7 +629,7 @@ public class SvuotaDatabase {
int rimossi = 0; int rimossi = 0;
emails = EmailLocalServiceUtil.getEmails(start, start + SLICE); emails = EmailLocalServiceUtil.getEmails(start, start + SLICE);
for (Email email : emails) { for (Email email : emails) {
if (!esiste(email.getClassName(), email.getClassPK())) { if (!esiste(email.getClassName(), email.getClassPK(), companyId)) {
EmailLocalServiceUtil.deleteEmail(email); EmailLocalServiceUtil.deleteEmail(email);
cancellati++; cancellati++;
rimossi++; rimossi++;
@ -483,7 +679,22 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " FineLavori"; 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 start = 0;
int cancellati = 0; int cancellati = 0;
List<Group> groups = null; List<Group> groups = null;
@ -491,7 +702,7 @@ public class SvuotaDatabase {
int rimossi = 0; int rimossi = 0;
groups = GroupLocalServiceUtil.getGroups(start, start + SLICE); groups = GroupLocalServiceUtil.getGroups(start, start + SLICE);
for (Group group : groups) { for (Group group : groups) {
if (!esiste(group.getClassName(), group.getClassPK())) { if (!esiste(group.getClassName(), group.getClassPK(), companyId)) {
GroupLocalServiceUtil.deleteGroup(group); GroupLocalServiceUtil.deleteGroup(group);
cancellati++; cancellati++;
rimossi++; rimossi++;
@ -502,7 +713,7 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " Group"; return "Cancellati " + cancellati + " Group";
} }
private static String svuotaMBDiscussion() throws SystemException { private static String svuotaMBDiscussion(long companyId) throws SystemException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
List<MBDiscussion> mbDiscussions = null; List<MBDiscussion> mbDiscussions = null;
@ -510,8 +721,9 @@ public class SvuotaDatabase {
int rimossi = 0; int rimossi = 0;
mbDiscussions = MBDiscussionLocalServiceUtil.getMBDiscussions(start, start + SLICE); mbDiscussions = MBDiscussionLocalServiceUtil.getMBDiscussions(start, start + SLICE);
for (MBDiscussion mbDiscussion : mbDiscussions) { for (MBDiscussion mbDiscussion : mbDiscussions) {
if (!esiste(mbDiscussion.getClassName(), mbDiscussion.getClassPK()) if (!esiste(mbDiscussion.getClassName(), mbDiscussion.getClassPK(), companyId)
|| !esiste(MBTHREAD_CLASS_NAME, mbDiscussion.getThreadId())) { || !esiste(MBTHREAD_CLASS_NAME, mbDiscussion.getThreadId())
|| !esiste(GROUP_CLASS_NAME, mbDiscussion.getGroupId())) {
MBDiscussionLocalServiceUtil.deleteMBDiscussion(mbDiscussion); MBDiscussionLocalServiceUtil.deleteMBDiscussion(mbDiscussion);
cancellati++; cancellati++;
rimossi++; rimossi++;
@ -522,7 +734,7 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " MBDiscussion"; return "Cancellati " + cancellati + " MBDiscussion";
} }
private static String svuotaMBMessage() throws SystemException { private static String svuotaMBMessage(long companyId) throws SystemException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
List<MBMessage> mbMessages = null; List<MBMessage> mbMessages = null;
@ -530,8 +742,9 @@ public class SvuotaDatabase {
int rimossi = 0; int rimossi = 0;
mbMessages = MBMessageLocalServiceUtil.getMBMessages(start, start + SLICE); mbMessages = MBMessageLocalServiceUtil.getMBMessages(start, start + SLICE);
for (MBMessage mbMessage : mbMessages) { for (MBMessage mbMessage : mbMessages) {
if (!esiste(mbMessage.getClassName(), mbMessage.getClassPK()) if (!esiste(mbMessage.getClassName(), mbMessage.getClassPK(), companyId)
|| !esiste(MBTHREAD_CLASS_NAME, mbMessage.getThreadId())) { || !esiste(MBTHREAD_CLASS_NAME, mbMessage.getThreadId())
|| !esiste(GROUP_CLASS_NAME, mbMessage.getGroupId())) {
MBMessageLocalServiceUtil.deleteMBMessage(mbMessage); MBMessageLocalServiceUtil.deleteMBMessage(mbMessage);
cancellati++; cancellati++;
rimossi++; rimossi++;
@ -550,7 +763,8 @@ public class SvuotaDatabase {
int rimossi = 0; int rimossi = 0;
mbThreads = MBThreadLocalServiceUtil.getMBThreads(start, start + SLICE); mbThreads = MBThreadLocalServiceUtil.getMBThreads(start, start + SLICE);
for (MBThread mbThread : mbThreads) { 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); MBThreadLocalServiceUtil.deleteMBThread(mbThread);
cancellati++; cancellati++;
rimossi++; rimossi++;
@ -561,7 +775,7 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " MBThread"; return "Cancellati " + cancellati + " MBThread";
} }
private static String svuotaPagamento() throws SystemException, PortalException { private static String svuotaPagamento(long companyId) throws SystemException, PortalException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
List<Pagamento> pagamenti = null; List<Pagamento> pagamenti = null;
@ -569,7 +783,7 @@ public class SvuotaDatabase {
int rimossi = 0; int rimossi = 0;
pagamenti = PagamentoLocalServiceUtil.getPagamentos(start, start + SLICE); pagamenti = PagamentoLocalServiceUtil.getPagamentos(start, start + SLICE);
for (Pagamento pagamento : pagamenti) { for (Pagamento pagamento : pagamenti) {
if (!esiste(pagamento.getClassName(), pagamento.getClassPk()) if (!esiste(pagamento.getClassName(), pagamento.getClassPk(), companyId)
|| !esiste(INTPRATICA_CLASS_NAME, pagamento.getIntPraticaId())) { || !esiste(INTPRATICA_CLASS_NAME, pagamento.getIntPraticaId())) {
deleteFileEntry(pagamento.getFileEntryId()); deleteFileEntry(pagamento.getFileEntryId());
PagamentoLocalServiceUtil.deletePagamento(pagamento); PagamentoLocalServiceUtil.deletePagamento(pagamento);
@ -582,6 +796,46 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " Pagamento"; 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 { private static String svuotaResourcePermission(long companyId) throws SystemException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
@ -647,7 +901,28 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " Soggetto, " + docPraticaCancellati + " DocPratica"; 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 start = 0;
int cancellati = 0; int cancellati = 0;
List<SystemEvent> systemEvents = null; List<SystemEvent> systemEvents = null;
@ -655,7 +930,7 @@ public class SvuotaDatabase {
int rimossi = 0; int rimossi = 0;
systemEvents = SystemEventLocalServiceUtil.getSystemEvents(start, start + SLICE); systemEvents = SystemEventLocalServiceUtil.getSystemEvents(start, start + SLICE);
for (SystemEvent systemEvent : systemEvents) { for (SystemEvent systemEvent : systemEvents) {
if (!esiste(systemEvent.getClassName(), systemEvent.getClassPK())) { if (!esiste(systemEvent.getClassName(), systemEvent.getClassPK(), companyId)) {
SystemEventLocalServiceUtil.deleteSystemEvent(systemEvent); SystemEventLocalServiceUtil.deleteSystemEvent(systemEvent);
cancellati++; cancellati++;
rimossi++; rimossi++;
@ -666,6 +941,34 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " SystemEvent"; 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 { private static String svuotaTempistica() throws SystemException, PortalException {
int start = 0; int start = 0;
int cancellati = 0; int cancellati = 0;
@ -686,13 +989,36 @@ public class SvuotaDatabase {
return "Cancellati " + cancellati + " Tempistica"; 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 { private static boolean esiste(String className, long classPK) throws SystemException {
return esiste(className, classPK, 0); return esiste(className, classPK, 0);
} }
private static boolean esiste(String className, long classPK, long companyId) throws SystemException { private static boolean esiste(String className, long classPK, long companyId) throws SystemException {
if (0 != classPK && Validator.isNotNull(className)) {
try { try {
if (ASSETVOCABULARY_CLASS_NAME.equals(className)) { 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); AssetVocabularyLocalServiceUtil.getAssetVocabulary(classPK);
} else if (ASSEVERAZIONE_CLASS_NAME.equals(className)) { } else if (ASSEVERAZIONE_CLASS_NAME.equals(className)) {
AsseverazioneLocalServiceUtil.getAsseverazione(classPK); AsseverazioneLocalServiceUtil.getAsseverazione(classPK);
@ -704,6 +1030,10 @@ public class SvuotaDatabase {
CompanyLocalServiceUtil.getCompany(classPK); CompanyLocalServiceUtil.getCompany(classPK);
} else if (CONTROLLOPRATICA_CLASS_NAME.equals(className)) { } else if (CONTROLLOPRATICA_CLASS_NAME.equals(className)) {
ControlloPraticaLocalServiceUtil.getControlloPratica(classPK); 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)) { } else if (DDMSTRUCTURE_CLASS_NAME.equals(className)) {
DDMStructureLocalServiceUtil.getDDMStructure(classPK); DDMStructureLocalServiceUtil.getDDMStructure(classPK);
} else if (DDMTEMPLATE_CLASS_NAME.equals(className)) { } else if (DDMTEMPLATE_CLASS_NAME.equals(className)) {
@ -734,6 +1064,8 @@ public class SvuotaDatabase {
IntPraticaLocalServiceUtil.getIntPratica(classPK); IntPraticaLocalServiceUtil.getIntPratica(classPK);
} else if (JOURNALARTICLE_CLASS_NAME.equals(className)) { } else if (JOURNALARTICLE_CLASS_NAME.equals(className)) {
JournalArticleLocalServiceUtil.getArticle(classPK); JournalArticleLocalServiceUtil.getArticle(classPK);
} else if (JOURNALARTICLERESOURCE_CLASS_NAME.equals(className)) {
JournalArticleResourceLocalServiceUtil.getJournalArticleResource(classPK);
} else if (JOURNALFOLDER_CLASS_NAME.equals(className)) { } else if (JOURNALFOLDER_CLASS_NAME.equals(className)) {
JournalFolderLocalServiceUtil.getJournalFolder(classPK); JournalFolderLocalServiceUtil.getJournalFolder(classPK);
} else if (LAYOUT_CLASS_NAME.equals(className)) { } else if (LAYOUT_CLASS_NAME.equals(className)) {
@ -742,18 +1074,26 @@ public class SvuotaDatabase {
LayoutPrototypeLocalServiceUtil.getLayoutPrototype(classPK); LayoutPrototypeLocalServiceUtil.getLayoutPrototype(classPK);
} else if (LAYOUTSETPROTOTYPE_CLASS_NAME.equals(className)) { } else if (LAYOUTSETPROTOTYPE_CLASS_NAME.equals(className)) {
LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(classPK); LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(classPK);
} else if (MBDISCUSSION_CLASS_NAME.equals(className)) {
MBDiscussionLocalServiceUtil.getMBDiscussion(classPK);
} else if (MBMESSAGE_CLASS_NAME.equals(className)) { } else if (MBMESSAGE_CLASS_NAME.equals(className)) {
MBMessageLocalServiceUtil.getMBMessage(classPK); MBMessageLocalServiceUtil.getMBMessage(classPK);
} else if (MBTHREAD_CLASS_NAME.equals(className)) { } else if (MBTHREAD_CLASS_NAME.equals(className)) {
MBThreadLocalServiceUtil.getMBThread(classPK); MBThreadLocalServiceUtil.getMBThread(classPK);
} else if (ORGANIZATION_CLASS_NAME.equals(className)) { } else if (ORGANIZATION_CLASS_NAME.equals(className)) {
OrganizationLocalServiceUtil.getOrganization(classPK); OrganizationLocalServiceUtil.getOrganization(classPK);
} else if (PAGAMENTO_CLASS_NAME.equals(className)) {
PagamentoLocalServiceUtil.getPagamento(classPK);
} else if (PAREREGEOLOGO_CLASS_NAME.equals(className)) { } else if (PAREREGEOLOGO_CLASS_NAME.equals(className)) {
ParereGeologoLocalServiceUtil.getParereGeologo(classPK); ParereGeologoLocalServiceUtil.getParereGeologo(classPK);
} else if (PASSWORDPOLICY_CLASS_NAME.equals(className)) {
PasswordPolicyLocalServiceUtil.getPasswordPolicy(classPK);
} else if (ROLE_CLASS_NAME.equals(className)) { } else if (ROLE_CLASS_NAME.equals(className)) {
RoleLocalServiceUtil.getRole(classPK); RoleLocalServiceUtil.getRole(classPK);
} else if (SOGGETTO_CLASS_NAME.equals(className)) { } else if (SOGGETTO_CLASS_NAME.equals(className)) {
SoggettoLocalServiceUtil.getSoggetto(classPK); SoggettoLocalServiceUtil.getSoggetto(classPK);
} else if (SORTEGGIO_CLASS_NAME.equals(className)) {
SorteggioLocalServiceUtil.getSorteggio(classPK);
} else if (USER_CLASS_NAME.equals(className)) { } else if (USER_CLASS_NAME.equals(className)) {
UserLocalServiceUtil.getUser(classPK); UserLocalServiceUtil.getUser(classPK);
} else if (USERPERSONALSITE_CLASS_NAME.equals(className)) { } else if (USERPERSONALSITE_CLASS_NAME.equals(className)) {
@ -761,25 +1101,22 @@ public class SvuotaDatabase {
} else if (WIKINODE_CLASS_NAME.equals(className)) { } else if (WIKINODE_CLASS_NAME.equals(className)) {
WikiNodeLocalServiceUtil.getWikiNode(classPK); WikiNodeLocalServiceUtil.getWikiNode(classPK);
} else if (WORKFLOWINSTANCE_CLASS_NAME.equals(className)) { } else if (WORKFLOWINSTANCE_CLASS_NAME.equals(className)) {
if (Validator.isNotNull(companyId)) { if (Validator.isNull(companyId)) {
_log.info("CompanyId = " + companyId);
;
} else {
WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, classPK); WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, classPK);
} }
} else { } else {
if (className.contains(".")) { if (className.contains(".")) {
switch (className) { switch (className) {
case "com.liferay.portlet.asset":
case "com.liferay.portlet.blogs": case "com.liferay.portlet.blogs":
case "com.liferay.portlet.bookmarks":
case "com.liferay.portlet.documentlibrary": case "com.liferay.portlet.documentlibrary":
case "com.liferay.portlet.journal": case "com.liferay.portlet.journal":
case "com.liferay.portlet.messageboards": case "com.liferay.portlet.messageboards":
case "com.liferay.portlet.polls": case "com.liferay.portlet.polls":
case "com.liferay.portlet.wiki": 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.intpratiche":
case "it.tref.liferay.portos.bo.pending_pagamenti":
case "it.tref.liferay.portos.mailmanager.email":
break; break;
default: default:
_log.info("Classe non supportata: " + className); _log.info("Classe non supportata: " + className);
@ -789,6 +1126,7 @@ public class SvuotaDatabase {
} catch (PortalException e) { } catch (PortalException e) {
return false; return false;
} }
}
return true; return true;
} }
@ -804,6 +1142,8 @@ public class SvuotaDatabase {
esito.add(msg); 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 ASSETVOCABULARY_CLASS_NAME = AssetVocabulary.class.getName();
private static final String ASSEVERAZIONE_CLASS_NAME = Asseverazione.class.getName(); private static final String ASSEVERAZIONE_CLASS_NAME = Asseverazione.class.getName();
private static final String AVVISO_CLASS_NAME = Avviso.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 DLFILEENTRY_CLASS_NAME = DLFileEntry.class.getName();
private static final String DLFILEENTRYTYPE_CLASS_NAME = DLFileEntryType.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 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 EMAIL_CLASS_NAME = Email.class.getName();
private static final String EMAILADDRESS_CLASS_NAME = EmailAddress.class.getName(); private static final String EMAILADDRESS_CLASS_NAME = EmailAddress.class.getName();
private static final String EMAILTEMPLATE_CLASS_NAME = EmailTemplate.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 GROUP_CLASS_NAME = Group.class.getName();
private static final String INTPRATICA_CLASS_NAME = IntPratica.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 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 JOURNALFOLDER_CLASS_NAME = JournalFolder.class.getName();
private static final String LAYOUT_CLASS_NAME = Layout.class.getName(); private static final String LAYOUT_CLASS_NAME = Layout.class.getName();
private static final String LAYOUTPROTOTYPE_CLASS_NAME = LayoutPrototype.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 MBMESSAGE_CLASS_NAME = MBMessage.class.getName();
private static final String MBTHREAD_CLASS_NAME = MBThread.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 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 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 ROLE_CLASS_NAME = Role.class.getName();
private static final String SOGGETTO_CLASS_NAME = Soggetto.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 USER_CLASS_NAME = User.class.getName();
private static final String USERPERSONALSITE_CLASS_NAME = UserPersonalSite.class.getName(); private static final String USERPERSONALSITE_CLASS_NAME = UserPersonalSite.class.getName();
private static final String WIKINODE_CLASS_NAME = WikiNode.class.getName(); private static final String WIKINODE_CLASS_NAME = WikiNode.class.getName();

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

@ -1,6 +1,5 @@
package it.tref.liferay.portos.bo.portlet; package it.tref.liferay.portos.bo.portlet;
import it.mwg.sismica.bo.util.SvuotaDatabase;
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;
@ -97,11 +96,7 @@ public class PortosAdministrationPortlet extends MVCPortlet {
actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()])); actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()]));
} }
public void svuotaDatabase(ActionRequest actionRequest, ActionResponse actionResponse) public void svuotaDatabase(ActionRequest actionRequest, ActionResponse actionResponse) {
throws PortalException, SystemException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
List<String> esito = SvuotaDatabase.pulisci(serviceContext);
actionResponse.setRenderParameter("esito", esito.toArray(new String[esito.size()]));
} }
public void salvaDataProssimoSorteggio(ActionRequest actionRequest, ActionResponse actionResponse) public void salvaDataProssimoSorteggio(ActionRequest actionRequest, ActionResponse actionResponse)

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

@ -88,12 +88,12 @@ String dataProssimoSorteggio =
</div> </div>
</div> </div>
<liferay-portlet:actionURL name="svuotaDatabase" var="svuotaDatabaseURL" /> <liferay-portlet:actionURL name="manutenzioneDatabase" var="manutenzioneDatabaseURL" />
<liferay-portlet:actionURL name="inviaComunicazione" var="inviaComunicazioneURL" /> <liferay-portlet:actionURL name="inviaComunicazione" var="inviaComunicazioneURL" />
<div class="row-fluid" style="margin-top: 10px;"> <div class="row-fluid" style="margin-top: 10px;">
<div class="span6"> <div class="span6">
<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="<%=manutenzioneDatabaseURL%>" method="post" name="fmManutenzioneDatabase">
<div> <div>
<aui:button cssClass="btn-danger" type="submit" value="Manutenzione Database" /> <aui:button cssClass="btn-danger" type="submit" value="Manutenzione Database" />
</div> </div>

23
portos-camel-document-processor/.project

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>portos-camel-document-processor</name>
<comment>Project portos-camel-document-processor created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>

36
portos-protocollazione-service/.project

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>portos-protocollazione-service</name>
<comment>Project portos-protocollazione-service created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>

36
portos-versioning/.project

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>portos-versioning</name>
<comment>Project portos-versioning created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
Caricamento…
Annulla
Salva