Compare commits
No commits in common. "master" and "Feature/17249" have entirely different histories.
master
...
Feature/17
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/performfish-analytics-portlet-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/performfish-analytics-portlet-0.7.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/performfish-analytics-portlet-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/performfish-analytics-portlet-0.7.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -35,5 +35,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/performfish-analytics-portlet-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/performfish-analytics-portlet-0.7.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="performfish-analytics-portlet-1.0.0-SNAPSHOT">
|
||||
<wb-module deploy-name="performfish-analytics-portlet-0.7.0-SNAPSHOT">
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
|
45
CHANGELOG.md
45
CHANGELOG.md
|
@ -1,45 +0,0 @@
|
|||
# Changelog
|
||||
|
||||
|
||||
|
||||
## [v1.0.0] [r4.23.0] - 2020-05-28
|
||||
|
||||
### Features
|
||||
|
||||
- Added PDF support [#17249]
|
||||
|
||||
|
||||
## [v0.4.0] - 2019-11-07
|
||||
|
||||
### Features
|
||||
|
||||
- Enabled DEA Analysis [#17252]
|
||||
|
||||
|
||||
## [v0.3.0] - 2019-07-07
|
||||
|
||||
### Features
|
||||
|
||||
- Add numbers to correlation charts [#17247]
|
||||
- Change Speedometer to Performeter [#17225]
|
||||
- Added synoptic tables for Pre-grow and Hatchery [#17570]
|
||||
|
||||
|
||||
|
||||
## [v0.2.0] - 2019-06-07
|
||||
|
||||
### Features
|
||||
|
||||
- Release Synoptic table functionality [#17166]
|
||||
|
||||
|
||||
|
||||
## [v0.1.0] - 2019-05-07
|
||||
|
||||
### Features
|
||||
|
||||
- First Release
|
||||
|
||||
|
||||
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
@ -0,0 +1,56 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
|
||||
## [v1.0.0] - 2020-05-28
|
||||
|
||||
### Added
|
||||
|
||||
**Features**
|
||||
|
||||
[#17249] Added PDF support
|
||||
|
||||
|
||||
## [v0.4.0] - 2019-11-07
|
||||
|
||||
### Added
|
||||
|
||||
**Features**
|
||||
|
||||
[#17252] Enabled DEA Analysis
|
||||
|
||||
|
||||
## [v0.3.0] - 2019-07-07
|
||||
|
||||
### Added
|
||||
|
||||
**Features**
|
||||
|
||||
[#17247] Add numbers to correlation charts
|
||||
|
||||
[#17225] Change Speedometer to Performeter
|
||||
|
||||
[#17570] Added synoptic tables for Pre-grow and Hatchery
|
||||
|
||||
|
||||
|
||||
## [v0.2.0] - 2019-06-07
|
||||
|
||||
### Added
|
||||
|
||||
**Features**
|
||||
|
||||
[#17166] Release Synoptic table functionality
|
||||
|
||||
|
||||
|
||||
## [v0.1.0] - 2019-05-07
|
||||
|
||||
### Added
|
||||
|
||||
**Features**
|
||||
|
||||
first release
|
||||
|
|
@ -2,28 +2,28 @@
|
|||
<Changeset
|
||||
component="org.gcube.portlets.user.performfish-analytics-portlet.1-0-0"
|
||||
date="2020-05-28">
|
||||
<Change>Added PDF support [#17249]</Change>
|
||||
<Change>[#17249] Added PDF support</Change>
|
||||
</Changeset>
|
||||
<Changeset
|
||||
component="org.gcube.portlets.user.performfish-analytics-portlet.0-4-0"
|
||||
date="2019-11-07">
|
||||
<Change>Enabled DEA Analysis [#17252]</Change>
|
||||
<Change>[#17252] Enabled DEA Analysis</Change>
|
||||
</Changeset>
|
||||
<Changeset
|
||||
component="org.gcube.portlets.user.performfish-analytics-portlet.0-3-0"
|
||||
date="2019-07-07">
|
||||
<Change>Add numbers to correlation charts [#17247]</Change>
|
||||
<Change>Change Speedometer to Performeter [#17225]</Change>
|
||||
<Change>Added synoptic tables for Pre-grow and Hatchery [#17570]</Change>
|
||||
<Change>[#17247] Add numbers to correlation charts</Change>
|
||||
<Change>[#17225] Change Speedometer to Performeter</Change>
|
||||
<Change>[#17570] Added synoptic tables for Pre-grow and Hatchery</Change>
|
||||
</Changeset>
|
||||
<Changeset
|
||||
component="org.gcube.portlets.user.performfish-analytics-portlet.0-2-0"
|
||||
date="2019-06-07">
|
||||
<Change>Release Synoptic table functionality [#17166]</Change>
|
||||
<Change>[#17166] Release Synoptic table functionality</Change>
|
||||
</Changeset>
|
||||
<Changeset
|
||||
component="org.gcube.portlets.user.performfish-analytics-portlet.0-1-0"
|
||||
date="2019-05-07">
|
||||
<Change>First Release</Change>
|
||||
<Change>first release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<includes>
|
||||
<include>README.md</include>
|
||||
<include>LICENSE.md</include>
|
||||
<include>CHANGELOG.md</include>
|
||||
<include>profile.xml</include>
|
||||
<include>changelog.xml</include>
|
||||
</includes>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>performfish-analytics-portlet</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>PerformFish Analytics Portlet</name>
|
||||
|
||||
<scm>
|
||||
|
|
|
@ -237,7 +237,7 @@ public class CorrelationAnnualPanelResult extends Composite {
|
|||
public void addParameters(String keyToGet, Map<String, List<String>> parameters, String toShowBatchTypeValue) {
|
||||
|
||||
final FlexTable flexTable = new FlexTable();
|
||||
flexTable.getElement().setId("CorrelationAnnualParameterInputKPIs_"+requestId);
|
||||
flexTable.getElement().setId("CorrelationParameterInputKPIs");
|
||||
flexTable.setStyleName("colgrouptable");
|
||||
|
||||
try {
|
||||
|
@ -617,7 +617,7 @@ public class CorrelationAnnualPanelResult extends Composite {
|
|||
yPos += 4;
|
||||
|
||||
var correlationParametersInputKPIs = $doc
|
||||
.getElementById('CorrelationAnnualParameterInputKPIs_'+requestId);
|
||||
.getElementById('CorrelationParameterInputKPIs');
|
||||
|
||||
console.log('InputKPIs: ' + correlationParametersInputKPIs);
|
||||
|
||||
|
@ -631,9 +631,6 @@ public class CorrelationAnnualPanelResult extends Composite {
|
|||
fillColor : [ 211, 225, 241 ]
|
||||
}
|
||||
},
|
||||
bodyStyles : {
|
||||
minCellWidth: 20
|
||||
},
|
||||
html : correlationParametersInputKPIs
|
||||
|
||||
});
|
||||
|
|
|
@ -548,7 +548,7 @@ public class SpeedometerAnnualPanelResult {
|
|||
|
||||
}
|
||||
|
||||
if (i == outputIteration) {
|
||||
if (i == outputNumber) {
|
||||
|
||||
} else {
|
||||
if (pdfHeightInMM - yPos < pdfHeightInMM / 4) {
|
||||
|
|
|
@ -424,58 +424,51 @@ public class SynopticTableAnnualPanelResult {
|
|||
var checkColor = function(data) {
|
||||
if (data.section === 'body') {
|
||||
console.log(data);
|
||||
var good = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: limegreen; border: 1px solid limegreen;"></span></div>';
|
||||
var normal = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: yellow; border: 1px solid yellow;"></span></div>';
|
||||
var bad = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: red;border: 1px solid red;"></span></div>';
|
||||
|
||||
if (typeof data.cell !== 'undefined'
|
||||
&& data.cell !== null) {
|
||||
if (typeof data.cell.raw !== 'undefined'
|
||||
&& data.cell.raw !== null) {
|
||||
|
||||
console.log(data.cell.raw.innerHTML);
|
||||
|
||||
var good = 'background-color: limegreen;';
|
||||
var normal = 'background-color: yellow;';
|
||||
var bad = 'background-color: red;';
|
||||
|
||||
if (data.cell.raw.innerHTML
|
||||
.indexOf(good) >= 0) {
|
||||
if (data.cell.raw.innerHTML === good) {
|
||||
console.log('good');
|
||||
data.cell.styles.fillColor = [ 50,
|
||||
205, 50 ];
|
||||
|
||||
//var posIW = (data.cell.x
|
||||
// + (data.cell.width / 2) - 2);
|
||||
//var posIH = (data.cell.y
|
||||
// + (data.cell.height / 2) - 2);
|
||||
//var greenImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAbSM8+wB/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABBQIf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPwEf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPwEf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQAGPwIf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPyEf/9oADAMBAAIAAwAAABAAD//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8QH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8QH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8QH//Z'
|
||||
//pdoc.addImage(greenImg, 'JPEG',
|
||||
// posIW, posIH, 4, 4);
|
||||
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||
var greenImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAbSM8+wB/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABBQIf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPwEf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPwEf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQAGPwIf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPyEf/9oADAMBAAIAAwAAABAAD//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8QH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8QH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8QH//Z'
|
||||
pdoc.addImage(greenImg, 'JPEG', posIW, posIH, 4, 4);
|
||||
//pdoc.setFontSize(10);
|
||||
//pdoc.setFontType("normal");
|
||||
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||
//pdoc.text('G', posW, posH,'center');
|
||||
} else {
|
||||
if (data.cell.raw.innerHTML
|
||||
.indexOf(normal) >= 0) {
|
||||
if (data.cell.raw.innerHTML === normal) {
|
||||
console.log('normal');
|
||||
data.cell.styles.fillColor = [
|
||||
255, 255, 0 ];
|
||||
//var posIW = (data.cell.x
|
||||
// + (data.cell.width / 2) - 2);
|
||||
//var posIH = (data.cell.y
|
||||
// + (data.cell.height / 2) - 2);
|
||||
//var yellowImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAn/xAAWAQEBAQAAAAAAAAAAAAAAAAAABwr/2gAMAwEAAhADEAAAAbEZ/wCqAD//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAEFAh//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/AR//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/AR//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAY/Ah//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/IR//2gAMAwEAAgADAAAAEAAP/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPxAf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPxAf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPxAf/9k='
|
||||
//pdoc.addImage(yellowImg,
|
||||
// 'JPEG', posIW, posIH,
|
||||
// 4, 4);
|
||||
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||
var yellowImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAn/xAAWAQEBAQAAAAAAAAAAAAAAAAAABwr/2gAMAwEAAhADEAAAAbEZ/wCqAD//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAEFAh//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/AR//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/AR//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAY/Ah//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/IR//2gAMAwEAAgADAAAAEAAP/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPxAf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPxAf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPxAf/9k='
|
||||
pdoc.addImage(yellowImg, 'JPEG', posIW, posIH, 4, 4);
|
||||
//pdoc.setFontSize(10);
|
||||
//pdoc.setFontType("normal");
|
||||
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||
//pdoc.text('N', posW, posH,'center');
|
||||
} else {
|
||||
if (data.cell.raw.innerHTML
|
||||
.indexOf(bad) >= 0) {
|
||||
if (data.cell.raw.innerHTML === bad) {
|
||||
console.log('bad');
|
||||
data.cell.styles.fillColor = [
|
||||
255, 0, 0 ];
|
||||
//var posIW = (data.cell.x
|
||||
// + (data.cell.width / 2) - 2);
|
||||
//var posIH = (data.cell.y
|
||||
// + (data.cell.height / 2) - 2);
|
||||
//var redImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAj/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAYvlPfwAf//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAQUCH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8BH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8BH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEABj8CH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8hH//aAAwDAQACAAMAAAAQAA//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/EB//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/EB//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/EB//2Q=='
|
||||
//pdoc.addImage(redImg,
|
||||
// 'JPEG', posIW,
|
||||
// posIH, 4, 4);
|
||||
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||
var redImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAj/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAYvlPfwAf//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAQUCH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8BH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8BH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEABj8CH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8hH//aAAwDAQACAAMAAAAQAA//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/EB//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/EB//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/EB//2Q=='
|
||||
pdoc.addImage(redImg, 'JPEG', posIW, posIH, 4, 4);
|
||||
//pdoc.setFontSize(10);
|
||||
//pdoc.setFontType("normal");
|
||||
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||
//pdoc.text('B', posW, posH,'center');
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -494,11 +487,9 @@ public class SynopticTableAnnualPanelResult {
|
|||
startY : yPos,
|
||||
pageBreak : 'auto',
|
||||
bodyStyles : {
|
||||
fontSize : 6,
|
||||
minCellWidth : 11
|
||||
fontSize : 9
|
||||
},
|
||||
//didDrawCell : checkColor,
|
||||
didParseCell : checkColor,
|
||||
didDrawCell : checkColor,
|
||||
html : secondTable
|
||||
});
|
||||
|
||||
|
@ -538,7 +529,9 @@ public class SynopticTableAnnualPanelResult {
|
|||
console.log('Result Type is undefined:' + i);
|
||||
}
|
||||
|
||||
if (j == outputNumber) {
|
||||
}
|
||||
|
||||
if (i == outputNumber) {
|
||||
|
||||
} else {
|
||||
if (pdfHeightInMM - yPos < pdfHeightInMM / 7) {
|
||||
|
@ -549,8 +542,6 @@ public class SynopticTableAnnualPanelResult {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var numberOfPages = pdoc.internal.getNumberOfPages();
|
||||
console.log('NumberOfPages: ' + numberOfPages);
|
||||
for (var k = 1; k <= numberOfPages; k++) {
|
||||
|
|
|
@ -244,7 +244,7 @@ public class CorrelationPanelResult extends Composite {
|
|||
public void addParameters(String keyToGet, Map<String, List<String>> parameters, String toShowBatchTypeValue) {
|
||||
|
||||
final FlexTable flexTable = new FlexTable();
|
||||
flexTable.getElement().setId("CorrelationParameterInputKPIs_"+requestId);
|
||||
flexTable.getElement().setId("CorrelationParameterInputKPIs");
|
||||
flexTable.setStyleName("colgrouptable");
|
||||
|
||||
try {
|
||||
|
@ -301,12 +301,11 @@ public class CorrelationPanelResult extends Composite {
|
|||
|
||||
private String getOutputId() {
|
||||
outputNumber++;
|
||||
String outputId = "OutputId_" + requestId + "_" + outputNumber;
|
||||
String outputId = "OutputId_" + outputNumber;
|
||||
GWT.log("Generated OutputId: " + outputId);
|
||||
return outputId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the results.
|
||||
*
|
||||
|
@ -634,7 +633,7 @@ public class CorrelationPanelResult extends Composite {
|
|||
yPos += 4;
|
||||
|
||||
var correlationParametersInputKPIs = $doc
|
||||
.getElementById('CorrelationParameterInputKPIs_'+requestId);
|
||||
.getElementById('CorrelationParameterInputKPIs');
|
||||
|
||||
console.log('InputKPIs: ' + correlationParametersInputKPIs);
|
||||
|
||||
|
@ -648,9 +647,6 @@ public class CorrelationPanelResult extends Composite {
|
|||
fillColor : [ 211, 225, 241 ]
|
||||
}
|
||||
},
|
||||
bodyStyles : {
|
||||
minCellWidth: 20
|
||||
},
|
||||
html : correlationParametersInputKPIs
|
||||
|
||||
});
|
||||
|
|
|
@ -469,7 +469,7 @@ public class SpeedometerPanelResult {
|
|||
|
||||
}
|
||||
|
||||
if (i == outputIteration) {
|
||||
if (i == outputNumber) {
|
||||
|
||||
} else {
|
||||
if (pdfHeightInMM - yPos < pdfHeightInMM / 4) {
|
||||
|
|
|
@ -207,7 +207,7 @@ public class SynopticTablePanelResult {
|
|||
return;
|
||||
}
|
||||
|
||||
savePDFButton.setVisible(true);
|
||||
savePDFButton.setVisible(false);
|
||||
|
||||
final String toTitle = title;
|
||||
|
||||
|
@ -419,58 +419,51 @@ public class SynopticTablePanelResult {
|
|||
var checkColor = function(data) {
|
||||
if (data.section === 'body') {
|
||||
console.log(data);
|
||||
var good = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: limegreen; border: 1px solid limegreen;"></span></div>';
|
||||
var normal = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: yellow; border: 1px solid yellow;"></span></div>';
|
||||
var bad = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: red;border: 1px solid red;"></span></div>';
|
||||
|
||||
if (typeof data.cell !== 'undefined'
|
||||
&& data.cell !== null) {
|
||||
if (typeof data.cell.raw !== 'undefined'
|
||||
&& data.cell.raw !== null) {
|
||||
|
||||
console.log(data.cell.raw.innerHTML);
|
||||
|
||||
var good = 'background-color: limegreen;';
|
||||
var normal = 'background-color: yellow;';
|
||||
var bad = 'background-color: red;';
|
||||
|
||||
if (data.cell.raw.innerHTML
|
||||
.indexOf(good) >= 0) {
|
||||
if (data.cell.raw.innerHTML === good) {
|
||||
console.log('good');
|
||||
data.cell.styles.fillColor = [ 50,
|
||||
205, 50 ];
|
||||
|
||||
//var posIW = (data.cell.x
|
||||
// + (data.cell.width / 2) - 2);
|
||||
//var posIH = (data.cell.y
|
||||
// + (data.cell.height / 2) - 2);
|
||||
//var greenImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAbSM8+wB/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABBQIf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPwEf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPwEf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQAGPwIf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPyEf/9oADAMBAAIAAwAAABAAD//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8QH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8QH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8QH//Z'
|
||||
//pdoc.addImage(greenImg, 'JPEG',
|
||||
// posIW, posIH, 4, 4);
|
||||
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||
var greenImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAbSM8+wB/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABBQIf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPwEf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPwEf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQAGPwIf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPyEf/9oADAMBAAIAAwAAABAAD//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8QH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8QH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8QH//Z'
|
||||
pdoc.addImage(greenImg, 'JPEG', posIW, posIH, 4, 4);
|
||||
//pdoc.setFontSize(10);
|
||||
//pdoc.setFontType("normal");
|
||||
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||
//pdoc.text('G', posW, posH,'center');
|
||||
} else {
|
||||
if (data.cell.raw.innerHTML
|
||||
.indexOf(normal) >= 0) {
|
||||
if (data.cell.raw.innerHTML === normal) {
|
||||
console.log('normal');
|
||||
data.cell.styles.fillColor = [
|
||||
255, 255, 0 ];
|
||||
//var posIW = (data.cell.x
|
||||
// + (data.cell.width / 2) - 2);
|
||||
//var posIH = (data.cell.y
|
||||
// + (data.cell.height / 2) - 2);
|
||||
//var yellowImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAn/xAAWAQEBAQAAAAAAAAAAAAAAAAAABwr/2gAMAwEAAhADEAAAAbEZ/wCqAD//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAEFAh//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/AR//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/AR//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAY/Ah//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/IR//2gAMAwEAAgADAAAAEAAP/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPxAf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPxAf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPxAf/9k='
|
||||
//pdoc.addImage(yellowImg,
|
||||
// 'JPEG', posIW, posIH,
|
||||
// 4, 4);
|
||||
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||
var yellowImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAn/xAAWAQEBAQAAAAAAAAAAAAAAAAAABwr/2gAMAwEAAhADEAAAAbEZ/wCqAD//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAEFAh//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/AR//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/AR//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAY/Ah//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/IR//2gAMAwEAAgADAAAAEAAP/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPxAf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPxAf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPxAf/9k='
|
||||
pdoc.addImage(yellowImg, 'JPEG', posIW, posIH, 4, 4);
|
||||
//pdoc.setFontSize(10);
|
||||
//pdoc.setFontType("normal");
|
||||
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||
//pdoc.text('N', posW, posH,'center');
|
||||
} else {
|
||||
if (data.cell.raw.innerHTML
|
||||
.indexOf(bad) >= 0) {
|
||||
if (data.cell.raw.innerHTML === bad) {
|
||||
console.log('bad');
|
||||
data.cell.styles.fillColor = [
|
||||
255, 0, 0 ];
|
||||
//var posIW = (data.cell.x
|
||||
// + (data.cell.width / 2) - 2);
|
||||
//var posIH = (data.cell.y
|
||||
// + (data.cell.height / 2) - 2);
|
||||
//var redImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAj/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAYvlPfwAf//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAQUCH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8BH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8BH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEABj8CH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8hH//aAAwDAQACAAMAAAAQAA//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/EB//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/EB//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/EB//2Q=='
|
||||
//pdoc.addImage(redImg,
|
||||
// 'JPEG', posIW,
|
||||
// posIH, 4, 4);
|
||||
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||
var redImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAj/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAYvlPfwAf//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAQUCH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8BH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8BH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEABj8CH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8hH//aAAwDAQACAAMAAAAQAA//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/EB//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/EB//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/EB//2Q=='
|
||||
pdoc.addImage(redImg, 'JPEG', posIW, posIH, 4, 4);
|
||||
//pdoc.setFontSize(10);
|
||||
//pdoc.setFontType("normal");
|
||||
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||
//pdoc.text('B', posW, posH,'center');
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -489,11 +482,9 @@ public class SynopticTablePanelResult {
|
|||
startY : yPos,
|
||||
pageBreak : 'auto',
|
||||
bodyStyles : {
|
||||
fontSize : 6,
|
||||
minCellWidth : 11
|
||||
fontSize : 9
|
||||
},
|
||||
//didDrawCell : checkColor,
|
||||
didParseCell : checkColor,
|
||||
didDrawCell : checkColor,
|
||||
html : secondTable
|
||||
});
|
||||
|
||||
|
@ -533,7 +524,9 @@ public class SynopticTablePanelResult {
|
|||
console.log('Result Type is undefined:' + i);
|
||||
}
|
||||
|
||||
if (j == outputNumber) {
|
||||
}
|
||||
|
||||
if (i == outputNumber) {
|
||||
|
||||
} else {
|
||||
if (pdfHeightInMM - yPos < pdfHeightInMM / 7) {
|
||||
|
@ -544,8 +537,6 @@ public class SynopticTablePanelResult {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var numberOfPages = pdoc.internal.getNumberOfPages();
|
||||
console.log('NumberOfPages: ' + numberOfPages);
|
||||
for (var k = 1; k <= numberOfPages; k++) {
|
||||
|
|
|
@ -67,11 +67,13 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
|||
* Jan 16, 2019
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implements PerformFishAnalyticsService {
|
||||
public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
|
||||
implements PerformFishAnalyticsService {
|
||||
|
||||
/** The log. */
|
||||
protected static Logger log = LoggerFactory.getLogger(PerformFishAnalyticsServiceImpl.class);
|
||||
|
||||
|
||||
/** The date format. */
|
||||
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy 'at' HH:mm:ss-SSS z");
|
||||
|
||||
|
@ -82,22 +84,20 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
private EntityManagerFactory getDBFactory() throws Exception {
|
||||
private EntityManagerFactory getDBFactory()
|
||||
throws Exception {
|
||||
|
||||
if(ContextUtil.isSessionExpired(this.getThreadLocalRequest()))
|
||||
throw new SessionExpired("The session is expired");
|
||||
|
||||
// PortalContextInfo pContext =
|
||||
// ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
//PortalContextInfo pContext = ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
EntityManagerFactoryCreator.instanceLocalMode();
|
||||
EntityManagerFactory dbFactory = EntityManagerFactoryCreator.getEntityManagerFactory();
|
||||
new DatabaseUtil().fillDatabaseIfEmpty(dbFactory, this.getThreadLocalRequest().getServletContext());
|
||||
return dbFactory;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
/* (non-Javadoc)
|
||||
* @see javax.servlet.GenericServlet#destroy()
|
||||
*/
|
||||
@Override
|
||||
|
@ -108,10 +108,8 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
EntityManagerFactoryCreator.instanceLocalMode();
|
||||
EntityManagerFactory dbFactory = EntityManagerFactoryCreator.getEntityManagerFactory();
|
||||
dbFactory.close();
|
||||
// String dbFolderPath =
|
||||
// EntityManagerFactoryCreator.getPersistenceFolderPath();
|
||||
// FileUtil.deleteDirectoryRecursion(new
|
||||
// File(dbFolderPath).toPath());
|
||||
// String dbFolderPath = EntityManagerFactoryCreator.getPersistenceFolderPath();
|
||||
// FileUtil.deleteDirectoryRecursion(new File(dbFolderPath).toPath());
|
||||
log.info("DB Factory closed correctly");
|
||||
}catch(Exception e){
|
||||
log.info("Error occurred on closing the DB Factory: ",e);
|
||||
|
@ -136,7 +134,8 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
|
||||
try{
|
||||
EntityManagerFactory dbFactory = getDBFactory();
|
||||
GenericPersistenceDaoBuilder<Population> builderPopulation = new GenericPersistenceDaoBuilder<Population>(
|
||||
GenericPersistenceDaoBuilder<Population> builderPopulation =
|
||||
new GenericPersistenceDaoBuilder<Population>(
|
||||
dbFactory, Population.class.getSimpleName());
|
||||
List<Population> listPopulation = builderPopulation.getPersistenceEntity().getList();
|
||||
log.info("List of {} are: {}",Population.class.getSimpleName(),listPopulation);
|
||||
|
@ -151,10 +150,8 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
}
|
||||
|
||||
List<PopulationType> listPopulationTypeDTO = ToAvoidIndirectSerialization
|
||||
.toGWTSerializable(listPopulationType, population, true);
|
||||
log.info("Returning " + listPopulationTypeDTO.size() + " type/s for population name: "
|
||||
+ populationName);
|
||||
List<PopulationType> listPopulationTypeDTO = ToAvoidIndirectSerialization.toGWTSerializable(listPopulationType, population, true);
|
||||
log.info("Returning "+listPopulationTypeDTO.size()+ " type/s for population name: "+populationName);
|
||||
return listPopulationTypeDTO;
|
||||
}
|
||||
}
|
||||
|
@ -167,12 +164,8 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.
|
||||
* PerformFishAnalyticsService#getPopulationTypeWithListKPI(java.lang.
|
||||
* String)
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsService#getPopulationTypeWithListKPI(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public PopulationType getPopulationTypeWithListKPI(String populationTypeId) throws Exception{
|
||||
|
@ -183,7 +176,8 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
|
||||
try{
|
||||
EntityManagerFactory dbFactory = getDBFactory();
|
||||
GenericPersistenceDaoBuilder<PopulationType> builderPopulationType = new GenericPersistenceDaoBuilder<PopulationType>(
|
||||
GenericPersistenceDaoBuilder<PopulationType> builderPopulationType =
|
||||
new GenericPersistenceDaoBuilder<PopulationType>(
|
||||
dbFactory, PopulationType.class.getSimpleName());
|
||||
|
||||
Map<String, String> filterMap = new HashMap<String, String>();
|
||||
|
@ -198,17 +192,12 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
List<KPI> listGWTKPI = new ArrayList<KPI>(selectedPopType.getListKPI().size());
|
||||
for (KPI toKPI : selectedPopType.getListKPI()) {
|
||||
KPI gwtKPI = convert(toKPI);
|
||||
gwtKPI.setPopulationType(selectedPopType);// I'm setting
|
||||
// population type
|
||||
// only at first
|
||||
// level
|
||||
// gwtKPI.setLeaf(toKPI.getListKPI()==null ||
|
||||
// toKPI.getListKPI().isEmpty());
|
||||
gwtKPI.setPopulationType(selectedPopType);//I'm setting population type only at first level
|
||||
//gwtKPI.setLeaf(toKPI.getListKPI()==null || toKPI.getListKPI().isEmpty());
|
||||
listGWTKPI.add(gwtKPI);
|
||||
}
|
||||
|
||||
List<PopulationType> listPopulationTypeDTO = ToAvoidIndirectSerialization.toGWTSerializable(listPopType,
|
||||
null, false);
|
||||
List<PopulationType> listPopulationTypeDTO = ToAvoidIndirectSerialization.toGWTSerializable(listPopType, null, false);
|
||||
PopulationType toReturn = listPopulationTypeDTO.get(0);
|
||||
toReturn.setListKPI(listGWTKPI);
|
||||
|
||||
|
@ -217,8 +206,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
log.debug(kpi.toString());
|
||||
}
|
||||
}
|
||||
log.info("Returning type " + toReturn.getName() + " having list of KPI count: "
|
||||
+ toReturn.getListKPI().size());
|
||||
log.info("Returning type "+toReturn.getName()+" having list of KPI count: "+toReturn.getListKPI().size());
|
||||
return toReturn;
|
||||
}catch(Exception e){
|
||||
log.error("Error on loading list of KPI for popluation type with id: "+populationTypeId, e);
|
||||
|
@ -229,8 +217,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
/**
|
||||
* Convert.
|
||||
*
|
||||
* @param kpi
|
||||
* the kpi
|
||||
* @param kpi the kpi
|
||||
* @return the kpi
|
||||
*/
|
||||
private KPI convert(KPI kpi){
|
||||
|
@ -261,38 +248,33 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
/**
|
||||
* Gets the gwtkpi.
|
||||
*
|
||||
* @param toKPI
|
||||
* the to kpi
|
||||
* @param populationType
|
||||
* the population type
|
||||
* @param toKPI the to kpi
|
||||
* @param populationType the population type
|
||||
* @return the gwtkpi
|
||||
*/
|
||||
private KPI getGWTKPI(KPI toKPI, PopulationType populationType){
|
||||
KPI gwtKPI = new KPI(toKPI.getId(), toKPI.getCode(), toKPI.getName(), toKPI.getDescription(), null,
|
||||
populationType, toKPI.getDeepIndex());
|
||||
KPI gwtKPI = new KPI(toKPI.getId(),toKPI.getCode(),toKPI.getName(),toKPI.getDescription(), null,populationType,toKPI.getDeepIndex());
|
||||
gwtKPI.setLeaf(toKPI.getListKPI()==null || toKPI.getListKPI().isEmpty());
|
||||
return gwtKPI;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check grant to access farm id.
|
||||
*
|
||||
* @param farmID
|
||||
* the farm id
|
||||
* @param farmID the farm id
|
||||
* @return true, if successful
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public boolean checkGrantToAccessFarmID(String farmID) throws Exception{
|
||||
try {
|
||||
|
||||
if(ContextUtil.isSessionExpired(this.getThreadLocalRequest()))
|
||||
throw new SessionExpired("The session is expired");
|
||||
|
||||
log.info("Checking the rights to access the farmID {} for current user",farmID);
|
||||
if(ContextUtil.isWithinPortal()){
|
||||
log.info("On Portal");
|
||||
GCubeUser currentUser = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
||||
long userId = currentUser.getUserId();
|
||||
log.info("User {} has the userId {}",currentUser.getUsername(), userId);
|
||||
|
@ -306,8 +288,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
log.debug("Parsed FARM_ID as long is: "+farmId);
|
||||
|
||||
if(farmId == -1){
|
||||
throw new Exception(
|
||||
"Your input farm ID seems to be not valid. Please contact the D4Science support");
|
||||
throw new Exception("Your input farm ID seems to be not valid. Please contact the D4Science support");
|
||||
}
|
||||
|
||||
long groupId;
|
||||
|
@ -315,8 +296,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
groupId = PortalContext.getConfiguration().getCurrentGroupId(this.getThreadLocalRequest());
|
||||
} catch (Exception e) {
|
||||
log.error("Error getting the group id: ",e);
|
||||
throw new Exception(
|
||||
"Your input farm ID seems to be not valid. Please contact the D4Science support");
|
||||
throw new Exception("Your input farm ID seems to be not valid. Please contact the D4Science support");
|
||||
}
|
||||
log.debug("The group id is: "+groupId);
|
||||
|
||||
|
@ -340,24 +320,15 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
log.info("I'm in testing mode, grant the rights to access the farmID {} for current user",farmID);
|
||||
return true;
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getLocalizedMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.
|
||||
* PerformFishAnalyticsService#validParameters(org.gcube.portlets.user.
|
||||
* performfishanalytics.shared.performfishservice.PerformFishInitParameter)
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsService#validParameters(org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishInitParameter)
|
||||
*/
|
||||
@Override
|
||||
public PerformFishInitParameter validParameters(PerformFishInitParameter initParams) throws Exception{
|
||||
|
||||
try {
|
||||
Map<String, String> inputParameters = initParams.getParameters();
|
||||
String farmID = inputParameters.get(PerformFishAnalyticsConstant.PERFORM_FISH_FARMID_PARAM);
|
||||
boolean grantAccess = checkGrantToAccessFarmID(farmID);
|
||||
|
@ -365,39 +336,30 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
throw new Exception("You have no rights to access to this FARM. You does not belong to it.");
|
||||
|
||||
return initParams;
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getLocalizedMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.
|
||||
* PerformFishAnalyticsService#submitRequestToPerformFishService(java.util.
|
||||
* Map)
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsService#submitRequestToPerformFishService(java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public PerformFishResponse submitRequestToPerformFishService(Map<String, List<String>> mapParameters)
|
||||
throws Exception {
|
||||
try {
|
||||
public PerformFishResponse submitRequestToPerformFishService(Map<String, List<String>> mapParameters) throws Exception{
|
||||
|
||||
log.info("Submitting request with parameters: "+mapParameters);
|
||||
ServiceParameters performFishService = null;
|
||||
try{
|
||||
performFishService = ContextUtil.getPerformFishService(this.getThreadLocalRequest());
|
||||
}catch (Exception e) {
|
||||
log.error("Error on getting the perform fish service from IS: "+performFishService, e);
|
||||
throw new Exception("Error on getting the perform fish service from IS: " + performFishService
|
||||
+ " Please contact the suport");
|
||||
throw new Exception("Error on getting the perform fish service from IS: "+performFishService+" Please contact the suport");
|
||||
}
|
||||
|
||||
String serviceURL = performFishService.getUrl() + "/performance";
|
||||
log.debug("Calling service: "+serviceURL);
|
||||
HttpCallerUtil httpCaller = new HttpCallerUtil(serviceURL, null, null);
|
||||
String gCubeToken = ContextUtil.getPortalContext(this.getThreadLocalRequest()).getUserToken();
|
||||
// mapParameters.put("gcube-token",
|
||||
// Arrays.asList(ContextUtil.getPortalContext(this.getThreadLocalRequest()).getUserToken()));
|
||||
//mapParameters.put("gcube-token", Arrays.asList(ContextUtil.getPortalContext(this.getThreadLocalRequest()).getUserToken()));
|
||||
String response;
|
||||
try {
|
||||
Date startTime = getCurrentTimeToDate(System.currentTimeMillis());
|
||||
|
@ -405,10 +367,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
response = httpCaller.callGet(null, mapParameters, gCubeToken);
|
||||
Date endTime = getCurrentTimeToDate(System.currentTimeMillis());
|
||||
log.info("The response is: "+response +" with status: "+httpCaller.getStatusCode());
|
||||
log.info(
|
||||
"The perform-fish response returned just now {}. Response returned in {} "
|
||||
+ TimeUnit.MILLISECONDS.toString(),
|
||||
dateFormat.format(endTime), getDateDiff(startTime, endTime, TimeUnit.MILLISECONDS));
|
||||
log.info("The perform-fish response returned just now {}. Response returned in {} "+ TimeUnit.MILLISECONDS.toString(), dateFormat.format(endTime), getDateDiff(startTime, endTime, TimeUnit.MILLISECONDS));
|
||||
|
||||
if(response==null)
|
||||
throw new Exception("The response is null");
|
||||
|
@ -419,25 +378,21 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
UUID respSessionID = UUID.randomUUID();
|
||||
//ContextUtil.getPerformFishService(UUID.randomUUID());
|
||||
return new PerformFishResponse(theResponseParams, respSessionID.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("Error interacting with the service: " + performFishService.getUrl() + " with parameters: "
|
||||
+ mapParameters, e);
|
||||
throw new Exception(
|
||||
"There was an error interacting with the " + ContextUtil.PERFORM_SERVICE + " in this VRE ("
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("Error interacting with the service: "+performFishService.getUrl() +" with parameters: "+mapParameters, e);
|
||||
throw new Exception("There was an error interacting with the "+ContextUtil.PERFORM_SERVICE+" in this VRE ("
|
||||
+ ContextUtil.getPortalContext(this.getThreadLocalRequest()).getCurrentScope()+ ")"
|
||||
+ ". Please report this issue at www.d4science.org/contact-us");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getLocalizedMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current time to date.
|
||||
*
|
||||
* @param currentTime
|
||||
* the current time
|
||||
* @param currentTime the current time
|
||||
* @return the current time to date
|
||||
*/
|
||||
private Date getCurrentTimeToDate(long currentTime) {
|
||||
|
@ -449,218 +404,149 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
/**
|
||||
* Get a diff between two dates.
|
||||
*
|
||||
* @param date1
|
||||
* the oldest date
|
||||
* @param date2
|
||||
* the newest date
|
||||
* @param timeUnit
|
||||
* the unit in which you want the diff
|
||||
* @param date1 the oldest date
|
||||
* @param date2 the newest date
|
||||
* @param timeUnit the unit in which you want the diff
|
||||
* @return the diff value, in the provided unit
|
||||
*/
|
||||
private static long getDateDiff(Date date1, Date date2, TimeUnit timeUnit) {
|
||||
public static long getDateDiff(Date date1, Date date2, TimeUnit timeUnit) {
|
||||
long diffInMillies = date2.getTime() - date1.getTime();
|
||||
return timeUnit.convert(diffInMillies,TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.
|
||||
* PerformFishAnalyticsService#
|
||||
* callingDataMinerPerformFishCorrelationAnalysis(org.gcube.portlets.user.
|
||||
* performfishanalytics.shared.performfishservice.PerformFishResponse,
|
||||
* java.util.Map)
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsService#callingDataMinerPerformFishCorrelationAnalysis(org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishResponse, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public DataMinerResponse callingDataMinerPerformFishCorrelationAnalysis(PerformFishResponse peformFishReponse,
|
||||
Map<String, List<String>> mapParameters) throws Exception {
|
||||
try {
|
||||
public DataMinerResponse callingDataMinerPerformFishCorrelationAnalysis(PerformFishResponse peformFishReponse, Map<String, List<String>> mapParameters) throws Exception{
|
||||
|
||||
log.info("Validating Perform-Fish service response...");
|
||||
|
||||
String URLToBatchesTable = peformFishReponse.getMapParameters()
|
||||
.get(PerformFishAnalyticsConstant.BATCHES_TABLE);
|
||||
String URLToBatchesTable = peformFishReponse.getMapParameters().get(PerformFishAnalyticsConstant.BATCHES_TABLE);
|
||||
|
||||
if(URLToBatchesTable==null || URLToBatchesTable.isEmpty())
|
||||
throw new Exception(
|
||||
"Something seems " + PerformFishAnalyticsConstant.BATCHES_TABLE + " is null or emty");
|
||||
throw new Exception("Something seems "+PerformFishAnalyticsConstant.BATCHES_TABLE+ " is null or emty");
|
||||
|
||||
// Checking that the perform-fish
|
||||
// PerformFishAnalyticsConstant.BATCHES_TABLE has at least 1 row
|
||||
//Checking that the perform-fish PerformFishAnalyticsConstant.BATCHES_TABLE has at least 1 row
|
||||
CSVFile csvFile = readCSVFile(URLToBatchesTable);
|
||||
log.info("CSVFile read from {} - {}", URLToBatchesTable, csvFile);
|
||||
if (csvFile == null || csvFile.getValueRows() == null
|
||||
|| csvFile.getValueRows().size() < PerformFishAnalyticsConstant.CSV_BATCHES_TABLE_MINIMUM_SIZE) {
|
||||
log.warn("The " + PerformFishAnalyticsConstant.BATCHES_TABLE + " CSV rows are" + csvFile.getValueRows()
|
||||
+ ". It is less than " + PerformFishAnalyticsConstant.CSV_BATCHES_TABLE_MINIMUM_SIZE);
|
||||
throw new Exception(
|
||||
"Your request does not produce enough data for the analysis, please change your selection and try again");
|
||||
if(csvFile==null || csvFile.getValueRows() == null || csvFile.getValueRows().size()<PerformFishAnalyticsConstant.CSV_BATCHES_TABLE_MINIMUM_SIZE){
|
||||
log.warn("The "+PerformFishAnalyticsConstant.BATCHES_TABLE+" CSV rows are"+csvFile.getValueRows()+". It is less than "+PerformFishAnalyticsConstant.CSV_BATCHES_TABLE_MINIMUM_SIZE);
|
||||
throw new Exception("Your request does not produce enough data for the analysis, please change your selection and try again");
|
||||
}
|
||||
|
||||
log.info("Calling the DM service with client parameters: "+mapParameters.toString());
|
||||
// PortalContextInfo pContext =
|
||||
// ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
//PortalContextInfo pContext = ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
Map<String, List<String>> dmRequestParameters = new HashMap<String, List<String>>();
|
||||
dmRequestParameters.put("request", Arrays.asList("Execute"));
|
||||
dmRequestParameters.put("service", Arrays.asList("WPS"));
|
||||
dmRequestParameters.put("Version", Arrays.asList("1.0.0"));
|
||||
// dmRequestParameters.put("gcube-token",
|
||||
// Arrays.asList(pContext.getUserToken()));
|
||||
//dmRequestParameters.put("gcube-token", Arrays.asList(pContext.getUserToken()));
|
||||
dmRequestParameters.put("lang", Arrays.asList("en-US"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList(
|
||||
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_ANALYSIS"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_ANALYSIS"));
|
||||
dmRequestParameters.putAll(mapParameters);
|
||||
|
||||
return callTheDataMinerPerformFishCorrelationAnalysis(peformFishReponse,dmRequestParameters);
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getLocalizedMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.
|
||||
* PerformFishAnalyticsService#
|
||||
* callingDataMinerPerformFishCorrelationAnalysis(org.gcube.portlets.user.
|
||||
* performfishanalytics.shared.performfishservice.PerformFishResponse,
|
||||
* java.util.Map)
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsService#callingDataMinerPerformFishCorrelationAnalysis(org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishResponse, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public DataMinerResponse callingDataMinerPerformFishAnnualCorrelationAnalysis(PerformFishResponse peformFishReponse,
|
||||
Map<String, List<String>> mapParameters) throws Exception {
|
||||
try {
|
||||
public DataMinerResponse callingDataMinerPerformFishAnnualCorrelationAnalysis(PerformFishResponse peformFishReponse, Map<String, List<String>> mapParameters) throws Exception{
|
||||
|
||||
log.info("Calling the DM service with client parameters: "+mapParameters.toString());
|
||||
// PortalContextInfo pContext =
|
||||
// ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
//PortalContextInfo pContext = ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
Map<String, List<String>> dmRequestParameters = new HashMap<String, List<String>>();
|
||||
dmRequestParameters.put("request", Arrays.asList("Execute"));
|
||||
dmRequestParameters.put("service", Arrays.asList("WPS"));
|
||||
dmRequestParameters.put("Version", Arrays.asList("1.0.0"));
|
||||
// dmRequestParameters.put("gcube-token",
|
||||
// Arrays.asList(pContext.getUserToken()));
|
||||
//dmRequestParameters.put("gcube-token", Arrays.asList(pContext.getUserToken()));
|
||||
dmRequestParameters.put("lang", Arrays.asList("en-US"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList(
|
||||
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_ANALYSIS_ANNUAL"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_ANALYSIS_ANNUAL"));
|
||||
dmRequestParameters.putAll(mapParameters);
|
||||
|
||||
return callTheDataMinerPerformFishCorrelationAnalysis(peformFishReponse,dmRequestParameters);
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getLocalizedMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataMinerResponse callDMServiceToLoadSynopticTable(PerformFishResponse performFishResponse,
|
||||
Map<String, List<String>> mapParameters) throws Exception{
|
||||
try {
|
||||
|
||||
log.info("Validating Perform-Fish service response...");
|
||||
|
||||
String URLToBatchesTable = performFishResponse.getMapParameters()
|
||||
.get(PerformFishAnalyticsConstant.BATCHES_TABLE);
|
||||
String URLToBatchesTable = performFishResponse.getMapParameters().get(PerformFishAnalyticsConstant.BATCHES_TABLE);
|
||||
|
||||
if(URLToBatchesTable==null || URLToBatchesTable.isEmpty())
|
||||
throw new Exception(
|
||||
"Something seems " + PerformFishAnalyticsConstant.BATCHES_TABLE + " is null or emty");
|
||||
throw new Exception("Something seems "+PerformFishAnalyticsConstant.BATCHES_TABLE+ " is null or emty");
|
||||
|
||||
// Checking that the perform-fish
|
||||
// PerformFishAnalyticsConstant.BATCHES_TABLE has at least 1 row
|
||||
//Checking that the perform-fish PerformFishAnalyticsConstant.BATCHES_TABLE has at least 1 row
|
||||
// CSVFile csvFile = readCSVFile(URLToBatchesTable);
|
||||
// log.info("CSVFile read from {} - {}", URLToBatchesTable,
|
||||
// csvFile);
|
||||
// if(csvFile==null || csvFile.getValueRows() == null ||
|
||||
// csvFile.getValueRows().size()<PerformFishAnalyticsConstant.CSV_BATCHES_TABLE_MINIMUM_SIZE){
|
||||
// log.warn("The "+PerformFishAnalyticsConstant.BATCHES_TABLE+" CSV
|
||||
// rows
|
||||
// are"+csvFile.getValueRows()+". It is less than
|
||||
// "+PerformFishAnalyticsConstant.CSV_BATCHES_TABLE_MINIMUM_SIZE);
|
||||
// throw new Exception("Your request does not produce enough data
|
||||
// for
|
||||
// the analysis, please change your selection and try again");
|
||||
// log.info("CSVFile read from {} - {}", URLToBatchesTable, csvFile);
|
||||
// if(csvFile==null || csvFile.getValueRows() == null || csvFile.getValueRows().size()<PerformFishAnalyticsConstant.CSV_BATCHES_TABLE_MINIMUM_SIZE){
|
||||
// log.warn("The "+PerformFishAnalyticsConstant.BATCHES_TABLE+" CSV rows are"+csvFile.getValueRows()+". It is less than "+PerformFishAnalyticsConstant.CSV_BATCHES_TABLE_MINIMUM_SIZE);
|
||||
// throw new Exception("Your request does not produce enough data for the analysis, please change your selection and try again");
|
||||
// }
|
||||
|
||||
log.info("Calling the DM service with client parameters: "+mapParameters.toString());
|
||||
// PortalContextInfo pContext =
|
||||
// ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
//PortalContextInfo pContext = ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
Map<String, List<String>> dmRequestParameters = new HashMap<String, List<String>>();
|
||||
dmRequestParameters.put("request", Arrays.asList("Execute"));
|
||||
dmRequestParameters.put("service", Arrays.asList("WPS"));
|
||||
dmRequestParameters.put("Version", Arrays.asList("1.0.0"));
|
||||
// dmRequestParameters.put("gcube-token",
|
||||
// Arrays.asList(pContext.getUserToken()));
|
||||
//dmRequestParameters.put("gcube-token", Arrays.asList(pContext.getUserToken()));
|
||||
dmRequestParameters.put("lang", Arrays.asList("en-US"));
|
||||
// dmRequestParameters.put("Identifier",
|
||||
// Arrays.asList("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_SYNOPTICTABLE_BATCH"));
|
||||
//dmRequestParameters.put("Identifier", Arrays.asList("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_SYNOPTICTABLE_BATCH"));
|
||||
dmRequestParameters.putAll(mapParameters);
|
||||
return callTheDataMiner(dmRequestParameters);
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getLocalizedMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataMinerResponse callDMServiceToLoadSynopticAnnualTable(PerformFishResponse thePerformFishResponse,
|
||||
Map<String, List<String>> mapParameters) throws Exception {
|
||||
try {
|
||||
|
||||
log.info("Validating Perform-Fish service response...");
|
||||
|
||||
log.info("Calling the DM service with client parameters: "+mapParameters.toString());
|
||||
// PortalContextInfo pContext =
|
||||
// ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
//PortalContextInfo pContext = ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
Map<String, List<String>> dmRequestParameters = new HashMap<String, List<String>>();
|
||||
dmRequestParameters.put("request", Arrays.asList("Execute"));
|
||||
dmRequestParameters.put("service", Arrays.asList("WPS"));
|
||||
dmRequestParameters.put("Version", Arrays.asList("1.0.0"));
|
||||
// dmRequestParameters.put("gcube-token",
|
||||
// Arrays.asList(pContext.getUserToken()));
|
||||
//dmRequestParameters.put("gcube-token", Arrays.asList(pContext.getUserToken()));
|
||||
dmRequestParameters.put("lang", Arrays.asList("en-US"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList(
|
||||
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_SYNOPTIC_TABLE_FARM"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_SYNOPTIC_TABLE_FARM"));
|
||||
dmRequestParameters.putAll(mapParameters);
|
||||
return callTheDataMiner(dmRequestParameters);
|
||||
}
|
||||
|
||||
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getLocalizedMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the data miner perform fish correlation analysis.
|
||||
*
|
||||
* @param peformFishReponse
|
||||
* the peform fish reponse
|
||||
* @param mapParameters
|
||||
* the map parameters
|
||||
* @param peformFishReponse the peform fish reponse
|
||||
* @param mapParameters the map parameters
|
||||
* @return the data miner response
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
private DataMinerResponse callTheDataMinerPerformFishCorrelationAnalysis(PerformFishResponse peformFishReponse,
|
||||
Map<String, List<String>> dmRequestParameters) throws Exception {
|
||||
private DataMinerResponse callTheDataMinerPerformFishCorrelationAnalysis(PerformFishResponse peformFishReponse, Map<String, List<String>> dmRequestParameters) throws Exception{
|
||||
|
||||
PortalContextInfo pContext = ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
|
||||
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 = 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);
|
||||
//Asdding client parameters to DM service request
|
||||
DMServiceResponse dmResponse = null;
|
||||
String response;
|
||||
try{
|
||||
response = new HttpCallerUtil(dataMinerService.getUrl(), null, null)
|
||||
.performGETRequestWithRetry(dmRequestParameters, pContext.getUserToken(), 5);
|
||||
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");
|
||||
|
@ -671,9 +557,9 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
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");
|
||||
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{
|
||||
|
||||
|
@ -682,16 +568,14 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
for (DataMinerOutputData dataMinerOutputData : listOut) {
|
||||
//I'm using this specific output data of DM
|
||||
if(dataMinerOutputData.getFileDescription().toLowerCase().contains("outputcharts")){
|
||||
log.info("The output: " + dataMinerOutputData.getFileDescription() + " with: "
|
||||
+ dataMinerOutputData.getMimeType() + " is the candidate to unzip");
|
||||
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");
|
||||
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);
|
||||
|
@ -715,18 +599,12 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.
|
||||
* PerformFishAnalyticsService#callingDataMinerPerformFishAnalysis(org.gcube
|
||||
* .portlets.user.performfishanalytics.shared.performfishservice.
|
||||
* PerformFishResponse, java.util.Map)
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsService#callingDataMinerPerformFishAnalysis(org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishResponse, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public DataMinerResponse callingDataMinerPerformFishAnalysis(Map<String, List<String>> algorithmMapParameters)
|
||||
throws Exception {
|
||||
try {
|
||||
public DataMinerResponse callingDataMinerPerformFishAnalysis(Map<String, List<String>> algorithmMapParameters) throws Exception{
|
||||
|
||||
log.info("Calling the DM service with algorithm parameters: "+algorithmMapParameters.toString());
|
||||
|
||||
Map<String, List<String>> dmRequestParameters = new HashMap<String, List<String>>();
|
||||
|
@ -734,29 +612,18 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
dmRequestParameters.put("service", Arrays.asList("WPS"));
|
||||
dmRequestParameters.put("Version", Arrays.asList("1.0.0"));
|
||||
dmRequestParameters.put("lang", Arrays.asList("en-US"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList(
|
||||
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_ANALYSIS"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_ANALYSIS"));
|
||||
dmRequestParameters.putAll(algorithmMapParameters);
|
||||
|
||||
return callTheDataMiner(dmRequestParameters);
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getLocalizedMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.
|
||||
* PerformFishAnalyticsService#callingDataMinerPerformFishAnalysis(org.gcube
|
||||
* .portlets.user.performfishanalytics.shared.performfishservice.
|
||||
* PerformFishResponse, java.util.Map)
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsService#callingDataMinerPerformFishAnalysis(org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishResponse, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public DataMinerResponse callingDataMinerPerformFishAnnualAnalysis(Map<String, List<String>> algorithmMapParameters)
|
||||
throws Exception {
|
||||
try {
|
||||
public DataMinerResponse callingDataMinerPerformFishAnnualAnalysis(Map<String, List<String>> algorithmMapParameters) throws Exception{
|
||||
|
||||
log.info("Calling the DM service with algorithm parameters: "+algorithmMapParameters.toString());
|
||||
|
||||
Map<String, List<String>> dmRequestParameters = new HashMap<String, List<String>>();
|
||||
|
@ -764,31 +631,24 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
dmRequestParameters.put("service", Arrays.asList("WPS"));
|
||||
dmRequestParameters.put("Version", Arrays.asList("1.0.0"));
|
||||
dmRequestParameters.put("lang", Arrays.asList("en-US"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList(
|
||||
"org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_ANALYSIS_ANNUAL"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_ANALYSIS_ANNUAL"));
|
||||
dmRequestParameters.putAll(algorithmMapParameters);
|
||||
|
||||
return callTheDataMiner(dmRequestParameters);
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getLocalizedMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call the data miner.
|
||||
*
|
||||
* @param dmServiceRequestParameters
|
||||
* the dm request parameters
|
||||
* @param dmServiceRequestParameters the dm request parameters
|
||||
* @return the data miner response
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
private DataMinerResponse callTheDataMiner(Map<String, List<String>> dmServiceRequestParameters) throws Exception {
|
||||
|
||||
ServiceParameters dataMinerService = ContextUtil.getDataMinerService(this.getThreadLocalRequest());
|
||||
log.info("Found DM service: " + dataMinerService.getUrl() + " int this scope: "
|
||||
+ ContextUtil.getPortalContext(this.getThreadLocalRequest()).getCurrentScope());
|
||||
log.info("Found DM service: "+dataMinerService.getUrl() + " int this scope: "+ContextUtil.getPortalContext(this.getThreadLocalRequest()).getCurrentScope());
|
||||
|
||||
dataMinerService.setProperties(dmServiceRequestParameters);
|
||||
//Addding client parameters to DM service request
|
||||
|
@ -802,8 +662,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
throw new Exception("Error retrieving the token: "+token);
|
||||
}
|
||||
try{
|
||||
response = new HttpCallerUtil(dataMinerService.getUrl(), null, null)
|
||||
.performGETRequestWithRetry(dmServiceRequestParameters, token, 5);
|
||||
response = new HttpCallerUtil(dataMinerService.getUrl(), null, null).performGETRequestWithRetry(dmServiceRequestParameters,token, 5);
|
||||
if(response==null){
|
||||
log.error("The presponse returned is null");
|
||||
throw new Exception("The presponse returned is null");
|
||||
|
@ -815,8 +674,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
|
||||
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");
|
||||
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{
|
||||
|
||||
|
@ -825,23 +683,20 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
for (DataMinerOutputData dataMinerOutputData : listOut) {
|
||||
//I'm using this specific output data of DM
|
||||
if(dataMinerOutputData.getFileDescription().toLowerCase().contains("outputcharts")){
|
||||
log.info("The output: " + dataMinerOutputData.getFileDescription() + " with: "
|
||||
+ dataMinerOutputData.getMimeType() + " is the candidate to unzip");
|
||||
log.info("The output: "+dataMinerOutputData.getFileDescription()+ " with: "+dataMinerOutputData.getMimeType()+" is the candidate to unzip");
|
||||
toDMOutputData = dataMinerOutputData;
|
||||
break;
|
||||
}
|
||||
|
||||
if(dataMinerOutputData.getFileDescription().toLowerCase().contains("outputfile")){
|
||||
log.info("The output: " + dataMinerOutputData.getFileDescription() + " with: "
|
||||
+ dataMinerOutputData.getMimeType() + " is the candidate to unzip");
|
||||
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' or 'outputfile'. Please report this issue at www.d4science.org/contact-us");
|
||||
throw new Exception("The response returned by DM service does not contain a file to unzip with name: 'outputcharts' or 'outputfile'. Please report this issue at www.d4science.org/contact-us");
|
||||
|
||||
String theZipFileURL = toDMOutputData.getPublicURL();
|
||||
log.info("I'm using the file: "+theZipFileURL);
|
||||
|
@ -862,14 +717,14 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manage outputs for perform fish analysis.
|
||||
*
|
||||
* @param output
|
||||
* the output
|
||||
* @param output the output
|
||||
* @return the list
|
||||
*/
|
||||
private List<OutputFile> manageOutputsForPerformFishAnalysis(List<OutputFile> output) {
|
||||
public List<OutputFile> manageOutputsForPerformFishAnalysis(List<OutputFile> output) {
|
||||
|
||||
List<OutputFile> newOutputFiles = new ArrayList<OutputFile>();
|
||||
try {
|
||||
|
@ -879,17 +734,14 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
//FINDING THE FILE WIHT THE LEGEND
|
||||
for (OutputFile outputFile : output) {
|
||||
log.trace("outputFile: {}", outputFile.getName());
|
||||
if (outputFile.getName().toLowerCase().contains("legend")
|
||||
&& outputFile.getDataType().equals(FileContentType.CSV)) {
|
||||
if(outputFile.getName().toLowerCase().contains("legend") && outputFile.getDataType().equals(FileContentType.CSV)){
|
||||
log.debug("Found legend file: {}", outputFile.getName());
|
||||
CSVFile theLegendFile = getCSVFile(outputFile, false);
|
||||
List<CSVRow> rows = theLegendFile.getValueRows();
|
||||
//CREATING FROM *_legend_* CSV
|
||||
// THE LEGEND WITH FIRST VALUE AS KEY AND REMAINING VALUES
|
||||
// AS PROPERTIES
|
||||
//THE LEGEND WITH FIRST VALUE AS KEY AND REMAINING VALUES AS PROPERTIES
|
||||
for (CSVRow csvRow : rows) {
|
||||
theLegendMap.put(csvRow.getListValues().get(0),
|
||||
csvRow.getListValues().subList(1, csvRow.getListValues().size()));
|
||||
theLegendMap.put(csvRow.getListValues().get(0), csvRow.getListValues().subList(1, csvRow.getListValues().size()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -908,26 +760,20 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
|
||||
if(outputFile.getDataType().equals(FileContentType.CSV)) {
|
||||
|
||||
// FINDING THE FILE *index* TO CREATE A NEW CSV
|
||||
// REPLACING THE LABELS 'A','B','C', etc. WITH THE NAMES
|
||||
// (THE KPI NAMES) CONTAINED IN THE LEGEND
|
||||
//FINDING THE FILE *index* TO CREATE A NEW CSV REPLACING THE LABELS 'A','B','C', etc. WITH THE NAMES (THE KPI NAMES) CONTAINED IN THE LEGEND
|
||||
if(toNameLower.contains("index")){
|
||||
CSVFile theCorrelationMatrixIndexCSVFile = getCSVFile(outputFile, true);
|
||||
try{
|
||||
theOutputFile = createCSVWithLegendValues(theCorrelationMatrixIndexCSVFile,
|
||||
theLegendMap);
|
||||
theOutputFile = createCSVWithLegendValues(theCorrelationMatrixIndexCSVFile, theLegendMap);
|
||||
}catch(Exception e){
|
||||
log.warn(
|
||||
"Error thrown creating the CSV File with legend returning the original output file {}",
|
||||
outputFile);
|
||||
log.warn("Error thrown creating the CSV File with legend returning the original output file {}", outputFile);
|
||||
theOutputFile = outputFile;
|
||||
}
|
||||
//break;
|
||||
}
|
||||
}
|
||||
|
||||
// RETURNING ALSO THE file correlation_matrix.csv for
|
||||
// applying the COLORS
|
||||
//RETURNING ALSO THE file correlation_matrix.csv for applying the COLORS
|
||||
newOutputFiles.add(theOutputFile);
|
||||
}
|
||||
|
||||
|
@ -945,19 +791,16 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the csv with legend values.
|
||||
*
|
||||
* @param theCorrelationFile
|
||||
* the the correlation file
|
||||
* @param theLegendMap
|
||||
* the the legend map
|
||||
* @param theCorrelationFile the the correlation file
|
||||
* @param theLegendMap the the legend map
|
||||
* @return the output file
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
private OutputFile createCSVWithLegendValues(CSVFile theCorrelationFile, Map<String, List<String>> theLegendMap)
|
||||
throws Exception {
|
||||
private OutputFile createCSVWithLegendValues(CSVFile theCorrelationFile, Map<String, List<String>> theLegendMap) throws Exception{
|
||||
|
||||
CSVWriter cswWriter = null;
|
||||
try{
|
||||
|
@ -1030,8 +873,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
/**
|
||||
* Removes the last char.
|
||||
*
|
||||
* @param str
|
||||
* the str
|
||||
* @param str the str
|
||||
* @return the string
|
||||
*/
|
||||
private static String removeLastChar(String str) {
|
||||
|
@ -1045,16 +887,14 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
/**
|
||||
* Gets the CSV file.
|
||||
*
|
||||
* @param file
|
||||
* the file
|
||||
* @param deleteAfter
|
||||
* the delete after
|
||||
* @param file the file
|
||||
* @param deleteAfter the delete after
|
||||
* @return the CSV file
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public CSVFile getCSVFile(OutputFile file, boolean deleteAfter) throws Exception{
|
||||
|
||||
File theFile = null;
|
||||
try{
|
||||
if(file==null || file.getServerLocation()==null || file.getServerLocation().isEmpty()){
|
||||
|
@ -1084,14 +924,13 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the CSV file.
|
||||
*
|
||||
* @param theFileURL
|
||||
* the the file url
|
||||
* @param theFileURL the the file url
|
||||
* @return the CSV file
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public CSVFile readCSVFile(String theFileURL) throws Exception{
|
||||
|
@ -1126,22 +965,20 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy to byte array.
|
||||
*
|
||||
* @param url
|
||||
* the url
|
||||
* @param url the url
|
||||
* @return the byte[]
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
private byte[] copyToByteArray(URL url) throws Exception {
|
||||
public byte[] copyToByteArray(URL url) throws Exception{
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = url.openStream ();
|
||||
byte[] byteChunk = new byte[4096]; // Or whatever size you want to
|
||||
// read in at a time.
|
||||
byte[] byteChunk = new byte[4096]; // Or whatever size you want to read in at a time.
|
||||
int n;
|
||||
|
||||
while ( (n = is.read(byteChunk)) > 0 ) {
|
||||
|
@ -1149,10 +986,12 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
|
||||
return baos.toByteArray();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
log.error("Failed while reading bytes from %s: %s", url.toExternalForm(), e.getMessage());
|
||||
throw new Exception("Copy to byte array error");
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
if (is != null) {
|
||||
try{
|
||||
is.close();
|
||||
|
@ -1164,14 +1003,15 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the image file.
|
||||
*
|
||||
* @param file
|
||||
* the file
|
||||
* @param file the file
|
||||
* @return the image file
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public String getImageFile(OutputFile file) throws Exception{
|
||||
|
@ -1184,8 +1024,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet implem
|
|||
|
||||
theFile = new File(file.getServerLocation());
|
||||
byte[] imageContent = Files.readAllBytes(theFile.toPath());
|
||||
// System.out.println("<img src='data:image/png;base64," +
|
||||
// DatatypeConverter.printBase64Binary(imageInByte) + "'></img>");
|
||||
// System.out.println("<img src='data:image/png;base64," + DatatypeConverter.printBase64Binary(imageInByte) + "'></img>");
|
||||
|
||||
return "<img src='data:image/png;base64," + DatatypeConverter.printBase64Binary(imageContent) + "'></img>";
|
||||
}catch(Exception e){
|
||||
|
|
Loading…
Reference in New Issue