Sfoglia il codice sorgente

Merge branch 'master' of 149.202.172.180:/home/mattia/sicilia/sources

Mattia Gosetto 4 anni fa
parent
commit
df28216cdb
  1. BIN
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/httpclient.jar
  2. BIN
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/util-java.jar
  3. 8
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/liferay-portlet.xml
  4. 34
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpServiceUtil.java
  5. 38
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/PuliziaDatabase.java
  6. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties
  7. 3
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java
  8. 85
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java
  9. 4
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties

BIN
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/httpclient.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/util-java.jar

File binario non mostrato.

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

@ -1,14 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>1</portlet-name>
<icon>/icon.png</icon>
<indexer-class>it.tref.liferay.portos.bo.indexer.IntPraticaIndexer</indexer-class>
<indexer-class>it.tref.liferay.portos.bo.indexer.ControlloPraticaIndexer</indexer-class>
<scheduler-entry>
<scheduler-entry>
<scheduler-description>Estrazione Firme</scheduler-description>
<scheduler-event-listener-class>it.tref.liferay.portos.bo.scheduler.SchedulerEstrazioneFirme</scheduler-event-listener-class>
<trigger>
@ -38,7 +36,7 @@
</simple>
</trigger>
</scheduler-entry>
<scheduler-entry>
<scheduler-entry>
<scheduler-description>Sorteggio Pratiche</scheduler-description>
<scheduler-event-listener-class>it.mwg.sismica.bo.scheduler.SchedulerSorteggio</scheduler-event-listener-class>
<trigger>
@ -87,7 +85,7 @@
</simple>
</trigger>
</scheduler-entry>
<asset-renderer-factory>it.tref.liferay.portos.bo.asset.ControlloPraticaAssetRendererFactory</asset-renderer-factory>
<asset-renderer-factory>it.tref.liferay.portos.bo.asset.ControlloPraticaAssetRendererFactory</asset-renderer-factory>
<workflow-handler>it.tref.liferay.portos.bo.workflow.ControlloPraticaWorkflowHandler</workflow-handler>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>

34
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpServiceUtil.java

@ -1,5 +1,8 @@
package it.mwg.sismica.bo.util;
import java.io.IOException;
import flexjson.JSONSerializer;
import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil;
import it.tref.liferay.portos.bo.shared.protocollo.model.Protocollo;
import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants;
@ -13,12 +16,12 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.Http.Body;
import com.liferay.portal.kernel.util.HttpUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Http.Options;
@ -28,21 +31,17 @@ public class HttpServiceUtil {
public static JSONObject postProtocolloBean(long companyId, Protocollo protocolloBean) throws Exception {
flexjson.JSONSerializer serializer = new flexjson.JSONSerializer();
JSONSerializer serializer = new JSONSerializer();
serializer.exclude("*.class");
String json = serializer.serialize(protocolloBean);
String url = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId,
ConfigurazioneConstants.PROTOCOLLAZIONE_SERVICE_URL);
return postJson(url, json);
}
public static JSONObject postJson(String url, String json) throws Exception {
JSONObject risposta = null;
HttpPost request = new HttpPost(url);
request.setHeader("Content-type", ContentTypes.APPLICATION_JSON);
request.setEntity(new StringEntity(json));
request.addHeader("Content-type", ContentTypes.APPLICATION_JSON);
request.setEntity(new StringEntity(json, StringPool.UTF8));
CloseableHttpClient client = HttpClientBuilder.create().build();
HttpResponse response = client.execute(request);
@ -55,7 +54,24 @@ public class HttpServiceUtil {
_log.info(url + " || " + json + " || " + risposta);
} else {
_log.info(url + " || " + json + " || " + statusCode + ": " + responseBody);
throw new PortalException(statusCode + StringPool.SPACE + responseBody);
}
return risposta;
}
public static JSONObject postJson(String url, String json) throws Exception {
JSONObject risposta = null;
Options options = new Options();
options.setLocation(url);
options.setPost(true);
options.addHeader("Content-Type", ContentTypes.APPLICATION_JSON);
Body body = new Body(json, ContentTypes.APPLICATION_JSON, "UTF-8");
options.setBody(body);
String responseBody = HttpUtil.URLtoString(options);
if (options.getResponse().getResponseCode() == HttpServletResponse.SC_OK
|| options.getResponse().getResponseCode() == HttpServletResponse.SC_CREATED) {
risposta = JSONFactoryUtil.createJSONObject(responseBody);
} else {
throw new Exception(options.getResponse().getResponseCode() + StringPool.SPACE + responseBody);
}
return risposta;
}

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

@ -5,6 +5,7 @@
*/
package it.mwg.sismica.bo.util;
import it.tref.liferay.portos.bo.model.Avviso;
import it.tref.liferay.portos.bo.model.Collaudo;
import it.tref.liferay.portos.bo.model.ControlloPratica;
import it.tref.liferay.portos.bo.model.Delega;
@ -14,6 +15,7 @@ import it.tref.liferay.portos.bo.model.DocPratica;
import it.tref.liferay.portos.bo.model.FineLavori;
import it.tref.liferay.portos.bo.model.IntPratica;
import it.tref.liferay.portos.bo.model.Soggetto;
import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.CollaudoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DelegaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
@ -33,6 +35,7 @@ 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.QueryUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
@ -59,6 +62,40 @@ public class PuliziaDatabase {
private static final Log _log = LogFactoryUtil.getLog(PuliziaDatabase.class);
private static final int SLICE = 1000;
public static List<String> pulisci2(ServiceContext serviceContext) {
List<String> esito = new ArrayList<>();
int numeroPratiche = 0;
try {
List<IntPratica> pratiche = null;
int start = 0;
do {
pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, start + SLICE);
for (IntPratica pratica : pratiche) {
List<Avviso> avvisi = AvvisoLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId(),
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
int noFile = 0;
for (Avviso avviso : avvisi) {
if (0 == avviso.getFileEntryIdBase()) {
AvvisoLocalServiceUtil.deleteAvviso(avviso);
noFile++;
}
}
if (noFile > 0) {
esitoLog(esito,
"Pratica " + pratica.getNumeroProgetto() + "(" + pratica.getIntPraticaId()
+ ") - " + avvisi.size() + " avvisi, eliminati: " + noFile);
}
}
start += SLICE;
numeroPratiche += pratiche.size();
} while (pratiche.size() > 0);
esitoLog(esito, numeroPratiche + " pratiche");
} catch (Exception e) {
esitoLog(esito, "Interrotto per errore: " + e.getMessage());
}
return esito;
}
public static List<String> pulisci(ServiceContext serviceContext) {
List<String> esito = new ArrayList<>();
@ -71,6 +108,7 @@ public class PuliziaDatabase {
MultiVMPoolUtil.clear();
CacheRegistryUtil.clear();
DirectServletRegistryUtil.clearServlets();
// WebCachePoolUtil.clear();
} catch (IllegalStateException e) {
}

4
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
##
build.namespace=portos_bo
build.number=2426
build.date=1600769216546
build.number=2444
build.date=1600956928654
build.auto.upgrade=true
##

3
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java

@ -35,11 +35,8 @@ import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portlet.documentlibrary.DuplicateFileException;
import com.liferay.portlet.documentlibrary.model.DLFileEntry;
import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
import it.tref.liferay.portos.bo.shared.util.Constants;
import it.tref.liferay.portos.report.shared.constants.ReportConstants;
import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportResult;

85
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/service/impl/ReportTaskManagerServiceImpl.java

@ -28,10 +28,28 @@ import com.liferay.portal.kernel.util.MimeTypesUtil;
import com.liferay.portal.kernel.util.StreamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.Role;
import com.liferay.portal.model.RoleConstants;
import com.liferay.portal.model.User;
import com.liferay.portal.security.auth.PrincipalThreadLocal;
import com.liferay.portal.security.permission.ActionKeys;
import com.liferay.portal.security.permission.PermissionChecker;
import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
import com.liferay.portal.security.permission.PermissionThreadLocal;
import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portlet.documentlibrary.DuplicateFileException;
import com.liferay.portlet.documentlibrary.NoSuchFileEntryException;
import com.liferay.portlet.documentlibrary.service.DLAppHelperLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLContentLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
import com.liferay.portlet.documentlibrary.util.DLAppHelperThreadLocal;
import com.liferay.portlet.documentlibrary.util.DLProcessorRegistryUtil;
import com.liferay.portlet.trash.service.TrashEntryLocalServiceUtil;
import it.tref.liferay.portos.report.html.core.HtmlToPdfEngine;
import it.tref.liferay.portos.report.jasper.core.provider.JasperPdfProvider;
@ -110,7 +128,6 @@ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseIm
fileEntryTemplate.getFileEntryId(), fileEntryTemplate.getVersion(), false);
// generazione report
if (reportType.equals(ReportType.JRXML_TO_PDF)) {
// Object dataSource = reportDto.getDataSource();
@ -168,20 +185,44 @@ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseIm
// recupero folder dove inserire report generato
Folder folder = DLAppLocalServiceUtil.getFolder(reportDto.getFolderId());
long folderId = reportDto.getFolderId();
Folder folder = DLAppLocalServiceUtil.getFolder(folderId);
long groupId = folder.getGroupId();
long repositoryId = folder.getRepositoryId();
String title = reportDto.getFileName();
String sourceFileName = title + StringPool.PERIOD + "pdf";
String mimeType = MimeTypesUtil.getContentType(sourceFileName);
String fileName = title + StringPool.PERIOD + "pdf";
String mimeType = MimeTypesUtil.getContentType(fileName);
// se è già presente lo cancello
try {
FileEntry fileEntry = dlAppLocalService.getFileEntry(folder.getGroupId(),
folder.getFolderId(), title);
dlAppLocalService.deleteFileEntry(fileEntry.getFileEntryId());
} catch (PortalException e) {
}
// FileEntry fileEntry = null;
// try {
// fileEntry =
// DLAppLocalServiceUtil.getFileEntry(groupId,
// folderId,
// title);
// } catch (PortalException e) {
// }
// if (Validator.isNotNull(fileEntry)) {
// _log.info("Cancello file entry " +
// fileEntry.getFileEntryId());
//
// Role role = RoleLocalServiceUtil.getRole(companyId,
// RoleConstants.ADMINISTRATOR);
// User user =
// UserLocalServiceUtil.getRoleUsers(role.getRoleId(), 0,
// 1).get(0);
// PermissionChecker permissionChecker =
// PermissionCheckerFactoryUtil.create(user);
//
// PrincipalThreadLocal.setName(user.getUserId());
// PermissionThreadLocal.setPermissionChecker(permissionChecker);
//
// DLAppServiceUtil.deleteFileEntry(fileEntry.getFileEntryId());
// DLAppLocalServiceUtil.deleteFileEntry(fileEntry.getFileEntryId());
//
// DLAppHelperLocalServiceUtil.deleteFileEntry(fileEntry);
// }
// inserimento con permessi di view per site member
@ -190,19 +231,23 @@ public class ReportTaskManagerServiceImpl extends ReportTaskManagerServiceBaseIm
serviceContext.setUserId(userId);
serviceContext.setGroupPermissions(new String[] { ActionKeys.VIEW });
_log.info("addFileEntry userId=" + serviceContext.getUserId() + ", repositoryId="
+ folder.getRepositoryId() + ", folderId=" + folder.getFolderId()
+ ", sourceFileName=" + sourceFileName + ", mimeType=" + mimeType + ", title="
_log.info("addFileEntry userId=" + userId + ", repositoryId=" + repositoryId + ", folderId="
+ folderId + ", sourceFileName=" + fileName + ", mimeType=" + mimeType + ", title="
+ title);
FileEntry fileEntry = dlAppLocalService.addFileEntry(serviceContext.getUserId(),
folder.getRepositoryId(), folder.getFolderId(), sourceFileName, mimeType, title,
StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
FileEntry fileEntry = null;
try {
fileEntry = DLAppLocalServiceUtil.getFileEntry(groupId, folderId, title);
fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntry.getFileEntryId(),
fileName, mimeType, title, StringPool.BLANK, StringPool.BLANK, false, bytes,
serviceContext);
} catch (PortalException e) {
fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, fileName,
mimeType, title, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
}
fileEntryIds = ArrayUtil.append(fileEntryIds, fileEntry.getFileEntryId());
}
} catch (Exception e) {
throw new SystemException(e);
e.printStackTrace();
}
return fileEntryIds;

4
liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/service.properties

@ -13,8 +13,8 @@
##
build.namespace=portos_rep
build.number=18
build.date=1577444175789
build.number=22
build.date=1600955423028
build.auto.upgrade=true
##

Caricamento…
Annulla
Salva