ref 12119:AccountingDashboard - Create a new Accounting Dashboard

https://support.d4science.org/issues/12119

Updated Report support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/accounting-dashboard@169812 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2018-07-17 17:15:10 +00:00
parent 845f76b807
commit 0e7b25e06f
15 changed files with 394 additions and 277 deletions

View File

@ -33,7 +33,7 @@ public class Controller {
private EventBus eventBus; private EventBus eventBus;
private AccountingDashboardServiceAsync service; private AccountingDashboardServiceAsync service;
private ApplicationCache cache; //private ApplicationCache cache;
private MonitorPresenter monitorPresenter; private MonitorPresenter monitorPresenter;
private ErrorPresenter errorPresenter; private ErrorPresenter errorPresenter;
private InfoPresenter infoPresenter; private InfoPresenter infoPresenter;
@ -46,7 +46,8 @@ public class Controller {
this.monitorPresenter = monitorPresenter; this.monitorPresenter = monitorPresenter;
this.errorPresenter = errorPresenter; this.errorPresenter = errorPresenter;
this.infoPresenter = infoPresenter; this.infoPresenter = infoPresenter;
this.cache = new ApplicationCache(); //this.cache = new ApplicationCache();
} }
public void fireEvent(GwtEvent<?> event) { public void fireEvent(GwtEvent<?> event) {
@ -61,6 +62,17 @@ public class Controller {
return eventBus; return eventBus;
} }
public void errorShow(String error){
logger.log(Level.FINE, "Error show: "+error);
errorPresenter.errorMessage(error);
}
public void infoShow(String info){
logger.log(Level.FINE, "Info show: "+info);
infoPresenter.infoMessage(info);
}
public void hello() { public void hello() {
eventBus.fireEvent(new HelloEvent()); eventBus.fireEvent(new HelloEvent());
} }

View File

@ -10,10 +10,9 @@
<!-- styleName="{style.popup}" --> <!-- styleName="{style.popup}" -->
<g:DialogBox ui:field="dialogBox" styleName="{res.uiDataCss.uiDataPopup}" <g:DialogBox ui:field="dialogBox" styleName="{res.uiDataCss.uiDataPopup}"
glassStyleName="{res.uiDataCss.uiDataPopupGlass}" glassEnabled="true"> glassStyleName="{res.uiDataCss.uiDataPopupGlass}" glassEnabled="true">
<g:caption> <g:caption><span class="{res.uiDataCss.uiDataPopupCaption}">Error</span></g:caption>
<b>Error</b>
</g:caption>
<g:HTMLPanel> <g:HTMLPanel>
<hr class="{res.uiDataCss.uiDataPopupHr}"/>
<b:Container> <b:Container>
<b:Paragraph ui:field="errorMsg"> <b:Paragraph ui:field="errorMsg">
</b:Paragraph> </b:Paragraph>

View File

@ -10,10 +10,9 @@
<!-- styleName="{style.popup}" --> <!-- styleName="{style.popup}" -->
<g:DialogBox ui:field="dialogBox" styleName="{res.uiDataCss.uiDataPopup}" <g:DialogBox ui:field="dialogBox" styleName="{res.uiDataCss.uiDataPopup}"
glassStyleName="{res.uiDataCss.uiDataPopupGlass}" glassEnabled="true"> glassStyleName="{res.uiDataCss.uiDataPopupGlass}" glassEnabled="true">
<g:caption> <g:caption><span class="{res.uiDataCss.uiDataPopupCaption}">Info</span></g:caption>
<b>Error</b>
</g:caption>
<g:HTMLPanel> <g:HTMLPanel>
<hr class="{res.uiDataCss.uiDataPopupHr}"/>
<b:Container> <b:Container>
<b:Paragraph ui:field="infoMsg"> <b:Paragraph ui:field="infoMsg">
</b:Paragraph> </b:Paragraph>

View File

@ -9,9 +9,11 @@
<g:DialogBox ui:field="dialogBox" styleName="{res.uiDataCss.uiDataMonitorPopup}" <g:DialogBox ui:field="dialogBox" styleName="{res.uiDataCss.uiDataMonitorPopup}"
glassStyleName="{res.uiDataCss.uiDataMonitorPopupGlass}" glassEnabled="true"> glassStyleName="{res.uiDataCss.uiDataMonitorPopupGlass}" glassEnabled="true">
<g:caption> <g:caption>
<b>Please wait</b> <span class="{res.uiDataCss.uiDataPopupCaption}">Please wait...</span>
</g:caption> </g:caption>
<g:HTMLPanel width="300px" styleName="{res.uiDataCss.uiDataMonitorPopupProgress}"> <g:HTMLPanel width="300px"
styleName="{res.uiDataCss.uiDataMonitorPopupProgress}">
<hr class="{res.uiDataCss.uiDataPopupHr}" />
<b:ProgressBar type="ANIMATED" percent="100" text="In progress..." /> <b:ProgressBar type="ANIMATED" percent="100" text="In progress..." />
</g:HTMLPanel> </g:HTMLPanel>
</g:DialogBox> </g:DialogBox>

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.filter; package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.filter;
import java.util.Date;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -70,8 +71,19 @@ public class FilterAreaPresenter extends PresenterWidget<FilterAreaPresenter.Fil
@Override @Override
public void getReport(RequestReportData requestReportData) { public void getReport(RequestReportData requestReportData) {
if(checkDate(requestReportData.getDateFrom(),requestReportData.getDateTo())){
controller.getReport(requestReportData); controller.getReport(requestReportData);
}
} }
private boolean checkDate(Date dateStart, Date dateEnd) {
if (dateStart.compareTo(dateEnd) > 0) {
controller.errorShow("Attention the start date must be less than the end date!");
return false;
} else {
return true;
}
}
} }

View File

@ -17,6 +17,8 @@ import org.gcube.portlets.user.accountingdashboard.shared.data.ScopeData;
import com.github.gwtbootstrap.client.ui.ListBox; import com.github.gwtbootstrap.client.ui.ListBox;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import com.google.gwt.i18n.client.LocaleInfo; import com.google.gwt.i18n.client.LocaleInfo;
@ -66,6 +68,8 @@ public class FilterAreaView extends ViewWithUiHandlers<FilterAreaPresenter>
CellTree scopeTree; CellTree scopeTree;
private ListDataProvider<ScopeData> dataProvider; private ListDataProvider<ScopeData> dataProvider;
private ScopeTreeModel scopeTreeModel;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private AppResources resources; private AppResources resources;
@ -93,13 +97,30 @@ public class FilterAreaView extends ViewWithUiHandlers<FilterAreaPresenter>
for (int i = 2015; i <= year; i++) { for (int i = 2015; i <= year; i++) {
yearStart.addItem(String.valueOf(i)); yearStart.addItem(String.valueOf(i));
yearEnd.addItem(String.valueOf(i)); yearEnd.addItem(String.valueOf(i));
if(i==year){ if (i == year) {
} }
} }
yearStart.setSelectedValue(String.valueOf(year)); yearStart.setSelectedValue(String.valueOf(year));
yearEnd.setSelectedValue(String.valueOf(year)); yearEnd.setSelectedValue(String.valueOf(year));
yearStart.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
requestReport();
}
});
yearEnd.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
requestReport();
}
});
// returns a String array with localized names of the months // returns a String array with localized names of the months
String[] months = LocaleInfo.getCurrentLocale().getDateTimeFormatInfo().monthsFull(); String[] months = LocaleInfo.getCurrentLocale().getDateTimeFormatInfo().monthsFull();
@ -116,9 +137,27 @@ public class FilterAreaView extends ViewWithUiHandlers<FilterAreaPresenter>
} }
String currentMonth = DateTimeFormat.getFormat(PredefinedFormat.MONTH).format(now); String currentMonth = DateTimeFormat.getFormat(PredefinedFormat.MONTH).format(now);
monthStart.setSelectedValue(currentMonth);
monthStart.setSelectedValue(months[0]);
monthEnd.setSelectedValue(currentMonth); monthEnd.setSelectedValue(currentMonth);
monthStart.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
requestReport();
}
});
monthEnd.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
requestReport();
}
});
dataProvider = new ListDataProvider<ScopeData>(); dataProvider = new ListDataProvider<ScopeData>();
@ -132,25 +171,23 @@ public class FilterAreaView extends ViewWithUiHandlers<FilterAreaPresenter>
} }
}; };
ScopeTreeModel scopeTreeModel = new ScopeTreeModel(dataProvider, handler); scopeTreeModel = new ScopeTreeModel(dataProvider, handler);
ScopeTreeResources scopeTreeResources = GWT.create(ScopeTreeResources.class); ScopeTreeResources scopeTreeResources = GWT.create(ScopeTreeResources.class);
scopeTree = new CellTree(scopeTreeModel, null, scopeTreeResources); scopeTree = new CellTree(scopeTreeModel, null, scopeTreeResources);
} }
@Override @Override
public void displayScopeData(ScopeData scopeData) { public void displayScopeData(ScopeData scopeData) {
ArrayList<ScopeData> scopeDataList = new ArrayList<>(); ArrayList<ScopeData> scopeDataList = new ArrayList<>();
scopeDataList.add(scopeData); scopeDataList.add(scopeData);
this.scopeData=scopeData; this.scopeData = scopeData;
dataProvider.setList(scopeDataList); dataProvider.setList(scopeDataList);
dataProvider.refresh(); dataProvider.refresh();
dataProvider.flush(); dataProvider.flush();
TreeNode root = scopeTree.getRootTreeNode(); TreeNode root = scopeTree.getRootTreeNode();
root.setChildOpen(root.getIndex(), true); root.setChildOpen(root.getIndex(), true);
scopeTreeModel.setSelected(scopeData, true);
requestReport(); requestReport();
} }
@ -162,12 +199,12 @@ public class FilterAreaView extends ViewWithUiHandlers<FilterAreaPresenter>
Date dateStart = null; Date dateStart = null;
try { try {
String dStart=yearS + "-" + monthS + "-01"; String dStart = yearS + "-" + monthS + "-01";
logger.fine("DateTemp1: "+dStart); logger.fine("DateTemp1: " + dStart);
dateStart = dateTimeFormat.parse(dStart); dateStart = dateTimeFormat.parse(dStart);
logger.fine("DateStart: "+dStart); logger.fine("DateStart: " + dStart);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE,"Error in start date: "+e.getLocalizedMessage(),e); logger.log(Level.SEVERE, "Error in start date: " + e.getLocalizedMessage(), e);
} }
@ -176,18 +213,18 @@ public class FilterAreaView extends ViewWithUiHandlers<FilterAreaPresenter>
Date dateEnd = null; Date dateEnd = null;
try { try {
String dEnd=yearE + "-" + monthE + "-01"; String dEnd = yearE + "-" + monthE + "-01";
logger.fine("DateTemp2: "+dEnd); logger.fine("DateTemp2: " + dEnd);
dateEnd = dateTimeFormat.parse(dEnd); dateEnd = dateTimeFormat.parse(dEnd);
CalendarUtil.addMonthsToDate(dateEnd, 1); CalendarUtil.addMonthsToDate(dateEnd, 1);
CalendarUtil.addDaysToDate(dateEnd, -1); CalendarUtil.addDaysToDate(dateEnd, -1);
logger.fine("DateEnd: "+dateEnd); logger.fine("DateEnd: " + dateEnd);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE,"Error in end date: "+e.getLocalizedMessage(),e); logger.log(Level.SEVERE, "Error in end date: " + e.getLocalizedMessage(), e);
} }
RequestReportData requestReportData=new RequestReportData(scopeData, dateStart, dateEnd); RequestReportData requestReportData = new RequestReportData(scopeData, dateStart, dateEnd);
getUiHandlers().getReport(requestReportData); getUiHandlers().getReport(requestReportData);
} }

View File

@ -46,10 +46,17 @@ public class ScopeTreeModel implements TreeViewModel {
}); });
} }
/**
* Get the {@link NodeInfo} that provides the children of the specified public void setSelected(ScopeData item, boolean selected){
* value. selectionModel.setSelected(item, selected);
*/ }
public boolean isSelected(ScopeData item){
return selectionModel.isSelected(item);
}
@Override @Override
public <T> NodeInfo<?> getNodeInfo(T value) { public <T> NodeInfo<?> getNodeInfo(T value) {
if (value == null) { if (value == null) {
@ -83,6 +90,7 @@ public class ScopeTreeModel implements TreeViewModel {
} }
} }
}; };
return new DefaultNodeInfo<ScopeData>(dataProvider, cell, selectionModel, null); return new DefaultNodeInfo<ScopeData>(dataProvider, cell, selectionModel, null);
} }
@ -99,10 +107,6 @@ public class ScopeTreeModel implements TreeViewModel {
return null; return null;
} }
/**
* Check if the specified value represents a leaf node. Leaf nodes cannot be
* opened.
*/
@Override @Override
public boolean isLeaf(Object value) { public boolean isLeaf(Object value) {
// The leaf nodes are the songs, which are Strings. // The leaf nodes are the songs, which are Strings.

View File

@ -5,7 +5,6 @@ import java.util.logging.Logger;
import org.gcube.portlets.user.accountingdashboard.client.application.controller.Controller; import org.gcube.portlets.user.accountingdashboard.client.application.controller.Controller;
import org.gcube.portlets.user.accountingdashboard.client.application.event.ReportEvent; import org.gcube.portlets.user.accountingdashboard.client.application.event.ReportEvent;
import org.gcube.portlets.user.accountingdashboard.client.application.event.ScopeDataEvent;
import org.gcube.portlets.user.accountingdashboard.shared.data.ReportData; import org.gcube.portlets.user.accountingdashboard.shared.data.ReportData;
import com.google.inject.Inject; import com.google.inject.Inject;
@ -29,6 +28,7 @@ public class ReportAreaPresenter extends PresenterWidget<ReportAreaPresenter.Rep
} }
@SuppressWarnings("unused")
private EventBus eventBus; private EventBus eventBus;
private Controller controller; private Controller controller;

View File

@ -13,6 +13,9 @@ import org.gcube.portlets.user.accountingdashboard.shared.data.ReportElementData
import com.github.gwtbootstrap.client.ui.Tab; import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.TabPanel; import com.github.gwtbootstrap.client.ui.TabPanel;
import com.github.gwtbootstrap.client.ui.base.IconAnchor;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HTMLPanel;
@ -35,6 +38,8 @@ public class ReportAreaView extends ViewWithUiHandlers<ReportAreaPresenter>
@UiField @UiField
HTMLPanel reportPanel; HTMLPanel reportPanel;
private HashMap<String, ArrayList<Chart>> categories;
private AppResources resources; private AppResources resources;
@Inject @Inject
@ -42,119 +47,67 @@ public class ReportAreaView extends ViewWithUiHandlers<ReportAreaPresenter>
this.resources = resources; this.resources = resources;
init(); init();
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
/*
RecordData recordData1 = new RecordData();
recordData1.setX("Gennaio");
recordData1.setY(3d);
RecordData recordData2 = new RecordData();
recordData2.setX("Febbraio");
recordData2.setY(2d);
RecordData recordData3 = new RecordData();
recordData3.setX("Marzo");
recordData3.setY(4d);
RecordData[] dataRow1 = new RecordData[2];
dataRow1[0] = recordData1;
dataRow1[1] = recordData2;
dataRow1[2] = recordData3;
RecordData recordData4 = new RecordData();
recordData4.setX("Gennaio");
recordData4.setY(1d);
RecordData recordData5 = new RecordData();
recordData5.setX("Febbraio");
recordData5.setY(5d);
RecordData recordData6 = new RecordData();
recordData6.setX("Marzo");
recordData6.setY(2d);
RecordData[] dataRow2 = new RecordData[2];
dataRow2[0] = recordData4;
dataRow2[1] = recordData5;
dataRow2[2] = recordData6;
SeriesData seriesData1 = new SeriesData();
seriesData1.setLabel("Series1");
seriesData1.setDataRow(dataRow1);
SeriesData seriesData2 = new SeriesData();
seriesData2.setLabel("Series2");
seriesData2.setDataRow(dataRow2);
SeriesData[] serieses = new SeriesData[2];
serieses[0] = seriesData1;
serieses[1] = seriesData2;
ReportData rData = new ReportData();
ArrayList<ReportElementData> elements = new ArrayList<>();
ReportElementData reportElementData1 = new ReportElementData();
reportElementData1.setxAxis("XAxis");
reportElementData1.setyAxis("YAxis");
reportElementData1.setCategory("Category");
reportElementData1.setLabel("Label1");
reportElementData1.setSerieses(serieses);
elements.add(reportElementData1);
ReportElementData reportElementData2 = new ReportElementData();
reportElementData2.setxAxis("XAxis");
reportElementData2.setyAxis("YAxis");
reportElementData2.setCategory("Category");
reportElementData2.setLabel("Label2");
reportElementData2.setSerieses(serieses);
elements.add(reportElementData2);
rData.setElements(elements);
displayReportData(rData);*/
} }
private void init() { private void init() {
} }
/**
* LABEL | | _ yaxis | _ | | | | || |_ | | || | |
* ---------------------------------------------------
*
*
* *Series_label1 *Series_label2 *Series_label3
*
* xAxis
*
*/
@Override @Override
public void displayReportData(ReportData reportData) { public void displayReportData(ReportData reportData) {
if (reportData == null) { if (reportData == null) {
reportPanel.clear(); reportPanel.clear();
} else { } else {
reportPanel.clear(); reportPanel.clear();
HashMap<String, ArrayList<Chart>> categories=new HashMap<>(); categories = new HashMap<>();
for (int i = 0; i < reportData.getElements().size(); i++) { for (int i = 0; i < reportData.getElements().size(); i++) {
ReportElementData reportElementData=reportData.getElements().get(i); ReportElementData reportElementData = reportData.getElements().get(i);
String key = reportElementData.getCategory();
ArrayList<Chart> category; ArrayList<Chart> category;
if(categories.containsKey(reportElementData.getCategory())){ if (categories.containsKey(key)) {
category=categories.get(reportElementData.getCategory()); category = categories.get(reportElementData.getCategory());
} else { } else {
category=new ArrayList<>(); category = new ArrayList<>();
} }
Chart chart = new Chart(resources, "report_" + i, reportElementData); Chart chart = new Chart(resources, "report_" + i, reportElementData);
category.add(chart); category.add(chart);
categories.put(key, category);
} }
TabPanel tabPanel=new TabPanel(); TabPanel tabPanel = new TabPanel();
for(String category:categories.keySet()){ boolean first = true;
Tab tab=new Tab(); for (String category : categories.keySet()) {
HTMLPanel tabContent=new HTMLPanel(""); Tab tab = new Tab();
for(Chart chart:categories.get(category)){ tab.setHeading(category);
HTMLPanel tabContent = new HTMLPanel("");
for (Chart chart : categories.get(category)) {
tabContent.add(chart); tabContent.add(chart);
} }
if (first) {
tab.setActive(true);
first = false;
}
tab.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
logger.fine("ClickEvent: " + event.getSource().getClass());
IconAnchor iconAnchor = (IconAnchor) event.getSource();
String category = iconAnchor.getText();
if (category != null) {
category = category.trim();
}
logger.fine("Category found: " + category);
ArrayList<Chart> chartsInCategory = categories.get(category);
// logger.fine("Charts List:"+chartsInCategory);
if (chartsInCategory != null) {
for (Chart chart : chartsInCategory) {
chart.forceLayout();
}
}
}
});
tab.add(tabContent); tab.add(tabContent);
tabPanel.add(tab); tabPanel.add(tab);
} }

View File

@ -32,28 +32,38 @@ public class Chart extends HTMLPanel {
} }
}); });
}
public String getYAxisLabel() {
return reportElementData.getyAxis();
} }
/** public void forceLayout() {
* LABEL | | _ yaxis | _ | | | | || |_ | | || | | redrawChart();
* --------------------------------------------------- }
*
*
* *Series_label1 *Series_label2 *Series_label3
*
* xAxis
*
*/
/** private native void redrawChart() /*-{
* Series[] { Series : LABEL, dataRow [] Series : LABEL, dataRow [] Series : console.log('RedrawChart()');
* LABEL, dataRow [] Series : LABEL, dataRow [] }
*/ var canvas = @org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report.chartjs.Chart::getCanvas(Lorg/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/chartjs/Chart;)(this);
this.@org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report.chartjs.Chart::drawChart()();
}-*/;
private static native void getCanvas(Chart chart)/*-{
var name = chart.@org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report.chartjs.Chart::name;
console.log('Element name: ' + name);
var element = this;
console.log('Element found: ' + element);
var canvas = $doc.getElementById(name);
console.log('Canvas: ' + canvas);
canvas.height = 500;
canvas.width = 1024;
var canvasW = canvas.width;
var canvasH = canvas.height;
console.log('Canvas dimensions: ' + canvasW + ' x ' + canvasH);
return canvas;
}-*/;
private native void drawChart() /*-{ private native void drawChart() /*-{
@ -88,18 +98,9 @@ public class Chart extends HTMLPanel {
return color; return color;
} }
var name = this.@org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report.chartjs.Chart::name; var canvas = @org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report.chartjs.Chart::getCanvas(Lorg/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/chartjs/Chart;)(this);
console.log('Element name: ' + name);
var element = this;
console.log('Element found: ' + element);
var canvas = $doc.getElementById(name);
console.log('Canvas: ' + canvas); console.log('Canvas: ' + canvas);
var recordData = new $wnd.org.gcube.portlets.user.accountingdashboard.shared.data.RecordData();
recordData.setX('ok');
recordData.setY(1.0);
console.log('RecordData: ' + recordData.toString());
var reportElementData = this.@org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report.chartjs.Chart::reportElementData; var reportElementData = this.@org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report.chartjs.Chart::reportElementData;
console.log('ReportElementData: ' + reportElementData); console.log('ReportElementData: ' + reportElementData);
@ -135,8 +136,6 @@ public class Chart extends HTMLPanel {
var colorChart = getRandomColor(); var colorChart = getRandomColor();
console.log('Color: ' + colorChart); console.log('Color: ' + colorChart);
// backgroundColor : 'rgba(255,0,0,0.9)',
// borderColor : 'rgba(255,0,0,1)',
datasetsArray.push({ datasetsArray.push({
label : seriesData.getLabel(), label : seriesData.getLabel(),
@ -147,9 +146,6 @@ public class Chart extends HTMLPanel {
}); });
} }
//var color = Chart.helpers.color;
//console.log('Color: ' + color);
var barChartData = { var barChartData = {
labels : labelsArray, labels : labelsArray,
datasets : datasetsArray datasets : datasetsArray
@ -161,13 +157,14 @@ public class Chart extends HTMLPanel {
var yAxisLabel = reportElementData.getyAxis(); var yAxisLabel = reportElementData.getyAxis();
var ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');
console.log('Create chart');
var chart = new Chart(ctx, { var chart = new Chart(ctx, {
// The type of chart we want to create // The type of chart we want to create
type : 'bar', type : 'bar',
data : barChartData, data : barChartData,
options : { options : {
animation : false, animation : false,
responsive : true, responsive : false,
legend : { legend : {
position : 'top', position : 'top',
}, },
@ -195,6 +192,15 @@ public class Chart extends HTMLPanel {
} }
} }
}); });
console.log('Chart: ' + chart);
//Chart.instances[].resize();
//chart.resize();
chart.update();
var canvasW = canvas.width;
var canvasH = canvas.height;
console.log('Canvas dimensions: ' + canvasW + ' x ' + canvasH);
}-*/; }-*/;

View File

@ -48,9 +48,13 @@ public interface AppResources extends ClientBundle {
String uiDataPopupGlass(); String uiDataPopupGlass();
//String uiDataFormTable(); String uiDataPopupCaption();
//String uiDataFormPager(); String uiDataPopupHr();
// String uiDataFormTable();
// String uiDataFormPager();
// String uiDataActionParagraph(); // String uiDataActionParagraph();
// String uiDataAccordionGroup(); // String uiDataAccordionGroup();

View File

@ -57,6 +57,7 @@
/* Chart */ /* Chart */
.uiDataChartWrapper { .uiDataChartWrapper {
} }
.uiDataChartCanvas { .uiDataChartCanvas {
@ -65,13 +66,12 @@
max-height: 800px; max-height: 800px;
} }
/* Monitor Dialog */ /* Monitor Dialog */
.uiDataMonitorPopup { .uiDataMonitorPopup {
background-color: white; background-color: white;
border: 1px double black; border: 1px double #999;
padding: 0 15px; padding: 0 15px;
height: 70px;
z-index: 1070; z-index: 1070;
} }
@ -83,14 +83,14 @@
} }
.uiDataMonitorPopupProgress { .uiDataMonitorPopupProgress {
margin: 5px; /*margin: 5px;*/
height: 20px; height: 20px;
} }
/* Dialog */ /* Dialog */
.uiDataPopup { .uiDataPopup {
background-color: white; background-color: white;
border: 1px double black; border: 1px double #999;
padding: 0 15px; padding: 0 15px;
z-index: 1070; z-index: 1070;
} }
@ -102,6 +102,21 @@
z-index: 1050; z-index: 1050;
} }
.uiDataPopupCaption {
display: block;
font-size: large;
margin-top: 5px;
margin-bottom: 2px;
}
.uiDataPopupHr {
margin: 0px!important;
margin-bottom: 5px;
height: 3px;
border: 0;
box-shadow: inset 0 3px 3px -3px rgba(0, 0, 0, 0.5);
}
/* /*
.uiDataBody { .uiDataBody {
padding-top: 0px; padding-top: 0px;

View File

@ -6,7 +6,6 @@ import org.gcube.portlets.user.accountingdashboard.client.rpc.AccountingDashboar
import org.gcube.portlets.user.accountingdashboard.server.accounting.AccountingService; import org.gcube.portlets.user.accountingdashboard.server.accounting.AccountingService;
import org.gcube.portlets.user.accountingdashboard.server.accounting.AccountingServiceType; import org.gcube.portlets.user.accountingdashboard.server.accounting.AccountingServiceType;
import org.gcube.portlets.user.accountingdashboard.server.util.ServiceCredentials; import org.gcube.portlets.user.accountingdashboard.server.util.ServiceCredentials;
import org.gcube.portlets.user.accountingdashboard.shared.Constants;
import org.gcube.portlets.user.accountingdashboard.shared.data.ReportData; import org.gcube.portlets.user.accountingdashboard.shared.data.ReportData;
import org.gcube.portlets.user.accountingdashboard.shared.data.RequestReportData; import org.gcube.portlets.user.accountingdashboard.shared.data.RequestReportData;
import org.gcube.portlets.user.accountingdashboard.shared.data.ScopeData; import org.gcube.portlets.user.accountingdashboard.shared.data.ScopeData;
@ -69,13 +68,7 @@ public class AccountingDashboardServiceImpl extends RemoteServiceServlet impleme
logger.debug("AccountingDashboardServiceImpl getScopeData()"); logger.debug("AccountingDashboardServiceImpl getScopeData()");
@SuppressWarnings("unused") @SuppressWarnings("unused")
ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(this.getThreadLocalRequest()); ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(this.getThreadLocalRequest());
AccountingService as = null; AccountingService as = new AccountingService(AccountingServiceType.PortalContex);
if (Constants.DEBUG_MODE) {
as = new AccountingService(AccountingServiceType.CurrentScope);
} else {
as = new AccountingService(AccountingServiceType.PortalContex);
}
ScopeData scopeData = as.getTree(this.getThreadLocalRequest()); ScopeData scopeData = as.getTree(this.getThreadLocalRequest());
return scopeData; return scopeData;
} catch (ServiceException e) { } catch (ServiceException e) {
@ -94,12 +87,7 @@ public class AccountingDashboardServiceImpl extends RemoteServiceServlet impleme
logger.debug("AccountingDashboardServiceImpl getReport(): " + requestReportData); logger.debug("AccountingDashboardServiceImpl getReport(): " + requestReportData);
@SuppressWarnings("unused") @SuppressWarnings("unused")
ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(this.getThreadLocalRequest()); ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(this.getThreadLocalRequest());
AccountingService as = null; AccountingService as = new AccountingService(AccountingServiceType.PortalContex);
if (Constants.DEBUG_MODE) {
as = new AccountingService(AccountingServiceType.CurrentScope);
} else {
as = new AccountingService(AccountingServiceType.PortalContex);
}
ReportData reportData = as.getReport(this.getThreadLocalRequest(), requestReportData); ReportData reportData = as.getReport(this.getThreadLocalRequest(), requestReportData);
return reportData; return reportData;
} catch (ServiceException e) { } catch (ServiceException e) {

View File

@ -5,13 +5,18 @@ import java.util.Date;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.bcel.classfile.Constant;
import org.gcube.accounting.accounting.summary.access.AccountingDao; import org.gcube.accounting.accounting.summary.access.AccountingDao;
import org.gcube.accounting.accounting.summary.access.model.MeasureResolution; import org.gcube.accounting.accounting.summary.access.model.MeasureResolution;
import org.gcube.accounting.accounting.summary.access.model.Report; import org.gcube.accounting.accounting.summary.access.model.Report;
import org.gcube.accounting.accounting.summary.access.model.ScopeDescriptor; import org.gcube.accounting.accounting.summary.access.model.ScopeDescriptor;
import org.gcube.portlets.user.accountingdashboard.shared.Constants;
import org.gcube.portlets.user.accountingdashboard.shared.data.RecordData;
import org.gcube.portlets.user.accountingdashboard.shared.data.ReportData; import org.gcube.portlets.user.accountingdashboard.shared.data.ReportData;
import org.gcube.portlets.user.accountingdashboard.shared.data.ReportElementData;
import org.gcube.portlets.user.accountingdashboard.shared.data.RequestReportData; import org.gcube.portlets.user.accountingdashboard.shared.data.RequestReportData;
import org.gcube.portlets.user.accountingdashboard.shared.data.ScopeData; import org.gcube.portlets.user.accountingdashboard.shared.data.ScopeData;
import org.gcube.portlets.user.accountingdashboard.shared.data.SeriesData;
import org.gcube.portlets.user.accountingdashboard.shared.exception.ServiceException; import org.gcube.portlets.user.accountingdashboard.shared.exception.ServiceException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -29,6 +34,10 @@ public class AccountingService {
public AccountingService(AccountingServiceType accountingServiceType) throws ServiceException { public AccountingService(AccountingServiceType accountingServiceType) throws ServiceException {
try { try {
if (Constants.DEBUG_MODE) {
return;
}
if (accountingServiceType == null) { if (accountingServiceType == null) {
logger.error("Invalid AccountingServiceType requested: null"); logger.error("Invalid AccountingServiceType requested: null");
} }
@ -48,6 +57,7 @@ public class AccountingService {
break; break;
} }
} catch (Throwable e) { } catch (Throwable e) {
logger.error("Error retrieving Tree: " + e.getLocalizedMessage(), e); logger.error("Error retrieving Tree: " + e.getLocalizedMessage(), e);
throw new ServiceException("Error retrieving Tree: " + e.getLocalizedMessage(), e); throw new ServiceException("Error retrieving Tree: " + e.getLocalizedMessage(), e);
@ -57,6 +67,9 @@ public class AccountingService {
public ScopeData getTree(HttpServletRequest httpServletRequest) throws ServiceException { public ScopeData getTree(HttpServletRequest httpServletRequest) throws ServiceException {
try { try {
if(Constants.DEBUG_MODE){
return debugScope();
}
logger.debug("AccountingService GetTree()"); logger.debug("AccountingService GetTree()");
ScopeDescriptor scopeDescriptor = dao.getTree(httpServletRequest); ScopeDescriptor scopeDescriptor = dao.getTree(httpServletRequest);
logger.debug("ScopeDescriptor: " + scopeDescriptor); logger.debug("ScopeDescriptor: " + scopeDescriptor);
@ -69,6 +82,8 @@ public class AccountingService {
} }
} }
private ScopeData getScopeData(ScopeDescriptor scopeDescriptor) { private ScopeData getScopeData(ScopeDescriptor scopeDescriptor) {
ScopeData scopeData = null; ScopeData scopeData = null;
if (scopeDescriptor != null) { if (scopeDescriptor != null) {
@ -89,6 +104,10 @@ public class AccountingService {
public ReportData getReport(HttpServletRequest httpServletRequest, RequestReportData requestReportData) public ReportData getReport(HttpServletRequest httpServletRequest, RequestReportData requestReportData)
throws ServiceException { throws ServiceException {
try { try {
if(Constants.DEBUG_MODE){
return debugReport();
}
logger.debug("AccountingService GetReport(): " + requestReportData); logger.debug("AccountingService GetReport(): " + requestReportData);
if (requestReportData != null && requestReportData.getScopeData() != null if (requestReportData != null && requestReportData.getScopeData() != null
&& requestReportData.getScopeData().getId() != null && requestReportData.getScopeData().getId() != null
@ -112,7 +131,7 @@ public class AccountingService {
} }
} catch (Throwable e) { } catch (Throwable e) {
logger.error("Error in crete report: " + e.getLocalizedMessage(), e); logger.error("Error in create report: " + e.getLocalizedMessage(), e);
throw new ServiceException("Error in create report: " + e.getLocalizedMessage(), e); throw new ServiceException("Error in create report: " + e.getLocalizedMessage(), e);
} }
} }
@ -164,4 +183,83 @@ public class AccountingService {
} }
} }
private ScopeData debugScope() {
ScopeData scopeData=new ScopeData("Debug", "Debug", null);
return scopeData;
}
private ReportData debugReport() {
RecordData recordData1 = new RecordData();
recordData1.setX("January");
recordData1.setY(3d);
RecordData recordData2 = new RecordData();
recordData2.setX("February");
recordData2.setY(2d);
RecordData recordData3 = new RecordData();
recordData3.setX("March");
recordData3.setY(4d);
RecordData[] dataRow1 = new RecordData[3];
dataRow1[0] = recordData1;
dataRow1[1] = recordData2;
dataRow1[2] = recordData3;
RecordData recordData4 = new RecordData();
recordData4.setX("January");
recordData4.setY(1d);
RecordData recordData5 = new RecordData();
recordData5.setX("February");
recordData5.setY(5d);
RecordData recordData6 = new RecordData();
recordData6.setX("March");
recordData6.setY(2d);
RecordData[] dataRow2 = new RecordData[3];
dataRow2[0] = recordData4;
dataRow2[1] = recordData5;
dataRow2[2] = recordData6;
SeriesData seriesData1 = new SeriesData();
seriesData1.setLabel("Series1");
seriesData1.setDataRow(dataRow1);
SeriesData seriesData2 = new SeriesData();
seriesData2.setLabel("Series2");
seriesData2.setDataRow(dataRow2);
SeriesData[] serieses = new SeriesData[2];
serieses[0] = seriesData1;
serieses[1] = seriesData2;
ReportData reportData1 = new ReportData();
ArrayList<ReportElementData> elements = new ArrayList<>();
ReportElementData reportElementData1 = new ReportElementData();
reportElementData1.setxAxis("XAxis");
reportElementData1.setyAxis("YAxis");
reportElementData1.setCategory("Category1");
reportElementData1.setLabel("Label1");
reportElementData1.setSerieses(serieses);
elements.add(reportElementData1);
ReportElementData reportElementData2 = new ReportElementData();
reportElementData2.setxAxis("XAxis");
reportElementData2.setyAxis("YAxis");
reportElementData2.setCategory("Category2");
reportElementData2.setLabel("Label2");
reportElementData2.setSerieses(serieses);
elements.add(reportElementData2);
reportData1.setElements(elements);
return reportData1;
}
} }

View File

@ -34,62 +34,48 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
private static Logger log = LoggerFactory.getLogger(PortalContextTreeProvider.class); private static Logger log = LoggerFactory.getLogger(PortalContextTreeProvider.class);
static { static {
groupsManager = new LiferayGroupManager(); groupsManager = new LiferayGroupManager();
} }
@Override @Override
public ScopeDescriptor getTree(Object context) throws Exception { public ScopeDescriptor getTree(Object context) throws Exception {
if(context == null) throw new Exception("Unable to get tree, Request is null."); if (context == null)
if(!(context instanceof HttpServletRequest)) throw new throw new Exception("Unable to get tree, Request is null.");
Exception("Invalid request object : "+context); if (!(context instanceof HttpServletRequest))
HttpServletRequest request=(HttpServletRequest) context; throw new Exception("Invalid request object : " + context);
HttpServletRequest request = (HttpServletRequest) context;
// PARSE TREE // PARSE TREE
LinkedHashMap<VRECategory,ArrayList<VRE>> gatewayTree=getPortalSitesMappedToVRE(request); LinkedHashMap<VRECategory, ArrayList<VRE>> gatewayTree = getPortalSitesMappedToVRE(request);
log.debug("Parsing tree from gateway. Size {} ",gatewayTree.size()); log.debug("Parsing tree from gateway. Size {} ", gatewayTree.size());
LinkedList<ScopeDescriptor> rootChildren=new LinkedList<>(); LinkedList<ScopeDescriptor> rootChildren = new LinkedList<>();
for(Entry<VRECategory,ArrayList<VRE>> entry:gatewayTree.entrySet()) { for (Entry<VRECategory, ArrayList<VRE>> entry : gatewayTree.entrySet()) {
ScopeDescriptor rootChild=new ScopeDescriptor(entry.getKey().name, entry.getKey().categoryID+""); ScopeDescriptor rootChild = new ScopeDescriptor(entry.getKey().name, entry.getKey().categoryID + "");
for(VRE vre:entry.getValue()) for (VRE vre : entry.getValue())
rootChild.getChildren().add(new ScopeDescriptor(vre.name, vre.scope)); rootChild.getChildren().add(new ScopeDescriptor(vre.name, vre.scope));
rootChildren.add(rootChild); rootChildren.add(rootChild);
} }
Group rootGroup=getSiteFromServletRequest(request); Group rootGroup = getSiteFromServletRequest(request);
ScopeDescriptor root=new ScopeDescriptor(rootGroup.getDescriptiveName(),rootGroup.getGroupId()+""); ScopeDescriptor root = new ScopeDescriptor(rootGroup.getDescriptiveName(), rootGroup.getGroupId() + "");
root.setChildren(rootChildren); root.setChildren(rootChildren);
log.debug("TREE IS {} ",root); log.debug("TREE IS {} ", root);
return root; return root;
} }
// private ScopeDescriptor asScopeDescriptor(GCubeGroup group)
// throws UserManagementSystemException, GroupRetrievalFault {
// ScopeDescriptor toReturn = new ScopeDescriptor(group.getGroupName(),
// groupsManager.getInfrastructureScope(group.getGroupId()));
// if (group.getChildren() != null && !group.getChildren().isEmpty()) {
// for (GCubeGroup child : group.getChildren()) {
// toReturn.getChildren().add(asScopeDescriptor(child));
// }
// }
// return toReturn;
// }
/** /**
* *
* @return the Virtual groups with their VREs in the order estabilished in * @return the Virtual groups with their VREs in the order estabilished in
the LR Control Panel * the LR Control Panel
* @throws SystemException * @throws SystemException
* @throws PortalException * @throws PortalException
*/ */
private LinkedHashMap<VRECategory, ArrayList<VRE>> private LinkedHashMap<VRECategory, ArrayList<VRE>> getPortalSitesMappedToVRE(HttpServletRequest request)
getPortalSitesMappedToVRE(HttpServletRequest request) throws Exception { throws Exception {
LinkedHashMap<VRECategory, ArrayList<VRE>> toReturn = new LinkedHashMap<VRECategory, ArrayList<VRE>>(); LinkedHashMap<VRECategory, ArrayList<VRE>> toReturn = new LinkedHashMap<VRECategory, ArrayList<VRE>>();
@ -105,9 +91,10 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
GCubeGroup rootGroupVO = groupsManager.getRootVO(); GCubeGroup rootGroupVO = groupsManager.getRootVO();
try { try {
log.debug("root: " + rootGroupVO.getGroupName() ); log.debug("root: " + rootGroupVO.getGroupName());
} catch (NullPointerException e) { } catch (NullPointerException e) {
log.error("Cannot find root organziation, please check gcube-data.properties file in $CATALINA_HOME/conf folder, unless your installing the Bundle"); log.error(
"Cannot find root organziation, please check gcube-data.properties file in $CATALINA_HOME/conf folder, unless your installing the Bundle");
return toReturn; return toReturn;
} }
PortalContext pContext = PortalContext.getConfiguration(); PortalContext pContext = PortalContext.getConfiguration();
@ -119,7 +106,7 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
currUserGroups = groupsManager.listGroupsByUser(currUser.getUserId()); currUserGroups = groupsManager.listGroupsByUser(currUser.getUserId());
} }
//for each root sub organizations (VO) // for each root sub organizations (VO)
for (GCubeGroup vOrg : rootGroupVO.getChildren()) { for (GCubeGroup vOrg : rootGroupVO.getChildren()) {
for (GCubeGroup vreSite : vOrg.getChildren()) { for (GCubeGroup vreSite : vOrg.getChildren()) {
long vreID = vreSite.getGroupId(); long vreID = vreSite.getGroupId();
@ -129,18 +116,25 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
long logoId = vreSite.getLogoId(); long logoId = vreSite.getLogoId();
String vreLogoURL = groupsManager.getGroupLogoURL(logoId); String vreLogoURL = groupsManager.getGroupLogoURL(logoId);
String infraScope = groupsManager.getInfrastructureScope(vreSite.getGroupId()); String infraScope = groupsManager.getInfrastructureScope(vreSite.getGroupId());
String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+vreSite.getFriendlyURL(); String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL + vreSite.getFriendlyURL();
List<VirtualGroup> vreGroups = groupsManager.getVirtualGroups(vreID); List<VirtualGroup> vreGroups = groupsManager.getVirtualGroups(vreID);
for (VirtualGroup vreGroup : vreGroups) { for (VirtualGroup vreGroup : vreGroups) {
for (VRECategory vre : toReturn.keySet()) { for (VRECategory vre : toReturn.keySet()) {
if (vre.getName().compareTo(vreGroup.getName())==0) { if (vre.getName().compareTo(vreGroup.getName()) == 0) {
ArrayList<VRE> toUpdate = toReturn.get(vre); ArrayList<VRE> toUpdate = toReturn.get(vre);
// UserBelonging belongs = UserBelonging.NOT_BELONGING; // UserBelonging belongs =
// VRE toAdd = new VRE(vreID,vreName, vreDescription, vreLogoURL, groupName, friendlyURL, belongs, getVREMembershipType(vreSite.getMembershipType())); // UserBelonging.NOT_BELONGING;
VRE toAdd= new VRE(vreName,vreDescription,vreID,friendlyURL,infraScope); // VRE toAdd = new VRE(vreID,vreName,
// if (GroupLocalServiceUtil.getGroup(vreID).getPublicLayoutsPageCount() > 0) { // vreDescription, vreLogoURL, groupName,
// String publicURL = PREFIX_PUBLIC_URL+vreSite.getFriendlyURL(); // friendlyURL, belongs,
// getVREMembershipType(vreSite.getMembershipType()));
VRE toAdd = new VRE(vreName, vreDescription, vreID, friendlyURL, infraScope);
// if
// (GroupLocalServiceUtil.getGroup(vreID).getPublicLayoutsPageCount()
// > 0) {
// String publicURL =
// PREFIX_PUBLIC_URL+vreSite.getFriendlyURL();
// toAdd.setPublicURL(publicURL); // toAdd.setPublicURL(publicURL);
// } // }
// if (currUser != null) { // if (currUser != null) {
@ -148,7 +142,8 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
// if (currUserGroups.contains(vreSite)) { // if (currUserGroups.contains(vreSite)) {
// toAdd.setUserBelonging(UserBelonging.BELONGING); // toAdd.setUserBelonging(UserBelonging.BELONGING);
// } // }
// else if (checkPending(currUser.getUsername(), vreSite.getGroupId())) // else if (checkPending(currUser.getUsername(),
// vreSite.getGroupId()))
// toAdd.setUserBelonging(UserBelonging.PENDING); // toAdd.setUserBelonging(UserBelonging.PENDING);
// } // }
toUpdate.add(toAdd); toUpdate.add(toAdd);
@ -158,7 +153,7 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
} }
} }
//sort the vres in the groups // sort the vres in the groups
for (VRECategory cat : toReturn.keySet()) { for (VRECategory cat : toReturn.keySet()) {
ArrayList<VRE> toSort = toReturn.get(cat); ArrayList<VRE> toSort = toReturn.get(cat);
Collections.sort(toSort); Collections.sort(toSort);
@ -166,12 +161,7 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
return toReturn; return toReturn;
} }
private Group getSiteFromServletRequest(final HttpServletRequest request) throws PortalException, SystemException {
private Group getSiteFromServletRequest(final HttpServletRequest request)
throws PortalException, SystemException {
String serverName = request.getServerName(); String serverName = request.getServerName();
log.debug("currentHost is " + serverName); log.debug("currentHost is " + serverName);
Group site = null; Group site = null;
@ -179,9 +169,8 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
VirtualHostLocalServiceUtil.getVirtualHostsCount()); VirtualHostLocalServiceUtil.getVirtualHostsCount());
for (VirtualHost virtualHost : vHosts) { for (VirtualHost virtualHost : vHosts) {
log.debug("Found " + virtualHost.getHostname()); log.debug("Found " + virtualHost.getHostname());
if (virtualHost.getHostname().compareTo("localhost") != 0 && if (virtualHost.getHostname().compareTo("localhost") != 0 && virtualHost.getLayoutSetId() != 0
virtualHost.getLayoutSetId() != 0 && && virtualHost.getHostname().compareTo(serverName) == 0) {
virtualHost.getHostname().compareTo(serverName) == 0) {
long layoutSetId = virtualHost.getLayoutSetId(); long layoutSetId = virtualHost.getLayoutSetId();
site = LayoutSetLocalServiceUtil.getLayoutSet(layoutSetId).getGroup(); site = LayoutSetLocalServiceUtil.getLayoutSet(layoutSetId).getGroup();
log.debug("Found match! Your site is " + site.getName()); log.debug("Found match! Your site is " + site.getName());
@ -191,13 +180,11 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
return null; return null;
} }
private class VRECategory {
private class VRECategory{
private long categoryID; private long categoryID;
private String name; private String name;
private String description; private String description;
public VRECategory(long categoryID, String name, String description) { public VRECategory(long categoryID, String name, String description) {
super(); super();
this.categoryID = categoryID; this.categoryID = categoryID;
@ -208,9 +195,11 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
public long getCategoryID() { public long getCategoryID() {
return categoryID; return categoryID;
} }
public String getDescription() { public String getDescription() {
return description; return description;
} }
public String getName() { public String getName() {
return name; return name;
} }
@ -222,15 +211,13 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
} }
private class VRE implements Comparable<VRE> {
private class VRE implements Comparable<VRE>{
private String name; private String name;
private String description; private String description;
private long id; private long id;
private String url; private String url;
private String scope; private String scope;
public VRE(String name, String description, long id, String url, String scope) { public VRE(String name, String description, long id, String url, String scope) {
super(); super();
this.name = name; this.name = name;
@ -247,18 +234,19 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
public long getId() { public long getId() {
return id; return id;
} }
public String getName() { public String getName() {
return name; return name;
} }
public String getScope() { public String getScope() {
return scope; return scope;
} }
public String getUrl() { public String getUrl() {
return url; return url;
} }
@Override @Override
public String toString() { public String toString() {
return "VRE [name=" + name + ", description=" + description + ", id=" + id + ", url=" + url + ", scope=" return "VRE [name=" + name + ", description=" + description + ", id=" + id + ", url=" + url + ", scope="