Sfoglia il codice sorgente

Correzioni estrattore firme

master
Salvatore La Manna 4 anni fa
parent
commit
ec324eca4a
  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/httpcore.jar
  3. BIN
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/httpmime.jar
  4. BIN
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/util-java.jar
  5. 2
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/mwg/sismica/bo/util/HttpServiceUtil.java
  6. 43
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java
  7. 4
      liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties
  8. BIN
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/lib/httpcore.jar
  9. BIN
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/lib/httpmime.jar

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/httpcore.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/httpmime.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.

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

@ -37,7 +37,7 @@ public class HttpServiceUtil {
return postJson(url, json);
}
public static JSONObject postJson(String url, String json) throws Exception {
JSONObject risposta = null;
HttpPost request = new HttpPost(url);

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

@ -19,7 +19,6 @@ import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaServiceUtil;
import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil;
import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil;
import it.tref.liferay.portos.bo.service.persistence.AsseverazioneUtil;
import it.tref.liferay.portos.bo.shared.bean.FirmeBean;
import it.tref.liferay.portos.bo.shared.util.Constants;
import it.tref.liferay.portos.bo.shared.util.DocumentiPraticaUtil;
@ -28,7 +27,6 @@ import it.tref.liferay.portos.bo.shared.util.GenericUtils;
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants;
import it.tref.liferay.portos.bo.shared.util.TipoIntegrazioneUtil;
import it.tref.liferay.portos.bo.shared.util.TipoSoggettoUtil;
import it.tref.liferay.portos.bo.shared.util.Constants;
import it.tref.liferay.portos.bo.util.AsseverazioniUtil;
import java.io.IOException;
@ -39,6 +37,15 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
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.dao.orm.QueryUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
@ -47,10 +54,8 @@ import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.language.LanguageUtil;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.Http.FilePart;
import com.liferay.portal.kernel.util.Http.Options;
import com.liferay.portal.kernel.util.HttpUtil;
import com.liferay.portal.kernel.util.LocaleUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.UniqueList;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
@ -2476,27 +2481,23 @@ public class ValidazionePraticaUtil {
Company company = CompanyLocalServiceUtil.getCompany(companyId);
String urlPdfExtractor = (String) company.getExpandoBridge().getAttribute("url_pdf_extractor", false);
Options options = new Options();
options.setLocation(urlPdfExtractor);
options.setPost(true);
List<FilePart> fileParts = new ArrayList<>();
// Complimenti all'ignoto autore di questo magnifico TODO
// TODO perché cazzo non funziona il contentType???
FilePart filePart = new FilePart("file", fileName, fileBytes, "application/pkcs7-signature", "UTF-8");
fileParts.add(filePart);
options.setFileParts(fileParts);
String responseBody = HttpUtil.URLtoString(options);
if (options.getResponse().getResponseCode() == HttpServletResponse.SC_OK
|| options.getResponse().getResponseCode() == HttpServletResponse.SC_CREATED) {
HttpPost request = new HttpPost(urlPdfExtractor);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
builder.addPart("file", new ByteArrayBody(fileBytes, fileName));
request.setEntity(builder.build());
CloseableHttpClient client = HttpClientBuilder.create().build();
HttpResponse httpResponse = client.execute(request);
int statusCode = httpResponse.getStatusLine().getStatusCode();
String responseBody = EntityUtils.toString(httpResponse.getEntity(), StringPool.UTF8);
client.close();
if (statusCode == HttpServletResponse.SC_OK || statusCode == HttpServletResponse.SC_CREATED) {
JSONArray arrayFirme = JSONFactoryUtil.createJSONObject(responseBody).getJSONArray("cf");
List<String> cf = new UniqueList<String>();
for (int i = 0; i < arrayFirme.length(); i++) {
cf.add(arrayFirme.getString(i));
}
return cf;
} else {

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=2415
build.date=1600698455241
build.number=2426
build.date=1600769216546
build.auto.upgrade=true
##

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

File binario non mostrato.

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

File binario non mostrato.
Caricamento…
Annulla
Salva