Changed encoding from "UTF-8" to Latin1

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@179319 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-05-09 10:46:18 +00:00
parent 2def65fef9
commit 47a0c1b16d
5 changed files with 29 additions and 77 deletions

View File

@ -430,7 +430,7 @@ public class PerformFishAnnualAnalyticsController {
analyticsPanelResult.addSelectedKPIs(viewAnnualController.getSelectedKPIs());
//TODO COMMENTED NOW
analyticsPanelResult.addListBatchIds(Arrays.asList(theFocusValue));
analyticsPanelResult.addListFocusIds(Arrays.asList(theFocusValue));
analyticsPanelResult.addParameters(PerformFishAnalyticsConstant.DATA_INPUTS, mapParameters, viewAnnualController.getForm().getBatchType());

View File

@ -357,7 +357,7 @@ public class PerformFishAnalyticsController {
AnalyticsPanelResult analyticsPanelResult = new AnalyticsPanelResult();
analyticsPanelResult.addSelectedAreas(performFishRequestParameters.get(PerformFishAnalyticsConstant.PERFORM_FISH_AREA_PARAM));
analyticsPanelResult.addSelectedKPIs(selectedKPI);
analyticsPanelResult.addListBatchIds(batchIDs);
analyticsPanelResult.addListFocusIds(batchIDs);
analyticsPanelResult.addParameters(PerformFishAnalyticsConstant.DATA_INPUTS, mapParameters, viewController.getForm().getBatchType());
analyticsPanelResult.addResults(dmResponse);
submitRequestPanel.addWidget(analyticsPanelResult);
@ -374,7 +374,7 @@ public class PerformFishAnalyticsController {
AnalyticsPanelResult analyticsPanelResult = new AnalyticsPanelResult();
analyticsPanelResult.addSelectedAreas(performFishRequestParameters.get(PerformFishAnalyticsConstant.PERFORM_FISH_AREA_PARAM));
analyticsPanelResult.addSelectedKPIs(selectedKPI);
analyticsPanelResult.addListBatchIds(batchIDs);
analyticsPanelResult.addListFocusIds(batchIDs);
analyticsPanelResult.addParameters(PerformFishAnalyticsConstant.DATA_INPUTS, mapParameters, viewController.getForm().getBatchType());
submitRequestPanel.addWidget(analyticsPanelResult);
}catch (Exception e) {

View File

@ -338,7 +338,13 @@ public class AnalyticsPanelResult extends Composite {
// return foundKPI;
// }
public KPI getKPIForName(String name){
/**
* Gets the KPI for name.
*
* @param name the name
* @return the KPI for name
*/
public KPI getKPIForName(String name){
GWT.log("Searching KPI name: "+name);
KPI foundKPI = null;
@ -421,14 +427,14 @@ public class AnalyticsPanelResult extends Composite {
}
}
/**
* Adds the list batch ids.
* Adds the list focus ids.
*
* @param listBatchesID the list batches id
* @param listFocusIDs the list focus I ds
*/
public void addListBatchIds(List<String> listBatchesID){
for (String batchID : listBatchesID) {
public void addListFocusIds(List<String> listFocusIDs){
for (String batchID : listFocusIDs) {
field_list_focus_id_correlation.addItem(batchID, batchID);
}
}
@ -672,6 +678,13 @@ public class AnalyticsPanelResult extends Composite {
return kpiMapPointers.get(key);
}
/**
* Generate key.
*
* @param rowIndex the row index
* @param columnIndex the column index
* @return the string
*/
private String generateKey(int rowIndex, int columnIndex) {
return rowIndex+"-"+columnIndex;
}

View File

@ -448,73 +448,6 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
dmRequestParameters.putAll(mapParameters);
return callTheDataMinerPerformFishCorrelationAnalysis(peformFishReponse,dmRequestParameters);
//CALL HERE
/*
ServiceParameters dataMinerService = ContextUtil.getDataMinerService(this.getThreadLocalRequest());
log.info("Found DM service: "+dataMinerService.getUrl() + " int this scope: "+pContext.getCurrentScope());
// if(!ContextUtil.isWithinPortal()){
// dataMinerService = new ServiceParameters("http://dataminer-prototypes.d4science.org/wps/WebProcessingService", null, null, dmRequestParameters);
// log.info("I'm in TEST MODE replacing it with HARD CODED: "+dataMinerService);
// }
dataMinerService.setProperties(dmRequestParameters);
//Addding client parameters to DM service request
DMServiceResponse dmResponse = null;
String response;
try{
response = new HttpCallerUtil(dataMinerService.getUrl(), null, null).performGETRequestWithRetry(dmRequestParameters, pContext.getUserToken(), 5);
if(response==null){
log.error("The presponse returned is null");
throw new Exception("The presponse returned is null");
}
dmResponse = DataMinerUtil.parseResult(dataMinerService.getUrl(), response);
}catch(Exception e){
throw new Exception("The service did not produce any result. Change your selection and try again.");
}
if(dmResponse == null || dmResponse.isWithError())
throw new Exception("The response returned by DM service contains an Exception Status. (The call is: "+dmResponse.getHttpRequestURL()+"). Please report this issue at www.d4science.org/contact-us");
try{
DataMinerOutputData toDMOutputData = null;
List<DataMinerOutputData> listOut = dmResponse.getListDMOutputData();
for (DataMinerOutputData dataMinerOutputData : listOut) {
//I'm using this specific output data of DM
if(dataMinerOutputData.getFileDescription().contains("outputCharts")){
log.info("The output: "+dataMinerOutputData.getFileDescription()+ " with: "+dataMinerOutputData.getMimeType()+" is the candidate to unzip");
toDMOutputData = dataMinerOutputData;
break;
}
}
if(toDMOutputData==null || toDMOutputData.getPublicURL()==null)
throw new Exception("The response returned by DM service does not contain a file to unzip with name: 'outputCharts'. Please report this issue at www.d4science.org/contact-us");
String theZipFileURL = toDMOutputData.getPublicURL();
log.info("I'm using the file: "+theZipFileURL);
FileContentType filter = FileContentType.CSV;
ZipExtractorUtil zipExt = new ZipExtractorUtil(theZipFileURL, Arrays.asList(filter));
List<OutputFile> output = zipExt.getOutputFiles();
log.info("Extracted output of type {} as list {}: ",filter,output);
output = manageOutputsForPerformFishAnalysis(output);
log.info("Managed output of type {} as list {}: ",filter,output);
DataMinerResponse theDMResponse = new DataMinerResponse(peformFishReponse, output);
log.debug("Returning {}",theDMResponse);
return theDMResponse;
}catch(Exception e){
log.error("There was an error extracting the DataMiner response from your request: ", e);
throw new Exception("The service did not produce any result. Change your request and try again.");
} */
}
/* (non-Javadoc)

View File

@ -9,6 +9,7 @@ import java.util.Base64;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.Charsets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -44,7 +45,12 @@ public class UrlEncoderUtil {
try {
for (String value : parameters.get(key)) {
query+=String.format(key+"=%s", URLEncoder.encode(value, charset))+"&";
if(key.compareToIgnoreCase("DataInputs")==0) {
query+=String.format(key+"=%s", URLEncoder.encode(value, Charsets.ISO_8859_1.displayName()))+"&";
}else {
query+=String.format(key+"=%s", URLEncoder.encode(value, charset))+"&";
}
}
} catch (UnsupportedEncodingException e) {
logger.error("Error:", e);