Added facility to stop loading of search results

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@142637 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2017-02-16 16:15:45 +00:00
parent 7dea8a1424
commit 9f81b978ed
14 changed files with 785 additions and 308 deletions

View File

@ -10,8 +10,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.gcube.portlets.user.speciesdiscovery.client.advancedsearch.AdvancedSearchPanelManager; import org.gcube.portlets.user.speciesdiscovery.client.advancedsearch.AdvancedSearchPanelManager;
import org.gcube.portlets.user.speciesdiscovery.client.event.ActiveButtonCheckAllRowEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.ActiveButtonCheckAllRowEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.ActiveFilterOnResultEvent; import org.gcube.portlets.user.speciesdiscovery.client.event.ActiveFilterOnResultEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.ActiveFilterOnResultEventHandler; import org.gcube.portlets.user.speciesdiscovery.client.event.ActiveFilterOnResultEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.ActiveMaskLoadingGrid; import org.gcube.portlets.user.speciesdiscovery.client.event.ActiveMaskLoadingGrid;
@ -53,6 +51,11 @@ import org.gcube.portlets.user.speciesdiscovery.client.event.ShowOccurrencesEven
import org.gcube.portlets.user.speciesdiscovery.client.event.ShowOccurrencesEventHandler; import org.gcube.portlets.user.speciesdiscovery.client.event.ShowOccurrencesEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.ShowOnlySelectedRowEvent; import org.gcube.portlets.user.speciesdiscovery.client.event.ShowOnlySelectedRowEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.ShowOnlySelectedRowEventHandler; import org.gcube.portlets.user.speciesdiscovery.client.event.ShowOnlySelectedRowEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.StopCurrentSearchEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.StopCurrentSearchEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.StreamCompletedEventEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.StreamEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.StreamEvent.Event;
import org.gcube.portlets.user.speciesdiscovery.client.event.UpdateAllRowSelectionEvent; import org.gcube.portlets.user.speciesdiscovery.client.event.UpdateAllRowSelectionEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.UpdateAllRowSelectionEventHandler; import org.gcube.portlets.user.speciesdiscovery.client.event.UpdateAllRowSelectionEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.UpdateFilterOnResultEvent; import org.gcube.portlets.user.speciesdiscovery.client.event.UpdateFilterOnResultEvent;
@ -183,15 +186,21 @@ public class SearchController {
} }
}); });
eventBus.addHandler(ActiveButtonCheckAllRowEvent.TYPE, new ActiveButtonCheckAllRowEventHandler() { eventBus.addHandler(StreamEvent.TYPE, new StreamCompletedEventEventHandler() {
@Override @Override
public void onActiveCkeckAllRow(ActiveButtonCheckAllRowEvent activeFilterCheckAllRowEvent) { public void onStreamCompleteEvent(StreamEvent streamEvent) {
//ACTIVE SELECT ALL ROW
if(lastSearchEvent.getResultType().equals(SpeciesCapability.RESULTITEM)) if(lastSearchEvent.getResultType().equals(SpeciesCapability.RESULTITEM))
searchBorderLayoutPanel.getSpeciesCenterPanel().getResultRowPanel().activeCheckAllRows(activeFilterCheckAllRowEvent.isActiveFilter()); searchBorderLayoutPanel.getSpeciesCenterPanel().getResultRowPanel().activeCheckAllRows(streamEvent.isActiveFilter());
else if(lastSearchEvent.getResultType().equals(SpeciesCapability.TAXONOMYITEM)) else if(lastSearchEvent.getResultType().equals(SpeciesCapability.TAXONOMYITEM))
searchBorderLayoutPanel.getSpeciesCenterPanel().getTaxonomyRowPanel().activeCheckAllRows(activeFilterCheckAllRowEvent.isActiveFilter()); searchBorderLayoutPanel.getSpeciesCenterPanel().getTaxonomyRowPanel().activeCheckAllRows(streamEvent.isActiveFilter());
if(streamEvent.getEvent().equals(Event.COMPLETED))
searchBorderLayoutPanel.getSpeciesNorthPanel().visibleButtonStopSearch(false);
} }
}); });
@ -321,16 +330,11 @@ public class SearchController {
@Override @Override
public void onSearch(SearchEvent event) { public void onSearch(SearchEvent event) {
//Info.display("Event", event.toString());
GWT.log(event.toString()); GWT.log(event.toString());
Log.trace(event.toString()); Log.trace(event.toString());
lastSearchEvent = event; lastSearchEvent = event;
doActiveMaskLoadingGridAndButtonSearch(true); doActiveMaskLoadingGridAndButtonSearch(true);
searchBorderLayoutPanel.getSpeciesNorthPanel().visibleButtonStopSearch(true);
// ResultFilterPanelManager.getInstance().setGroupByRank(event.getGroupByRank());
if(event.getType().equals(SearchType.BY_COMMON_NAME) || event.getType().equals(SearchType.BY_SCIENTIFIC_NAME)){ if(event.getType().equals(SearchType.BY_COMMON_NAME) || event.getType().equals(SearchType.BY_SCIENTIFIC_NAME)){
search(event.getType(), event.getSearchTerm().trim(), event.getUpperBoundLongitude(), event.getUpperBoundLatitude(), event.getLowerBoundLongitude(), event.getLowerBoundLatitude(), event.getFromDate(), event.getToDate(), event.getLstDataSources(), event.getGroupByRank(), event.getResultType(), event.getListDataSourcesForSynonyms(), event.getListDataSourcesForUnfold()); search(event.getType(), event.getSearchTerm().trim(), event.getUpperBoundLongitude(), event.getUpperBoundLatitude(), event.getLowerBoundLongitude(), event.getLowerBoundLatitude(), event.getFromDate(), event.getToDate(), event.getLstDataSources(), event.getGroupByRank(), event.getResultType(), event.getListDataSourcesForSynonyms(), event.getListDataSourcesForUnfold());
} }
@ -342,6 +346,30 @@ public class SearchController {
}); });
eventBus.addHandler(StopCurrentSearchEvent.TYPE, new StopCurrentSearchEventHandler() {
@Override
public void onAbortCurrentSearch(StopCurrentSearchEvent abortCurrentSearchEvent) {
SpeciesDiscovery.taxonomySearchService.userStopSearch(new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(Void result) {
// TODO Auto-generated method stub
}
});
}
});
eventBus.addHandler(CreateOccurrenceJobEvent.TYPE, new CreateOccurrenceJobEventHandler() { eventBus.addHandler(CreateOccurrenceJobEvent.TYPE, new CreateOccurrenceJobEventHandler() {
@Override @Override
@ -855,12 +883,9 @@ public class SearchController {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", caught.getMessage() + ". Please, try your request again later.", null); new MessageBoxAlert("Error", caught.getMessage() + ". Please, try your request again later.", null);
GWT.log("loadDataSourceFromService error: "+caught.getMessage()); GWT.log("loadDataSourceFromService error: "+caught.getMessage());
// Info.display("Error on loading", "An error occurred on loading Data Source, retry.");
// Log.error("Error on loading", "An error occurred on loading Data Source, retry. " +caught.getMessage());
// Log.error("Error on loading", "An error occurred on loading Data Source, retry. " +caught);
// Log.error("Error on loading", "An error occurred on loading Data Source, retry. " +caught.getCause());
searchBorderLayoutPanel.getSpeciesNorthPanel().unmask(); searchBorderLayoutPanel.getSpeciesNorthPanel().unmask();
searchBorderLayoutPanel.getSpeciesNorthPanel().activeButtonSearch(false); searchBorderLayoutPanel.getSpeciesNorthPanel().activeButtonSearch(false);
searchBorderLayoutPanel.getSpeciesNorthPanel().visibleButtonStopSearch(false);
} }
@Override @Override
@ -1546,7 +1571,6 @@ public class SearchController {
lastSearchEvent.setResultType(capability); lastSearchEvent.setResultType(capability);
lastSearchEvent.setMapTermsSearched(queryParameters.getTerms()); lastSearchEvent.setMapTermsSearched(queryParameters.getTerms());
System.out.println("queryParameters.getTerms() "+queryParameters.getTerms()); System.out.println("queryParameters.getTerms() "+queryParameters.getTerms());
if(queryParameters.getTerms()!=null){ if(queryParameters.getTerms()!=null){

View File

@ -25,11 +25,11 @@ import com.google.gwt.user.client.ui.RootPanel;
public class SpeciesDiscovery implements EntryPoint { public class SpeciesDiscovery implements EntryPoint {
public static final String SPECIES_DISCOVERY_DIV = "SpeciesDiscovery"; public static final String SPECIES_DISCOVERY_DIV = "SpeciesDiscovery";
public static TaxonomySearchServiceAsync taxonomySearchService = GWT.create(TaxonomySearchService.class); public static TaxonomySearchServiceAsync taxonomySearchService = GWT.create(TaxonomySearchService.class);
public static GISInfoServiceAsync gisInfoService=GWT.create(GISInfoService.class); public static GISInfoServiceAsync gisInfoService=GWT.create(GISInfoService.class);
protected ContentPanel mainPanel; protected ContentPanel mainPanel;
/** /**
@ -38,11 +38,11 @@ public class SpeciesDiscovery implements EntryPoint {
public void onModuleLoad() { public void onModuleLoad() {
Log.setUncaughtExceptionHandler(); Log.setUncaughtExceptionHandler();
boolean jQueryLoaded = isjQueryLoaded(); boolean jQueryLoaded = isjQueryLoaded();
GWT.log("jQueryLoaded: "+jQueryLoaded); GWT.log("jQueryLoaded: "+jQueryLoaded);
// GWT.log("Injected : "+Resources.RESOURCES.jquery().getText()); // GWT.log("Injected : "+Resources.RESOURCES.jquery().getText());
if (!isjQueryLoaded()) { if (!isjQueryLoaded()) {
ScriptInjector.fromString(Resources.RESOURCES.jquery().getText()) ScriptInjector.fromString(Resources.RESOURCES.jquery().getText())
.setWindow(ScriptInjector.TOP_WINDOW) .setWindow(ScriptInjector.TOP_WINDOW)
@ -54,7 +54,7 @@ public class SpeciesDiscovery implements EntryPoint {
@Override @Override
public void execute() { public void execute() {
onModuleLoad2(); onModuleLoad2();
Window.addResizeHandler(new ResizeHandler() { Window.addResizeHandler(new ResizeHandler() {
@Override @Override
@ -63,11 +63,11 @@ public class SpeciesDiscovery implements EntryPoint {
} }
}); });
} }
}); });
} }
/** /**
* Checks if is j query loaded. * Checks if is j query loaded.
* *
@ -94,7 +94,7 @@ public class SpeciesDiscovery implements EntryPoint {
// mainPanel.setWidth(930); // mainPanel.setWidth(930);
RootPanel.get().add(mainPanel); RootPanel.get().add(mainPanel);
} }
} }

View File

@ -13,6 +13,7 @@ import org.gcube.portlets.user.speciesdiscovery.client.event.SearchEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SearchStartedEvent; import org.gcube.portlets.user.speciesdiscovery.client.event.SearchStartedEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SearchStartedEventHandler; import org.gcube.portlets.user.speciesdiscovery.client.event.SearchStartedEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.SearchTypeSelectedEvent; import org.gcube.portlets.user.speciesdiscovery.client.event.SearchTypeSelectedEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.StopCurrentSearchEvent;
import org.gcube.portlets.user.speciesdiscovery.client.filterresult.ResultFilterPanelManager; import org.gcube.portlets.user.speciesdiscovery.client.filterresult.ResultFilterPanelManager;
import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources; import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources;
import org.gcube.portlets.user.speciesdiscovery.client.window.HelpQueryWindow; import org.gcube.portlets.user.speciesdiscovery.client.window.HelpQueryWindow;
@ -20,6 +21,7 @@ import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchType; import org.gcube.portlets.user.speciesdiscovery.shared.SearchType;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability; import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import com.allen_sauer.gwt.log.client.Log;
import com.extjs.gxt.ui.client.Style.VerticalAlignment; import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.event.ButtonEvent; import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent; import com.extjs.gxt.ui.client.event.ComponentEvent;
@ -50,14 +52,18 @@ import com.google.gwt.user.client.ui.Button;
/** /**
* The Class SpeciesSearchFormPanel.
* *
* @author "Federico De Faveri defaveri@isti.cnr.it" - Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author "Federico De Faveri defaveri@isti.cnr.it" - Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/ */
public class SpeciesSearchFormPanel extends ContentPanel { public class SpeciesSearchFormPanel extends ContentPanel {
protected static final String EXSEARCH = "e.g. sarda sarda, solea solea"; protected static final String EXSEARCH = "e.g. sarda sarda, solea solea";
protected Button buttSimpleSearch; protected Button buttSimpleSearch;
protected Button buttQuerySearch;
protected Button buttQueryExample;
private Button buttQueryStopSearch;
protected Button buttSimpleExample; protected Button buttSimpleExample;
protected Button buttSimpleStopSearch;
protected SimpleComboBox<String> searchType; protected SimpleComboBox<String> searchType;
protected SimpleComboBox<String> searchTypeResults; protected SimpleComboBox<String> searchTypeResults;
protected EventBus eventBus; protected EventBus eventBus;
@ -71,6 +77,12 @@ public class SpeciesSearchFormPanel extends ContentPanel {
private AdvancedSearchPanelManager advSearchPanelsManager = AdvancedSearchPanelManager.getInstance(); private AdvancedSearchPanelManager advSearchPanelsManager = AdvancedSearchPanelManager.getInstance();
private final int DEFAULTLINKPANELTHEIGHT = 22; private final int DEFAULTLINKPANELTHEIGHT = 22;
/**
* The Enum SEARCHTYPE.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 16, 2017
*/
public static enum SEARCHTYPE {SIMPLE, FULLTEXT}; public static enum SEARCHTYPE {SIMPLE, FULLTEXT};
public TextArea textArea = new TextArea(); public TextArea textArea = new TextArea();
@ -82,11 +94,16 @@ public class SpeciesSearchFormPanel extends ContentPanel {
private HorizontalPanel simpleSearchPanel = new HorizontalPanel(); private HorizontalPanel simpleSearchPanel = new HorizontalPanel();
private HorizontalPanel querySeachPanel = new HorizontalPanel(); private HorizontalPanel querySeachPanel = new HorizontalPanel();
protected Button buttQuerySearch;
protected Button buttQueryExample;
protected CheckBox checkValidateOccurrences = new CheckBox(); protected CheckBox checkValidateOccurrences = new CheckBox();
/**
* Instantiates a new species search form panel.
*
* @param eventBus the event bus
*/
public SpeciesSearchFormPanel(EventBus eventBus) { public SpeciesSearchFormPanel(EventBus eventBus) {
this.eventBus = eventBus; this.eventBus = eventBus;
@ -109,13 +126,15 @@ public class SpeciesSearchFormPanel extends ContentPanel {
initComboSearchTypeResult(); initComboSearchTypeResult();
init(); init();
visibleButtonStopSearch(false); //abort must be hidden on init
switchSearchType(SEARCHTYPE.SIMPLE); switchSearchType(SEARCHTYPE.SIMPLE);
add(advSearchPanelsManager.getPanel()); add(advSearchPanelsManager.getPanel());
} }
/**
* Inits the combo search type.
*/
private void initComboSearchType(){ private void initComboSearchType(){
searchType = new SimpleComboBox<String>(); searchType = new SimpleComboBox<String>();
@ -124,7 +143,6 @@ public class SpeciesSearchFormPanel extends ContentPanel {
searchType.setTriggerAction(TriggerAction.ALL); searchType.setTriggerAction(TriggerAction.ALL);
searchType.setSimpleValue(ConstantsSpeciesDiscovery.SCIENTIFIC_NAME); searchType.setSimpleValue(ConstantsSpeciesDiscovery.SCIENTIFIC_NAME);
searchType.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() { searchType.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() {
@Override @Override
@ -136,6 +154,9 @@ public class SpeciesSearchFormPanel extends ContentPanel {
} }
/**
* Inits the combo search type result.
*/
private void initComboSearchTypeResult(){ private void initComboSearchTypeResult(){
searchTypeResults = new SimpleComboBox<String>(); searchTypeResults = new SimpleComboBox<String>();
@ -156,10 +177,21 @@ public class SpeciesSearchFormPanel extends ContentPanel {
} }
//RETURN RESULT ITEM OR TAXOMONY ITEM //RETURN RESULT ITEM OR TAXOMONY ITEM
/**
* Gets the selected capability.
*
* @return the selected capability
*/
public SpeciesCapability getSelectedCapability(){ public SpeciesCapability getSelectedCapability(){
return getCapability(searchTypeResults.getValue().getValue()); return getCapability(searchTypeResults.getValue().getValue());
} }
/**
* Gets the capability.
*
* @param value the value
* @return the capability
*/
private SpeciesCapability getCapability(String value){ private SpeciesCapability getCapability(String value){
if(value.compareTo(SpeciesCapability.TAXONOMYITEM.getName())==0) if(value.compareTo(SpeciesCapability.TAXONOMYITEM.getName())==0)
return SpeciesCapability.TAXONOMYITEM; return SpeciesCapability.TAXONOMYITEM;
@ -175,6 +207,12 @@ public class SpeciesSearchFormPanel extends ContentPanel {
return SpeciesCapability.UNKNOWN; return SpeciesCapability.UNKNOWN;
} }
/**
* Gets the search type.
*
* @param value the value
* @return the search type
*/
private SearchType getSearchType(String value){ private SearchType getSearchType(String value){
if(value.compareTo(ConstantsSpeciesDiscovery.SCIENTIFIC_NAME)==0) if(value.compareTo(ConstantsSpeciesDiscovery.SCIENTIFIC_NAME)==0)
@ -187,6 +225,11 @@ public class SpeciesSearchFormPanel extends ContentPanel {
} }
/**
* Switch search type.
*
* @param searchType the search type
*/
public void switchSearchType(SEARCHTYPE searchType){ public void switchSearchType(SEARCHTYPE searchType){
currentSearchType = searchType; currentSearchType = searchType;
@ -206,6 +249,9 @@ public class SpeciesSearchFormPanel extends ContentPanel {
} }
/**
* Inits the.
*/
protected void init() protected void init()
{ {
horizontalQueryPanel.setBorders(false); horizontalQueryPanel.setBorders(false);
@ -237,8 +283,12 @@ public class SpeciesSearchFormPanel extends ContentPanel {
add(horizontalQueryPanel); add(horizontalQueryPanel);
add(hpAdvancedSearchLinks); add(hpAdvancedSearchLinks);
} }
/**
* Inits the query search panel.
*/
private void initQuerySearchPanel() { private void initQuerySearchPanel() {
querySeachPanel.setSpacing(5); querySeachPanel.setSpacing(5);
@ -285,13 +335,29 @@ public class SpeciesSearchFormPanel extends ContentPanel {
querySeachPanel.add(buttQueryInfo); querySeachPanel.add(buttQueryInfo);
buttQueryStopSearch = new Button("Stop Search...");
buttQueryStopSearch.setTitle("Stops loading of the search results");
buttQueryStopSearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
eventBus.fireEvent(new StopCurrentSearchEvent());
}
});
buttQueryStopSearch.setStyleName("wizardButton");
querySeachPanel.add(buttQuerySearch); querySeachPanel.add(buttQuerySearch);
querySeachPanel.add(buttQueryExample); querySeachPanel.add(buttQueryExample);
querySeachPanel.add(buttQueryStopSearch);
} }
/**
* Inits the simple search panel.
*/
private void initSimpleSearchPanel() { private void initSimpleSearchPanel() {
simpleSearchPanel.setSpacing(5); simpleSearchPanel.setSpacing(5);
@ -336,14 +402,11 @@ public class SpeciesSearchFormPanel extends ContentPanel {
hpPanel.add(searchField); hpPanel.add(searchField);
checkValidateOccurrences.setBoxLabel("validate occurrences"); checkValidateOccurrences.setBoxLabel("validate occurrences");
checkValidateOccurrences.setValueAttribute("validate occurrences"); checkValidateOccurrences.setValueAttribute("validate occurrences");
checkValidateOccurrences.setStyleAttribute("margin-right", "10px"); checkValidateOccurrences.setStyleAttribute("margin-right", "10px");
buttSimpleSearch = new Button("Search"); buttSimpleSearch = new Button("Search");
buttSimpleSearch.addClickHandler(new ClickHandler() { buttSimpleSearch.addClickHandler(new ClickHandler() {
@Override @Override
@ -368,6 +431,19 @@ public class SpeciesSearchFormPanel extends ContentPanel {
buttSimpleExample.setStyleName("wizardButton"); buttSimpleExample.setStyleName("wizardButton");
hpPanel.add(buttSimpleExample); hpPanel.add(buttSimpleExample);
buttSimpleStopSearch = new Button("Stop Search...");
buttSimpleStopSearch.setTitle("Stops loading of the search results");
buttSimpleStopSearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
eventBus.fireEvent(new StopCurrentSearchEvent());
}
});
buttSimpleStopSearch.setStyleName("wizardButton");
hpPanel.add(buttSimpleStopSearch);
HorizontalPanel hpPanelExpand = new HorizontalPanel(); HorizontalPanel hpPanelExpand = new HorizontalPanel();
hpPanelExpand.setVerticalAlign(VerticalAlignment.MIDDLE); hpPanelExpand.setVerticalAlign(VerticalAlignment.MIDDLE);
@ -377,28 +453,63 @@ public class SpeciesSearchFormPanel extends ContentPanel {
textExpand.setStyleAttribute("margin-right", "5px"); textExpand.setStyleAttribute("margin-right", "5px");
vtPanel.add(hpPanel); vtPanel.add(hpPanel);
simpleSearchPanel.add(vtPanel); simpleSearchPanel.add(vtPanel);
} }
/**
* Gets the value check validate occcurrences.
*
* @return the value check validate occcurrences
*/
public boolean getValueCheckValidateOcccurrences(){ public boolean getValueCheckValidateOcccurrences(){
return this.checkValidateOccurrences.getValue(); return this.checkValidateOccurrences.getValue();
} }
/**
* Sets the value check validate occcurrences.
*
* @param bool the new value check validate occcurrences
*/
public void setValueCheckValidateOcccurrences(boolean bool){ public void setValueCheckValidateOcccurrences(boolean bool){
this.checkValidateOccurrences.setValue(bool); this.checkValidateOccurrences.setValue(bool);
} }
/**
* Sets the visible check validate occcurrences.
*
* @param bool the new visible check validate occcurrences
*/
public void setVisibleCheckValidateOcccurrences(boolean bool){ public void setVisibleCheckValidateOcccurrences(boolean bool){
this.checkValidateOccurrences.setVisible(bool); this.checkValidateOccurrences.setVisible(bool);
} }
/**
* Active button search.
*
* @param bool the bool
*/
public void activeButtonSearch(boolean bool){ public void activeButtonSearch(boolean bool){
buttSimpleSearch.setEnabled(bool); buttSimpleSearch.setEnabled(bool);
} }
/**
* Visible button stop search.
*
* @param bool the bool
*/
public void visibleButtonStopSearch(boolean bool){
Log.warn("Stop Search visible? "+bool);
buttSimpleStopSearch.setVisible(bool);
buttQueryStopSearch.setVisible(bool);
}
/**
* Creates the advanced seach links.
*/
private void createAdvancedSeachLinks() { private void createAdvancedSeachLinks() {
hpAdvancedSearchLinks.setVerticalAlign(VerticalAlignment.MIDDLE); hpAdvancedSearchLinks.setVerticalAlign(VerticalAlignment.MIDDLE);
@ -456,15 +567,16 @@ public class SpeciesSearchFormPanel extends ContentPanel {
} }
}); });
hpAdvancedSearchLinks.add(butt); hpAdvancedSearchLinks.add(butt);
} }
} }
/**
* Active advanced search.
*
* @param bool the bool
*/
private void activeAdvancedSearch(boolean bool){ private void activeAdvancedSearch(boolean bool){
if(bool){ if(bool){
@ -477,6 +589,9 @@ public class SpeciesSearchFormPanel extends ContentPanel {
} }
} }
/**
* Search.
*/
protected void search() protected void search()
{ {
@ -503,6 +618,22 @@ public class SpeciesSearchFormPanel extends ContentPanel {
} }
/**
* Search.
*
* @param searchTerm the search term
* @param upperBoundLongitude the upper bound longitude
* @param upperBoundLatitude the upper bound latitude
* @param lowerBoundLongitude the lower bound longitude
* @param lowerBoundLatitude the lower bound latitude
* @param fromDate the from date
* @param toDate the to date
* @param listDataSources the list data sources
* @param groupRank the group rank
* @param resultType the result type
* @param listDataSourceForSynonyms the list data source for synonyms
* @param listDataSourceForUnfold the list data source for unfold
*/
protected void search(String searchTerm, Number upperBoundLongitude, Number upperBoundLatitude, Number lowerBoundLongitude, Number lowerBoundLatitude, Date fromDate, Date toDate, List<DataSourceModel> listDataSources, String groupRank, SpeciesCapability resultType, List<DataSourceModel> listDataSourceForSynonyms, List<DataSourceModel> listDataSourceForUnfold) protected void search(String searchTerm, Number upperBoundLongitude, Number upperBoundLatitude, Number lowerBoundLongitude, Number lowerBoundLatitude, Date fromDate, Date toDate, List<DataSourceModel> listDataSources, String groupRank, SpeciesCapability resultType, List<DataSourceModel> listDataSourceForSynonyms, List<DataSourceModel> listDataSourceForUnfold)
{ {
mask("Searching..."); mask("Searching...");
@ -517,6 +648,11 @@ public class SpeciesSearchFormPanel extends ContentPanel {
} }
/**
* Search by query.
*
* @param query the query
*/
protected void searchByQuery(String query) protected void searchByQuery(String query)
{ {
if (query!=null && query.length()!=0) { if (query!=null && query.length()!=0) {
@ -527,6 +663,9 @@ public class SpeciesSearchFormPanel extends ContentPanel {
Info.display("No query specified", "There is not query specified"); Info.display("No query specified", "There is not query specified");
} }
/**
* Bind.
*/
protected void bind() protected void bind()
{ {
eventBus.addHandler(SearchStartedEvent.TYPE, new SearchStartedEventHandler() { eventBus.addHandler(SearchStartedEvent.TYPE, new SearchStartedEventHandler() {
@ -545,11 +684,17 @@ public class SpeciesSearchFormPanel extends ContentPanel {
}); });
} }
/**
* Enable search.
*/
protected void enableSearch() protected void enableSearch()
{ {
buttSimpleSearch.setEnabled(true); buttSimpleSearch.setEnabled(true);
} }
/**
* Disable search.
*/
protected void disableSearch() protected void disableSearch()
{ {
buttSimpleSearch.setEnabled(false); buttSimpleSearch.setEnabled(false);

View File

@ -30,19 +30,19 @@ import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.Label;
/** /**
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* *
*/ */
public class TabItemForTaxonomyRow { public class TabItemForTaxonomyRow {
private TabPanel tabPanel; private TabPanel tabPanel;
private AbstractImagePrototype imageLoading = AbstractImagePrototype.create(Resources.INSTANCE.loadingBalls()); private AbstractImagePrototype imageLoading = AbstractImagePrototype.create(Resources.INSTANCE.loadingBalls());
private EventBus eventBus; private EventBus eventBus;
// private List<TaxonomyRow> parents = null; // private List<TaxonomyRow> parents = null;
private TablesForTaxonomyRow tablesForTaxonomyRow; private TablesForTaxonomyRow tablesForTaxonomyRow;
private LightTaxonomyRow currentTaxonomy; private LightTaxonomyRow currentTaxonomy;
public void setCurrentTaxonomy(LightTaxonomyRow taxonomy){ public void setCurrentTaxonomy(LightTaxonomyRow taxonomy){
@ -58,31 +58,31 @@ public class TabItemForTaxonomyRow {
/** /**
* *
* @param taxonomy * @param taxonomy
* @param isNewTab - set true if has been clicked a classification link, or false otherwise * @param isNewTab - set true if has been clicked a classification link, or false otherwise
* @return * @return
*/ */
public VerticalPanel getPanelClassificationForTaxonomy(LightTaxonomyRow taxonomy, String dataSource, boolean isNewTab){ public VerticalPanel getPanelClassificationForTaxonomy(LightTaxonomyRow taxonomy, String dataSource, boolean isNewTab){
VerticalPanel vpClassification = new VerticalPanel(); VerticalPanel vpClassification = new VerticalPanel();
vpClassification.setSpacing(5); vpClassification.setSpacing(5);
if(taxonomy!=null){ if(taxonomy!=null){
//CREATE CLASSIFICATION FOR PARENT ITEM //CREATE CLASSIFICATION FOR PARENT ITEM
int parentsSize = taxonomy.getParents().size(); int parentsSize = taxonomy.getParents().size();
for(int i=parentsSize-1; i>=0; i--){ for(int i=parentsSize-1; i>=0; i--){
createPanelForParentTaxonomy(taxonomy.getParents().get(i), vpClassification, taxonomy.getServiceId(), isNewTab, dataSource, i+1); createPanelForParentTaxonomy(taxonomy.getParents().get(i), vpClassification, taxonomy.getServiceId(), isNewTab, dataSource, i+1);
} }
//CREATE CLASSIFICATION FOR ITEM //CREATE CLASSIFICATION FOR ITEM
createPanelForParentTaxonomy(taxonomy, vpClassification, taxonomy.getServiceId(), isNewTab, dataSource, 0); createPanelForParentTaxonomy(taxonomy, vpClassification, taxonomy.getServiceId(), isNewTab, dataSource, 0);
} }
return vpClassification; return vpClassification;
} }
/** /**
@ -90,22 +90,22 @@ public class TabItemForTaxonomyRow {
* @param taxon * @param taxon
* @param vpClassification * @param vpClassification
* @param taxonomyServiceId * @param taxonomyServiceId
* @param isNewTab * @param isNewTab
* @param parentIndex * @param parentIndex
*/ */
public void createPanelForParentTaxonomy(LightTaxonomyRow taxon, VerticalPanel vpClassification, String taxonomyServiceId, boolean isNewTab, String dataSource, int parentIndex){ public void createPanelForParentTaxonomy(LightTaxonomyRow taxon, VerticalPanel vpClassification, String taxonomyServiceId, boolean isNewTab, String dataSource, int parentIndex){
if(taxon==null) if(taxon==null)
return; return;
// createPanelForParentTaxonomy(taxon.getParents(), vpClassification, taxonomyServiceId, isNewTab, dataSource); // createPanelForParentTaxonomy(taxon.getParents(), vpClassification, taxonomyServiceId, isNewTab, dataSource);
HorizontalPanel hp = new HorizontalPanel(); HorizontalPanel hp = new HorizontalPanel();
Text labelRank; Text labelRank;
if(!NormalizeString.isUndefined(taxon.getRank())) if(!NormalizeString.isUndefined(taxon.getRank()))
labelRank = new Text(taxon.getRank()+":"); labelRank = new Text(taxon.getRank()+":");
else else
labelRank = new Text("Rank not found"+":"); labelRank = new Text("Rank not found"+":");
// labelRank.setStyleAttribute("margin-right", "10px"); // labelRank.setStyleAttribute("margin-right", "10px");
hp.add(labelRank); hp.add(labelRank);
hp.setCellWidth(labelRank, "120px"); hp.setCellWidth(labelRank, "120px");
@ -119,72 +119,72 @@ public class TabItemForTaxonomyRow {
// System.out.println("taxon.getName()" +taxon.getName() + " serviceid : "+taxon.getServiceId() + " taxonomyServiceId "+taxonomyServiceId); // System.out.println("taxon.getName()" +taxon.getName() + " serviceid : "+taxon.getServiceId() + " taxonomyServiceId "+taxonomyServiceId);
// System.out.println("taxon.getServiceId().compareTo(taxonomyServiceId)==0 "+ taxon.getServiceId().compareTo(taxonomyServiceId)); // System.out.println("taxon.getServiceId().compareTo(taxonomyServiceId)==0 "+ taxon.getServiceId().compareTo(taxonomyServiceId));
// System.out.println("isNewTab"+ isNewTab); // System.out.println("isNewTab"+ isNewTab);
if((taxon.getServiceId().compareTo(taxonomyServiceId)==0) && isNewTab){ if(taxon.getServiceId().compareTo(taxonomyServiceId)==0 && isNewTab){
loadChildrenListOfItem(vpClassification, taxon, dataSource, taxon.getName(), -1); //parentIndex == -1 means that parent is currentTaxonomy loadChildrenListOfItem(vpClassification, taxon, dataSource, taxon.getName(), -1); //parentIndex == -1 means that parent is currentTaxonomy
} }
} }
private void loadChildrenListOfItem(final VerticalPanel vpClassification, final LightTaxonomyRow taxonomyItem, final String dataSource, final String parentName, final int parentIndex){ private void loadChildrenListOfItem(final VerticalPanel vpClassification, final LightTaxonomyRow taxonomyItem, final String dataSource, final String parentName, final int parentIndex){
final ContentPanel cp = new ContentPanel(); final ContentPanel cp = new ContentPanel();
cp.setId("cp" + taxonomyItem.getId()); cp.setId("cp" + taxonomyItem.getId());
cp.setHeaderVisible(false); cp.setHeaderVisible(false);
cp.setBodyBorder(false); cp.setBodyBorder(false);
cp.add(imageLoading.createImage()); cp.add(imageLoading.createImage());
vpClassification.add(cp); vpClassification.add(cp);
//FOR DEBUG //FOR DEBUG
// TaxonomyRow printParent = taxonomyItem; // TaxonomyRow printParent = taxonomyItem;
// System.out.println("Load child of item name: " + parentName + " parent id: " + taxonomyItem.getServiceId()); // System.out.println("Load child of item name: " + parentName + " parent id: " + taxonomyItem.getServiceId());
// while(printParent!=null){ // while(printParent!=null){
// //
// System.out.println("Parent Name: " + printParent.getName() + " parent id: " +printParent.getServiceId()); // System.out.println("Parent Name: " + printParent.getName() + " parent id: " +printParent.getServiceId());
// printParent = printParent.getParent(); // printParent = printParent.getParent();
// } // }
SpeciesDiscovery.taxonomySearchService.loadListChildrenByParentId(taxonomyItem.getServiceId(), new AsyncCallback<ArrayList<LightTaxonomyRow>>() { SpeciesDiscovery.taxonomySearchService.loadListChildrenByParentId(taxonomyItem.getServiceId(), new AsyncCallback<ArrayList<LightTaxonomyRow>>() {
@Override @Override
public void onSuccess(ArrayList<LightTaxonomyRow> result) { public void onSuccess(ArrayList<LightTaxonomyRow> result) {
Log.trace("Children returned in client: " + result.size() + " for parentName " +parentName); Log.trace("Children returned in client: " + result.size() + " for parentName " +parentName);
LayoutContainer lc = new LayoutContainer(); LayoutContainer lc = new LayoutContainer();
lc.setLayout(new ColumnLayout()); lc.setLayout(new ColumnLayout());
vpClassification.remove(cp); vpClassification.remove(cp);
HorizontalPanel hp = new HorizontalPanel(); HorizontalPanel hp = new HorizontalPanel();
Text labelRank = new Text("Rank not found:"); Text labelRank = new Text("Rank not found:");
hp.add(labelRank); hp.add(labelRank);
hp.setCellWidth(labelRank, "120px"); hp.setCellWidth(labelRank, "120px");
boolean setRank = false; boolean setRank = false;
if(result.size()>0){ if(result.size()>0){
for (int i=0; i<result.size()-1; i++) { for (int i=0; i<result.size()-1; i++) {
LightTaxonomyRow taxonomy = result.get(i); LightTaxonomyRow taxonomy = result.get(i);
// //FOR DEBUG // //FOR DEBUG
// System.out.println("child "+taxonomy); // System.out.println("child "+taxonomy);
//SET PARENTS //SET PARENTS
taxonomy.setParent(Arrays.asList(taxonomyItem)); taxonomy.setParent(Arrays.asList(taxonomyItem));
//SET RANK IF IS NOT EMPTY //SET RANK IF IS NOT EMPTY
if(!setRank) if(!setRank)
setRank = replaceLabelRank(hp, labelRank, taxonomy.getRank()); setRank = replaceLabelRank(hp, labelRank, taxonomy.getRank());
Text comma = new Text(","); Text comma = new Text(",");
comma.setStyleAttribute("margin-right", "5px"); comma.setStyleAttribute("margin-right", "5px");
lc.add(getAnchorByTaxonomy(taxonomy, dataSource, parentIndex)); lc.add(getAnchorByTaxonomy(taxonomy, dataSource, parentIndex));
lc.add(comma); lc.add(comma);
} }
LightTaxonomyRow taxonomy = result.get(result.size()-1); LightTaxonomyRow taxonomy = result.get(result.size()-1);
if(!setRank) if(!setRank)
setRank = replaceLabelRank(hp, labelRank, taxonomy.getRank()); setRank = replaceLabelRank(hp, labelRank, taxonomy.getRank());
// //FOR DEBUG // //FOR DEBUG
// System.out.println("last child "+taxonomy); // System.out.println("last child "+taxonomy);
//SET PARENTS //SET PARENTS
@ -194,117 +194,117 @@ public class TabItemForTaxonomyRow {
else{ else{
hp.remove(labelRank); hp.remove(labelRank);
} }
hp.add(lc); hp.add(lc);
hp.setCellHorizontalAlignment(lc, HorizontalPanel.ALIGN_LEFT); hp.setCellHorizontalAlignment(lc, HorizontalPanel.ALIGN_LEFT);
vpClassification.add(hp); vpClassification.add(hp);
vpClassification.layout(); vpClassification.layout();
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Info.display("Error laoding child", "An error occurred in loading, retry."); Info.display("Error laoding child", "An error occurred in loading, retry.");
Log.error("Error laoding child", "An error occurred in loading, retry." +caught); Log.error("Error laoding child", "An error occurred in loading, retry." +caught);
} }
}); });
vpClassification.layout(); vpClassification.layout();
// hp.add(child) // hp.add(child)
} }
/** /**
* *
* @param hp * @param hp
* @param oldLabelRank * @param oldLabelRank
* @param rank * @param rank
* @return true if label is replaced * @return true if label is replaced
*/ */
private boolean replaceLabelRank(HorizontalPanel hp, Text oldLabelRank, String rank){ private boolean replaceLabelRank(HorizontalPanel hp, Text oldLabelRank, String rank){
//SET NEW LABEL RANK IF IS NOT EMPTY //SET NEW LABEL RANK IF IS NOT EMPTY
if(!NormalizeString.isUndefined(rank)){ if(!NormalizeString.isUndefined(rank)){
// System.out.println("In if Taxonomy set rank " + taxonomy.getRank()); // System.out.println("In if Taxonomy set rank " + taxonomy.getRank());
hp.remove(oldLabelRank); hp.remove(oldLabelRank);
Text setlabelRank = new Text(rank+":"); Text setlabelRank = new Text(rank+":");
hp.add(setlabelRank); hp.add(setlabelRank);
hp.setCellWidth(setlabelRank, "120px"); hp.setCellWidth(setlabelRank, "120px");
return true; return true;
} }
return false; return false;
} }
/** /**
* *
* @param taxon * @param taxon
* @param dataSource * @param dataSource
* @param parentIndex - if parent index is equal -1.. the method set parent item of taxon as currentItem * @param parentIndex - if parent index is equal -1.. the method set parent item of taxon as currentItem
* if parent index is equal -2.. the method not set parents of taxon * if parent index is equal -2.. the method not set parents of taxon
* @return * @return
*/ */
private Anchor getAnchorByTaxonomy(final LightTaxonomyRow taxon, final String dataSource, final int parentIndex) private Anchor getAnchorByTaxonomy(final LightTaxonomyRow taxon, final String dataSource, final int parentIndex)
{ {
Anchor anchor = null; Anchor anchor = null;
if(taxon!=null){ if(taxon!=null){
anchor = new Anchor("<nobr>"+taxon.getName()+"</nobr>", true); anchor = new Anchor("<nobr>"+taxon.getName()+"</nobr>", true);
anchor.addClickHandler(new ClickHandler() { anchor.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
// System.out.println("parent index: "+parentIndex + " size "+currentTaxonomy.getParents().size()); // System.out.println("parent index: "+parentIndex + " size "+currentTaxonomy.getParents().size());
if(parentIndex >=0 && parentIndex<=currentTaxonomy.getParents().size()){ if(parentIndex >=0 && parentIndex<=currentTaxonomy.getParents().size()){
// System.out.println("set parent true"); // System.out.println("set parent true");
taxon.setParent(currentTaxonomy.getParents().subList(parentIndex, currentTaxonomy.getParents().size())); taxon.setParent(currentTaxonomy.getParents().subList(parentIndex, currentTaxonomy.getParents().size()));
} }
else if(parentIndex == -1){ //items loaded from get children - the current Taxonomy item is the parent else if(parentIndex == -1){ //items loaded from get children - the current Taxonomy item is the parent
List<LightTaxonomyRow> list = new ArrayList<LightTaxonomyRow>(); List<LightTaxonomyRow> list = new ArrayList<LightTaxonomyRow>();
list.add(currentTaxonomy); list.add(currentTaxonomy);
list.addAll(currentTaxonomy.getParents()); list.addAll(currentTaxonomy.getParents());
// System.out.println("parentIndex == -1"); // System.out.println("parentIndex == -1");
printParents(taxon); printParents(taxon);
taxon.setParent(list); taxon.setParent(list);
} }
printParents(taxon); printParents(taxon);
tablesForTaxonomyRow.addTabItem(taxon, dataSource); tablesForTaxonomyRow.addTabItem(taxon, dataSource);
} }
}); });
} }
return anchor; return anchor;
} }
void printParents(LightTaxonomyRow taxon){ void printParents(LightTaxonomyRow taxon){
System.out.println("principal "+taxon.getName()); System.out.println("principal "+taxon.getName());
int i = 0; int i = 0;
for (LightTaxonomyRow tax : taxon.getParents()) { for (LightTaxonomyRow tax : taxon.getParents()) {
System.out.println(++i + " parent name " + tax.getName()); System.out.println(++i + " parent name " + tax.getName());
} }
} }
private Text getLabelByTaxonomy(final TaxonomyRow taxon) private Text getLabelByTaxonomy(final TaxonomyRow taxon)
{ {
Text label = null; Text label = null;
if(taxon!=null){ if(taxon!=null){
if(!NormalizeString.isUndefined(taxon.getName())) if(!NormalizeString.isUndefined(taxon.getName()))
label = new Text(taxon.getName()); label = new Text(taxon.getName());
@ -315,64 +315,64 @@ public class TabItemForTaxonomyRow {
} }
// public Html getHTMLTableForTaxonomy(TaxonomyRow row, boolean isNewTab){ // public Html getHTMLTableForTaxonomy(TaxonomyRow row, boolean isNewTab){
// //
// //Init values // //Init values
// String dataProviderName = ""; // String dataProviderName = "";
// String dataSetCitation= ""; // String dataSetCitation= "";
// String matchingAccordionTo= ""; // String matchingAccordionTo= "";
// String rank= ""; // String rank= "";
//// String matchingCredits= ""; //// String matchingCredits= "";
// //
// String statusName = ""; // String statusName = "";
// String dateModified = ""; // String dateModified = "";
// String statusRemark = ""; // String statusRemark = "";
// //
// String author = ""; // String author = "";
// String lsid = ""; // String lsid = "";
// String credits = ""; // String credits = "";
// //
// String propertiesHtml = ""; // String propertiesHtml = "";
// //
// if(row.getDataProviderName()!=null) dataProviderName = row.getDataProviderName(); // if(row.getDataProviderName()!=null) dataProviderName = row.getDataProviderName();
// if(row.getStatusName()!=null) statusName = row.getStatusName(); // if(row.getStatusName()!=null) statusName = row.getStatusName();
// if(row.getDateModified()!=null) dateModified = row.getDateModified(); // if(row.getDateModified()!=null) dateModified = row.getDateModified();
// //
// if(row.getDataSetCitation()!=null) dataSetCitation = row.getDataSetCitation(); // if(row.getDataSetCitation()!=null) dataSetCitation = row.getDataSetCitation();
// if(row.getRank()!=null) rank = row.getRank(); // if(row.getRank()!=null) rank = row.getRank();
// if(row.getAccordingTo()!=null) matchingAccordionTo = row.getAccordingTo(); // if(row.getAccordingTo()!=null) matchingAccordionTo = row.getAccordingTo();
// //
// if(row.getStatusRemarks()!=null) statusRemark = row.getStatusRemarks(); // if(row.getStatusRemarks()!=null) statusRemark = row.getStatusRemarks();
// //
// if(row.getAuthor()!=null) author = row.getAuthor(); // if(row.getAuthor()!=null) author = row.getAuthor();
// //
// if(row.getLsid()!=null) lsid = row.getLsid(); // if(row.getLsid()!=null) lsid = row.getLsid();
// //
// if(row.getCredits()!=null) credits = row.getCredits(); // if(row.getCredits()!=null) credits = row.getCredits();
// //
// //
// if(row.getProperties()!=null){ // if(row.getProperties()!=null){
// //
// List<ItemParameter> hashProperties = row.getProperties(); // List<ItemParameter> hashProperties = row.getProperties();
// Collections.sort(hashProperties, ItemParameter.COMPARATOR); // Collections.sort(hashProperties, ItemParameter.COMPARATOR);
// //
// propertiesHtml+="<table class=\"parameters\">"; // propertiesHtml+="<table class=\"parameters\">";
// //
// for (ItemParameter itemParameter : hashProperties) { // for (ItemParameter itemParameter : hashProperties) {
// //
// propertiesHtml+= // propertiesHtml+=
// "<tr>" + // "<tr>" +
// " <td class=\"title\">"+itemParameter.getKey()+"</td>" + // " <td class=\"title\">"+itemParameter.getKey()+"</td>" +
// " <td>"+itemParameter.getValue()+"</td>" + // " <td>"+itemParameter.getValue()+"</td>" +
// "</tr>"; // "</tr>";
// } // }
// //
// propertiesHtml+="</table>"; // propertiesHtml+="</table>";
// } // }
// //
// //
// //Create list common name // //Create list common name
// String commonNames = ""; // String commonNames = "";
// //
//// if(isNewTab){ //// if(isNewTab){
// if(row.getCommonNames()!=null){ // if(row.getCommonNames()!=null){
// for (CommonName comName : row.getCommonNames()) { // for (CommonName comName : row.getCommonNames()) {
@ -380,10 +380,10 @@ public class TabItemForTaxonomyRow {
// } // }
// } // }
//// } //// }
// //
// //
// String table = "<table class=\"imagetable\">"; // String table = "<table class=\"imagetable\">";
// //
//// if(isNewTab) //// if(isNewTab)
// table+= // table+=
// "<tr>" + // "<tr>" +
@ -432,7 +432,7 @@ public class TabItemForTaxonomyRow {
// " <td class=\"title\">"+TaxonomyGridField.CREDITS.getName()+"</td>" + // " <td class=\"title\">"+TaxonomyGridField.CREDITS.getName()+"</td>" +
// " <td>"+credits+"</td>" + // " <td>"+credits+"</td>" +
// "</tr>" + // "</tr>" +
// //
// "<tr>" + // "<tr>" +
// " <td class=\"title\">"+TaxonomyGridField.PROPERTIES.getName()+"</td>" + // " <td class=\"title\">"+TaxonomyGridField.PROPERTIES.getName()+"</td>" +
// " <td>"+propertiesHtml+"</td>" + // " <td>"+propertiesHtml+"</td>" +
@ -440,10 +440,10 @@ public class TabItemForTaxonomyRow {
// //
// "</table>"; // "</table>";
// return new Html(table); // return new Html(table);
// //
// } // }
// //
// public FlexTable getHTMLTableForTaxonomyWithRef(final LightTaxonomyRow row,boolean isNewTab, final String dataSource) { // public FlexTable getHTMLTableForTaxonomyWithRef(final LightTaxonomyRow row,boolean isNewTab, final String dataSource) {
// //
// // Init values // // Init values
@ -537,12 +537,12 @@ public class TabItemForTaxonomyRow {
// if (refId != null) { // if (refId != null) {
// //
// final String status; // final String status;
// //
// if(!statusRemark.isEmpty()) // if(!statusRemark.isEmpty())
// status = statusRemark; // status = statusRemark;
// else // else
// status = statusName; // status = statusName;
// //
// final String referenceId = refId; // final String referenceId = refId;
// //
// flexTable.setWidget(2, 0, new Label(TaxonomyGridField.STATUS_REMARKS.getName())); // flexTable.setWidget(2, 0, new Label(TaxonomyGridField.STATUS_REMARKS.getName()));
@ -580,7 +580,7 @@ public class TabItemForTaxonomyRow {
// flexTable.setWidget(2, 1, new Label(statusRemark)); // flexTable.setWidget(2, 1, new Label(statusRemark));
// } // }
// //
// //
// //Create row get synonyms // //Create row get synonyms
// flexTable.setWidget(3, 0,new Label(TaxonomyGridField.SYNONYMS.getName())); // flexTable.setWidget(3, 0,new Label(TaxonomyGridField.SYNONYMS.getName()));
// //
@ -596,25 +596,25 @@ public class TabItemForTaxonomyRow {
// @Override // @Override
// public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
// flexTable.remove(imageSynonyms); // flexTable.remove(imageSynonyms);
// //
//// DEBUG //// DEBUG
//// System.out.println("getSynonyms of "+row.getName() + " serviceId "+row.getServiceId()); //// System.out.println("getSynonyms of "+row.getName() + " serviceId "+row.getServiceId());
// //
// //
// if(row.getParents().size()>0){ // if(row.getParents().size()>0){
// //
// //
// //TODO // //TODO
// getSynonymsByReferenceId(flexTable, 3, 1, row.getServiceId(),dataSource, row.getParents()); // getSynonymsByReferenceId(flexTable, 3, 1, row.getServiceId(),dataSource, row.getParents());
// //
// //
// //
// } // }
// } // }
// }); // });
// //
// flexTable.setWidget(3, 1, imageSynonyms); // flexTable.setWidget(3, 1, imageSynonyms);
// //
// //
// flexTable.setWidget(4, 0,new Label(TaxonomyGridField.DATASOURCE.getName())); // flexTable.setWidget(4, 0,new Label(TaxonomyGridField.DATASOURCE.getName()));
// flexTable.setWidget(4, 1, new Label(dataProviderName)); // flexTable.setWidget(4, 1, new Label(dataProviderName));
@ -652,134 +652,134 @@ public class TabItemForTaxonomyRow {
// return flexTable; // return flexTable;
// //
// } // }
public void getSynonymsByReferenceId(FlexTable flexTable, int row, int col, String refId, final String dataSource, final List<LightTaxonomyRow> parents){ public void getSynonymsByReferenceId(FlexTable flexTable, int row, int col, String refId, final String dataSource, final List<LightTaxonomyRow> parents){
final LayoutContainer layoutContainer = new LayoutContainer(); final LayoutContainer layoutContainer = new LayoutContainer();
final Image loading = AbstractImagePrototype.create(Resources.INSTANCE.loadingBalls()).createImage(); final Image loading = AbstractImagePrototype.create(Resources.INSTANCE.loadingBalls()).createImage();
layoutContainer.add(loading); layoutContainer.add(loading);
flexTable.setWidget(row, col, layoutContainer); flexTable.setWidget(row, col, layoutContainer);
SpeciesDiscovery.taxonomySearchService.retrieveSynonymsByRefId(refId, new AsyncCallback<List<LightTaxonomyRow>>() { SpeciesDiscovery.taxonomySearchService.retrieveSynonymsByRefId(refId, new AsyncCallback<List<LightTaxonomyRow>>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Info.display("Error laoding child", "An error occurred in loading, retry."); Info.display("Error laoding child", "An error occurred in loading, retry.");
Log.error("Error laoding child", "An error occurred in loading, retry." +caught); Log.error("Error laoding child", "An error occurred in loading, retry." +caught);
} }
@Override @Override
public void onSuccess(List<LightTaxonomyRow> result) { public void onSuccess(List<LightTaxonomyRow> result) {
Log.trace("getReferenceById return " +result.size() + " items"); Log.trace("getReferenceById return " +result.size() + " items");
// System.out.println("getReferenceById return " +result.size() + " items"); // System.out.println("getReferenceById return " +result.size() + " items");
if(result.size()>0){ if(result.size()>0){
layoutContainer.remove(loading); layoutContainer.remove(loading);
LayoutContainer lc = new LayoutContainer(); LayoutContainer lc = new LayoutContainer();
lc.setLayout(new ColumnLayout()); lc.setLayout(new ColumnLayout());
if(result.size()>0){ if(result.size()>0){
for (int i=0; i<result.size()-1; i++) { for (int i=0; i<result.size()-1; i++) {
LightTaxonomyRow taxonomy = result.get(i); LightTaxonomyRow taxonomy = result.get(i);
// System.out.println("child "+taxonomy); // System.out.println("child "+taxonomy);
//SET PARENTS //SET PARENTS
taxonomy.setParent(parents); taxonomy.setParent(parents);
Text comma = new Text(","); Text comma = new Text(",");
comma.setStyleAttribute("margin-right", "5px"); comma.setStyleAttribute("margin-right", "5px");
lc.add(getAnchorByTaxonomy(taxonomy, dataSource,-2)); lc.add(getAnchorByTaxonomy(taxonomy, dataSource,-2));
lc.add(comma); lc.add(comma);
} }
LightTaxonomyRow taxonomy = result.get(result.size()-1); LightTaxonomyRow taxonomy = result.get(result.size()-1);
// System.out.println("child "+taxonomy); // System.out.println("child "+taxonomy);
//SET PARENTS //SET PARENTS
taxonomy.setParent(parents); taxonomy.setParent(parents);
lc.add(getAnchorByTaxonomy(taxonomy, dataSource,-2)); lc.add(getAnchorByTaxonomy(taxonomy, dataSource,-2));
} }
layoutContainer.add(lc); layoutContainer.add(lc);
} }
else{ else{
layoutContainer.remove(loading); layoutContainer.remove(loading);
layoutContainer.add(new Label("not found")); layoutContainer.add(new Label("not found"));
} }
layoutContainer.layout(); layoutContainer.layout();
} }
}); });
} }
public void getTaxonomyByReferenceId(FlexTable flexTable, int row, int col, final String statusRemark, String refId, final String dataSource, final List<LightTaxonomyRow> parents){ public void getTaxonomyByReferenceId(FlexTable flexTable, int row, int col, final String statusRemark, String refId, final String dataSource, final List<LightTaxonomyRow> parents){
final LayoutContainer layoutContainer = new LayoutContainer(); final LayoutContainer layoutContainer = new LayoutContainer();
// hp.getElement().getStyle().setBorderStyle(BorderStyle.NONE); // hp.getElement().getStyle().setBorderStyle(BorderStyle.NONE);
// hp.getElement().getStyle().setBorderWidth(0, Unit.PX); // hp.getElement().getStyle().setBorderWidth(0, Unit.PX);
final Label status = new Label(statusRemark); final Label status = new Label(statusRemark);
layoutContainer.add(status); layoutContainer.add(status);
// hp.setCellWidth(status, "160px"); // hp.setCellWidth(status, "160px");
final Image loading = AbstractImagePrototype.create(Resources.INSTANCE.loadingBalls()).createImage(); final Image loading = AbstractImagePrototype.create(Resources.INSTANCE.loadingBalls()).createImage();
layoutContainer.add(loading); layoutContainer.add(loading);
flexTable.setWidget(row, col, layoutContainer); flexTable.setWidget(row, col, layoutContainer);
List<String> listId = new ArrayList<String>(); List<String> listId = new ArrayList<String>();
listId.add(refId); listId.add(refId);
SpeciesDiscovery.taxonomySearchService.retrieveTaxonomyByIds(listId, new AsyncCallback<List<LightTaxonomyRow>>() { SpeciesDiscovery.taxonomySearchService.retrieveTaxonomyByIds(listId, new AsyncCallback<List<LightTaxonomyRow>>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Info.display("Error laoding child", "An error occurred in loading, retry."); Info.display("Error laoding child", "An error occurred in loading, retry.");
Log.error("Error laoding child", "An error occurred in loading, retry." +caught); Log.error("Error laoding child", "An error occurred in loading, retry." +caught);
} }
@Override @Override
public void onSuccess(List<LightTaxonomyRow> result) { public void onSuccess(List<LightTaxonomyRow> result) {
Log.trace("getReferenceById return " +result.size() + " items"); Log.trace("getReferenceById return " +result.size() + " items");
// System.out.println("getReferenceById return " +result.size() + " items"); // System.out.println("getReferenceById return " +result.size() + " items");
if(result.size()>0){ if(result.size()>0){
layoutContainer.remove(status); layoutContainer.remove(status);
layoutContainer.remove(loading); layoutContainer.remove(loading);
Label labelOf = new Label(statusRemark + " for "); Label labelOf = new Label(statusRemark + " for ");
layoutContainer.add(labelOf); layoutContainer.add(labelOf);
LayoutContainer lc = new LayoutContainer(); LayoutContainer lc = new LayoutContainer();
lc.setLayout(new ColumnLayout()); lc.setLayout(new ColumnLayout());
if(result.size()>0){ if(result.size()>0){
for (int i=0; i<result.size()-1; i++) { for (int i=0; i<result.size()-1; i++) {
LightTaxonomyRow taxonomy = result.get(i); LightTaxonomyRow taxonomy = result.get(i);
// System.out.println("child "+taxonomy); // System.out.println("child "+taxonomy);
//SET PARENTS //SET PARENTS
taxonomy.setParent(parents); taxonomy.setParent(parents);
Text comma = new Text(","); Text comma = new Text(",");
comma.setStyleAttribute("margin-right", "5px"); comma.setStyleAttribute("margin-right", "5px");
lc.add(comma); lc.add(comma);
} }
LightTaxonomyRow taxonomy = result.get(result.size()-1); LightTaxonomyRow taxonomy = result.get(result.size()-1);
//FOR DEBUG //FOR DEBUG
// System.out.println("child "+taxonomy); // System.out.println("child "+taxonomy);
//SET PARENTS //SET PARENTS
@ -788,14 +788,14 @@ public class TabItemForTaxonomyRow {
//TODO //TODO
lc.add(getAnchorByTaxonomy(taxonomy, dataSource, -2)); lc.add(getAnchorByTaxonomy(taxonomy, dataSource, -2));
} }
layoutContainer.add(lc); layoutContainer.add(lc);
} }
layoutContainer.layout(); layoutContainer.layout();
} }
}); });
} }
} }

View File

@ -1,35 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class ActiveButtonCheckAllRowEvent extends GwtEvent<ActiveButtonCheckAllRowEventHandler> {
public static final GwtEvent.Type<ActiveButtonCheckAllRowEventHandler> TYPE = new Type<ActiveButtonCheckAllRowEventHandler>();
private boolean activeFilter;
@Override
public Type<ActiveButtonCheckAllRowEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ActiveButtonCheckAllRowEventHandler handler) {
handler.onActiveCkeckAllRow(this);
}
public ActiveButtonCheckAllRowEvent(boolean activeFilter) {
this.activeFilter = activeFilter;
}
public boolean isActiveFilter() {
return activeFilter;
}
}

View File

@ -0,0 +1,34 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class AbortCurrentSearchEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 16, 2017
*/
public class StopCurrentSearchEvent extends GwtEvent<StopCurrentSearchEventHandler> {
public static final GwtEvent.Type<StopCurrentSearchEventHandler> TYPE = new Type<StopCurrentSearchEventHandler>();
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<StopCurrentSearchEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(StopCurrentSearchEventHandler handler) {
handler.onAbortCurrentSearch(this);
}
}

View File

@ -0,0 +1,25 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface AbortCurrentSearchEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 16, 2017
*/
public interface StopCurrentSearchEventHandler extends EventHandler {
/**
* On abort current search.
*
* @param abortCurrentSearchEvent the abort current search event
*/
public void onAbortCurrentSearch(
StopCurrentSearchEvent abortCurrentSearchEvent);
}

View File

@ -10,7 +10,7 @@ import com.google.gwt.event.shared.EventHandler;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* *
*/ */
public interface ActiveButtonCheckAllRowEventHandler extends EventHandler { public interface StreamCompletedEventEventHandler extends EventHandler {
public void onActiveCkeckAllRow(ActiveButtonCheckAllRowEvent activeFilterCheckAllRowEvent); public void onStreamCompleteEvent(StreamEvent activeFilterCheckAllRowEvent);
} }

View File

@ -0,0 +1,69 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class StreamEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 16, 2017
*/
public class StreamEvent extends GwtEvent<StreamCompletedEventEventHandler> {
public static final GwtEvent.Type<StreamCompletedEventEventHandler> TYPE = new Type<StreamCompletedEventEventHandler>();
private boolean activeFilter;
private Event event = null;
public enum Event {STRARTED, COMPLETED}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<StreamCompletedEventEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(StreamCompletedEventEventHandler handler) {
handler.onStreamCompleteEvent(this);
}
/**
* Instantiates a new stream event.
*
* @param activeFilter the active filter
* @param isCompleted the is completed
*/
public StreamEvent(boolean activeFilter, Event event) {
this.activeFilter = activeFilter;
this.event = event;
}
/**
* Checks if is active filter.
*
* @return true, if is active filter
*/
public boolean isActiveFilter() {
return activeFilter;
}
/**
* @return the event
*/
public Event getEvent() {
return event;
}
}

View File

@ -5,7 +5,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.client.SpeciesDiscovery; import org.gcube.portlets.user.speciesdiscovery.client.SpeciesDiscovery;
import org.gcube.portlets.user.speciesdiscovery.client.event.ActiveButtonCheckAllRowEvent; import org.gcube.portlets.user.speciesdiscovery.client.event.StreamEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.StreamEvent.Event;
import org.gcube.portlets.user.speciesdiscovery.client.model.ClassificationModel; import org.gcube.portlets.user.speciesdiscovery.client.model.ClassificationModel;
import org.gcube.portlets.user.speciesdiscovery.client.util.SpeciesGridFields; import org.gcube.portlets.user.speciesdiscovery.client.util.SpeciesGridFields;
import org.gcube.portlets.user.speciesdiscovery.client.util.stream.StreamPagingLoader; import org.gcube.portlets.user.speciesdiscovery.client.util.stream.StreamPagingLoader;
@ -37,30 +38,30 @@ public class ResultFilterPanelManager{
private EventBus eventBus; private EventBus eventBus;
private int oldStreamSize= -1; private int oldStreamSize= -1;
private boolean isDataLoaded = false; private boolean isDataLoaded = false;
private String currentGroupByRank = ""; private String currentGroupByRank = "";
private ResultFilterPanelManager(){ private ResultFilterPanelManager(){
classificationFilter = new ClassificationFilter(); classificationFilter = new ClassificationFilter();
dataProviderFilter = new DataProviderFilter(); dataProviderFilter = new DataProviderFilter();
typeFilter = new TypeFilter(); typeFilter = new TypeFilter();
dataSourceFilter = new DataSourceFilter(); dataSourceFilter = new DataSourceFilter();
rankFilter = new RankFilter(); rankFilter = new RankFilter();
listResultFilterPanel.add(classificationFilter.getPanel()); listResultFilterPanel.add(classificationFilter.getPanel());
listResultFilterPanel.add(dataProviderFilter.getPanel()); listResultFilterPanel.add(dataProviderFilter.getPanel());
listResultFilterPanel.add(dataSourceFilter.getPanel()); listResultFilterPanel.add(dataSourceFilter.getPanel());
listResultFilterPanel.add(rankFilter.getPanel()); listResultFilterPanel.add(rankFilter.getPanel());
// listResultFilterPanel.add(typeFilter.getPanel()); // listResultFilterPanel.add(typeFilter.getPanel());
} }
public List<ContentPanel> getListResultFilterPanel() { public List<ContentPanel> getListResultFilterPanel() {
return listResultFilterPanel; return listResultFilterPanel;
} }
public static synchronized ResultFilterPanelManager getInstance() { public static synchronized ResultFilterPanelManager getInstance() {
if (instance == null) if (instance == null)
instance = new ResultFilterPanelManager(); instance = new ResultFilterPanelManager();
@ -68,11 +69,11 @@ public class ResultFilterPanelManager{
} }
public void loadDataSource(List<DataSourceModel> result) { public void loadDataSource(List<DataSourceModel> result) {
// dataSourceFilter.loadDataSource(result); // dataSourceFilter.loadDataSource(result);
} }
public void setEventBus(EventBus eventBus){ public void setEventBus(EventBus eventBus){
this.eventBus = eventBus; this.eventBus = eventBus;
classificationFilter.setEventBus(eventBus); classificationFilter.setEventBus(eventBus);
@ -80,47 +81,47 @@ public class ResultFilterPanelManager{
dataSourceFilter.setEventBus(eventBus); dataSourceFilter.setEventBus(eventBus);
rankFilter.setEventBus(eventBus); rankFilter.setEventBus(eventBus);
} }
public void setIsDataLoaded(boolean bool){ public void setIsDataLoaded(boolean bool){
isDataLoaded = bool; isDataLoaded = bool;
} }
public void bind(StreamPagingLoader loader) public void bind(StreamPagingLoader loader)
{ {
this.loader = loader; this.loader = loader;
this.pageSize = loader.getPageSize(); this.pageSize = loader.getPageSize();
loader.addListener(new StreamPagingLoaderListener() { loader.addListener(new StreamPagingLoaderListener() {
@Override @Override
public void onStreamUpdate(int streamSize, int currentStartItem, int currentEndItem) { public void onStreamUpdate(int streamSize, int currentStartItem, int currentEndItem) {
Log.trace("in on stream UPDATE - Stream size: " +streamSize); Log.trace("in on stream UPDATE - Stream size: " +streamSize);
if(oldStreamSize != streamSize) if(oldStreamSize != streamSize)
updateDataSourceFilter(); updateDataSourceFilter();
oldStreamSize = streamSize; oldStreamSize = streamSize;
setIsDataLoaded(true); setIsDataLoaded(true);
} }
@Override @Override
public void onStreamLoadingComplete() { public void onStreamLoadingComplete() {
Log.trace("####### onStreamLoadingComplete COMPLETED"); Log.trace("####### onStreamLoadingComplete COMPLETED");
updateDataSourceFilter(); updateDataSourceFilter();
eventBus.fireEvent(new ActiveButtonCheckAllRowEvent(true)); eventBus.fireEvent(new StreamEvent(true, Event.COMPLETED));
} }
@Override @Override
public void onStreamStartLoading() { public void onStreamStartLoading() {
resetFilters(); resetFilters();
eventBus.fireEvent(new ActiveButtonCheckAllRowEvent(false)); eventBus.fireEvent(new StreamEvent(false, Event.STRARTED));
} }
}); });
loader.getStore().addStoreListener(new StoreListener<ModelData>(){ loader.getStore().addStoreListener(new StoreListener<ModelData>(){
/** /**
@ -129,139 +130,139 @@ public class ResultFilterPanelManager{
@Override @Override
public void storeBeforeDataChanged(StoreEvent<ModelData> se) { public void storeBeforeDataChanged(StoreEvent<ModelData> se) {
} }
}); });
} }
public void updateDataSourceFilterById(SpeciesGridFields filterId){ public void updateDataSourceFilterById(SpeciesGridFields filterId){
if(filterId==null) if(filterId==null)
return; return;
switch (filterId) { switch (filterId) {
case DATASOURCE: case DATASOURCE:
SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.DATASOURCE, new AsyncCallback<HashMap<String,Integer>>() { SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.DATASOURCE, new AsyncCallback<HashMap<String,Integer>>() {
@Override @Override
public void onSuccess(HashMap<String, Integer> result) { public void onSuccess(HashMap<String, Integer> result) {
if(result!=null) if(result!=null)
dataSourceFilter.loadDataSource(result); dataSourceFilter.loadDataSource(result);
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
resetFilters(); resetFilters();
// errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught.getMessage()); // errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught.getMessage());
Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught); Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught);
} }
}); });
break; break;
case DATAPROVIDER: case DATAPROVIDER:
SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.DATAPROVIDER, new AsyncCallback<HashMap<String,Integer>>() { SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.DATAPROVIDER, new AsyncCallback<HashMap<String,Integer>>() {
@Override @Override
public void onSuccess(HashMap<String, Integer> result) { public void onSuccess(HashMap<String, Integer> result) {
if(result!=null) if(result!=null)
dataProviderFilter.loadDataSource(result); dataProviderFilter.loadDataSource(result);
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
resetFilters(); resetFilters();
// errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught.getMessage()); // errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught.getMessage());
Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught); Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught);
} }
}); });
break; break;
case MATCHING_RANK: case MATCHING_RANK:
SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.MATCHING_RANK, new AsyncCallback<HashMap<String,Integer>>() { SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.MATCHING_RANK, new AsyncCallback<HashMap<String,Integer>>() {
@Override @Override
public void onSuccess(HashMap<String, Integer> result) { public void onSuccess(HashMap<String, Integer> result) {
if(result!=null) if(result!=null)
rankFilter.loadDataSource(result); rankFilter.loadDataSource(result);
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
resetFilters(); resetFilters();
// errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById" + caught.getMessage()); // errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById" + caught.getMessage());
Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught); Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught);
} }
}); });
break; break;
} }
} }
public void updateDataSourceFilter(){ public void updateDataSourceFilter(){
SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.DATASOURCE, new AsyncCallback<HashMap<String,Integer>>() { SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.DATASOURCE, new AsyncCallback<HashMap<String,Integer>>() {
@Override @Override
public void onSuccess(HashMap<String, Integer> result) { public void onSuccess(HashMap<String, Integer> result) {
if(result!=null) if(result!=null)
dataSourceFilter.loadDataSource(result); dataSourceFilter.loadDataSource(result);
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
resetFilters(); resetFilters();
// errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught.getMessage()); // errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught.getMessage());
Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught); Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught);
} }
}); });
SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.DATAPROVIDER, new AsyncCallback<HashMap<String,Integer>>() { SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.DATAPROVIDER, new AsyncCallback<HashMap<String,Integer>>() {
@Override @Override
public void onSuccess(HashMap<String, Integer> result) { public void onSuccess(HashMap<String, Integer> result) {
if(result!=null) if(result!=null)
dataProviderFilter.loadDataSource(result); dataProviderFilter.loadDataSource(result);
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
resetFilters(); resetFilters();
// errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught.getMessage()); // errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught.getMessage());
Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught); Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught);
} }
}); });
SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.MATCHING_RANK, new AsyncCallback<HashMap<String,Integer>>() { SpeciesDiscovery.taxonomySearchService.getFilterCounterById(SpeciesGridFields.MATCHING_RANK, new AsyncCallback<HashMap<String,Integer>>() {
@Override @Override
public void onSuccess(HashMap<String, Integer> result) { public void onSuccess(HashMap<String, Integer> result) {
if(result!=null) if(result!=null)
rankFilter.loadDataSource(result); rankFilter.loadDataSource(result);
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
resetFilters(); resetFilters();
// errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById" + caught.getMessage()); // errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById" + caught.getMessage());
Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught); Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterById " + caught);
} }
}); });
SpeciesDiscovery.taxonomySearchService.getFilterCounterForClassification(getUpdatedGroupByRank() , callbackFilterCounter); SpeciesDiscovery.taxonomySearchService.getFilterCounterForClassification(getUpdatedGroupByRank() , callbackFilterCounter);
} }
public void resetFilters() { public void resetFilters() {
dataSourceFilter.reset(); dataSourceFilter.reset();
@ -270,11 +271,11 @@ public class ResultFilterPanelManager{
rankFilter.reset(); rankFilter.reset();
oldStreamSize = -1; oldStreamSize = -1;
setIsDataLoaded(false); setIsDataLoaded(false);
} }
public void updateFilterCounterForClassification(){ public void updateFilterCounterForClassification(){
if(isDataLoaded) if(isDataLoaded)
SpeciesDiscovery.taxonomySearchService.getFilterCounterForClassification(getUpdatedGroupByRank(), callbackFilterCounter); SpeciesDiscovery.taxonomySearchService.getFilterCounterForClassification(getUpdatedGroupByRank(), callbackFilterCounter);
@ -284,22 +285,22 @@ public class ResultFilterPanelManager{
if(currentGroupByRank.compareTo(classificationFilter.getGroupRank())!=0) if(currentGroupByRank.compareTo(classificationFilter.getGroupRank())!=0)
classificationFilter.reset(); classificationFilter.reset();
setGroupByRank(classificationFilter.getGroupRank()); setGroupByRank(classificationFilter.getGroupRank());
return currentGroupByRank; return currentGroupByRank;
} }
public void setGroupByRank(String groupByRank) { public void setGroupByRank(String groupByRank) {
currentGroupByRank = groupByRank; currentGroupByRank = groupByRank;
} }
public String getGroupByRank() { public String getGroupByRank() {
return classificationFilter.getGroupRank(); return classificationFilter.getGroupRank();
} }
private AsyncCallback<HashMap<String,ClassificationModel>> callbackFilterCounter = new AsyncCallback<HashMap<String,ClassificationModel>>() { private AsyncCallback<HashMap<String,ClassificationModel>> callbackFilterCounter = new AsyncCallback<HashMap<String,ClassificationModel>>() {
@Override @Override
@ -307,7 +308,7 @@ public class ResultFilterPanelManager{
resetFilters(); resetFilters();
// errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterForClassification" + caught.getMessage()); // errorAlert("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterForClassification" + caught.getMessage());
Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterForClassification " + caught); Log.error("Error in SpeciesDiscovery.taxonomySearchService.getFilterCounterForClassification " + caught);
} }
@Override @Override
@ -316,7 +317,7 @@ public class ResultFilterPanelManager{
classificationFilter.loadDataSourceClassification(result, currentGroupByRank); classificationFilter.loadDataSourceClassification(result, currentGroupByRank);
} }
}; };
} }

View File

@ -52,8 +52,6 @@ public interface TaxonomySearchService extends RemoteService {
public SearchStatus getSearchStatus(boolean onlySelected, public SearchStatus getSearchStatus(boolean onlySelected,
boolean isActiveFilterOnResult) throws SearchServiceException; boolean isActiveFilterOnResult) throws SearchServiceException;
public void stopSearch() throws SearchServiceException;
public void updateRowSelection(int rowId, boolean selection) public void updateRowSelection(int rowId, boolean selection)
throws SearchServiceException; throws SearchServiceException;
@ -222,4 +220,6 @@ public interface TaxonomySearchService extends RemoteService {
JobGisLayerModel resubmitGisLayerJob(String jobIdentifier) throws Exception; JobGisLayerModel resubmitGisLayerJob(String jobIdentifier) throws Exception;
void userStopSearch() throws SearchServiceException;
} }

View File

@ -47,7 +47,7 @@ public interface TaxonomySearchServiceAsync {
// void getSearchStatus(boolean onlySelected, AsyncCallback<SearchStatus> callback); // void getSearchStatus(boolean onlySelected, AsyncCallback<SearchStatus> callback);
public void stopSearch(AsyncCallback<Void> callback); public void userStopSearch(AsyncCallback<Void> callback);
public void updateRowSelection(int rowId, boolean selection, AsyncCallback<Void> callback); public void updateRowSelection(int rowId, boolean selection, AsyncCallback<Void> callback);
@ -203,4 +203,5 @@ public interface TaxonomySearchServiceAsync {
public void resubmitGisLayerJob( public void resubmitGisLayerJob(
String jobIdentifier, AsyncCallback<JobGisLayerModel> asyncCallback); String jobIdentifier, AsyncCallback<JobGisLayerModel> asyncCallback);
} }

View File

@ -133,11 +133,22 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
// root.setLevel(Level.ALL); // root.setLevel(Level.ALL);
// } // }
protected ASLSession getASLSession() /**
* Gets the ASL session.
*
* @return the ASL session
*/
protected ASLSession getASLSession()
{ {
return SessionUtil.getAslSession(this.getThreadLocalRequest().getSession()); return SessionUtil.getAslSession(this.getThreadLocalRequest().getSession());
} }
/**
* Gets the species service.
*
* @return the species service
* @throws SearchServiceException the search service exception
*/
protected SpeciesService getSpeciesService() throws SearchServiceException protected SpeciesService getSpeciesService() throws SearchServiceException
{ {
try { try {
@ -151,6 +162,12 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
} }
/**
* Gets the search session.
*
* @return the search session
* @throws SearchServiceException the search service exception
*/
protected FetchingSession<? extends FetchingElement> getSearchSession() throws SearchServiceException protected FetchingSession<? extends FetchingElement> getSearchSession() throws SearchServiceException
{ {
ASLSession session = getASLSession(); ASLSession session = getASLSession();
@ -166,6 +183,12 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
/**
* Gets the occurrence session.
*
* @return the occurrence session
* @throws SearchServiceException the search service exception
*/
protected FetchingSession<Occurrence> getOccurrenceSession() throws SearchServiceException protected FetchingSession<Occurrence> getOccurrenceSession() throws SearchServiceException
{ {
ASLSession session = getASLSession(); ASLSession session = getASLSession();
@ -201,6 +224,15 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
search(searchTerm, SearchType.BY_COMMON_NAME, searchFilters); search(searchTerm, SearchType.BY_COMMON_NAME, searchFilters);
} }
/**
* Search.
*
* @param searchTerm the search term
* @param searchType the search type
* @param searchFilters the search filters
* @return the search result type
* @throws SearchServiceException the search service exception
*/
protected SearchResultType search(String searchTerm, SearchType searchType, SearchFilters searchFilters) throws SearchServiceException protected SearchResultType search(String searchTerm, SearchType searchType, SearchFilters searchFilters) throws SearchServiceException
{ {
@ -226,6 +258,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#searchByQuery(java.lang.String)
*/
@Override @Override
public SearchByQueryParameter searchByQuery(String query) throws SearchServiceException { public SearchByQueryParameter searchByQuery(String query) throws SearchServiceException {
logger.info("searchByQuery - query: "+query); logger.info("searchByQuery - query: "+query);
@ -255,6 +290,11 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/**
* Delete all row into dao table.
*
* @throws Exception the exception
*/
private void deleteAllRowIntoDaoTable() throws Exception{ private void deleteAllRowIntoDaoTable() throws Exception{
logger.info("deleting all row into dao's"); logger.info("deleting all row into dao's");
ResultRowPersistence daoResultRow = null; ResultRowPersistence daoResultRow = null;
@ -356,6 +396,11 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return new SearchResult<ResultRow>(chunk); return new SearchResult<ResultRow>(chunk);
} }
/**
* Prints the properties.
*
* @param properties the properties
*/
private void printProperties(List<ItemParameter> properties){ private void printProperties(List<ItemParameter> properties){
for (ItemParameter itemParameter : properties) { for (ItemParameter itemParameter : properties) {
@ -364,6 +409,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#getSearchTaxonomyRow(int, int, org.gcube.portlets.user.speciesdiscovery.shared.filter.ResultFilter, boolean)
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public SearchResult<TaxonomyRow> getSearchTaxonomyRow(int start, int limit, ResultFilter activeFiltersObject, boolean onlySelected) throws SearchServiceException { public SearchResult<TaxonomyRow> getSearchTaxonomyRow(int start, int limit, ResultFilter activeFiltersObject, boolean onlySelected) throws SearchServiceException {
@ -442,6 +490,13 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return new SearchResult<TaxonomyRow>(chunk); return new SearchResult<TaxonomyRow>(chunk);
} }
/**
* Load taxonomy parent by parent id.
*
* @param parentID the parent id
* @return the taxonomy row
* @throws Exception the exception
*/
public TaxonomyRow loadTaxonomyParentByParentId(String parentID) throws Exception { public TaxonomyRow loadTaxonomyParentByParentId(String parentID) throws Exception {
TaxonomyRow taxonomyRow = null; TaxonomyRow taxonomyRow = null;
@ -501,6 +556,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#getFilterCounterForClassification(java.lang.String)
*/
@Override @Override
public HashMap<String, ClassificationModel> getFilterCounterForClassification(String rankLabel) throws Exception { public HashMap<String, ClassificationModel> getFilterCounterForClassification(String rankLabel) throws Exception {
logger.info("Counter for classification: "+ rankLabel); logger.info("Counter for classification: "+ rankLabel);
@ -616,11 +674,14 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} else logger.warn("Search session not found"); } else logger.warn("Search session not found");
} }
/** /**
* {@inheritDoc} * Stop search.
*
* @throws SearchServiceException the search service exception
*/ */
@Override private void stopSearch() throws SearchServiceException {
public void stopSearch() throws SearchServiceException {
logger.info("stopSearch"); logger.info("stopSearch");
ASLSession session = getASLSession(); ASLSession session = getASLSession();
@ -636,6 +697,25 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} else logger.warn("Search session not found"); } else logger.warn("Search session not found");
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#userStopSearch()
*/
public void userStopSearch() throws SearchServiceException {
ASLSession session = getASLSession();
FetchingSession<? extends FetchingElement> searchSession = SessionUtil.getCurrentSearchSession(session);
if (searchSession != null) {
try {
searchSession.close();
} catch (IOException e) {
throw new SearchServiceException(e.getMessage());
}
} else logger.warn("Search session not found");
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -768,6 +848,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return count; return count;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#getOccurrencesBatch(int, int)
*/
@Override @Override
public OccurrenceBatch getOccurrencesBatch(int start, int limit) throws SearchServiceException { public OccurrenceBatch getOccurrencesBatch(int start, int limit) throws SearchServiceException {
logger.info("getOccurrencesBatch: start: "+start+" limit: "+limit); logger.info("getOccurrencesBatch: start: "+start+" limit: "+limit);
@ -808,6 +891,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return result; return result;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#getCountOfOccurrencesBatch()
*/
@Override @Override
public OccurrencesStatus getCountOfOccurrencesBatch() throws SearchServiceException { public OccurrencesStatus getCountOfOccurrencesBatch() throws SearchServiceException {
logger.info("get CountOf Occurrences Batch"); logger.info("get CountOf Occurrences Batch");
@ -882,6 +968,11 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
//USED FOR DEBUG //USED FOR DEBUG
/**
* Prints the id.
*
* @param listId the list id
*/
protected void printId(List<String> listId){ protected void printId(List<String> listId){
for (String id : listId) { for (String id : listId) {
@ -889,6 +980,12 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
} }
/**
* Gets the selected occurrence ids.
*
* @return the selected occurrence ids
* @throws SearchServiceException the search service exception
*/
protected List<String> getSelectedOccurrenceIds() throws SearchServiceException{ protected List<String> getSelectedOccurrenceIds() throws SearchServiceException{
FetchingSession<Occurrence> occurrenceSession = getOccurrenceSession(); FetchingSession<Occurrence> occurrenceSession = getOccurrenceSession();
@ -911,6 +1008,12 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
} }
/**
* Gets the iterator selected occurrence ids.
*
* @return the iterator selected occurrence ids
* @throws SearchServiceException the search service exception
*/
protected Iterator<Occurrence> getIteratorSelectedOccurrenceIds() throws SearchServiceException{ protected Iterator<Occurrence> getIteratorSelectedOccurrenceIds() throws SearchServiceException{
FetchingSession<Occurrence> occurrenceSession = getOccurrenceSession(); FetchingSession<Occurrence> occurrenceSession = getOccurrenceSession();
@ -923,17 +1026,29 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#saveSelectedOccurrencePoints(java.lang.String, java.lang.String, org.gcube.portlets.user.speciesdiscovery.shared.SaveFileFormat, org.gcube.portlets.user.speciesdiscovery.shared.OccurrencesSaveEnum)
*/
@Override @Override
@Deprecated @Deprecated
public void saveSelectedOccurrencePoints(String destinationFolderId, String fileName, SaveFileFormat fileFormat, OccurrencesSaveEnum typeCSV) throws SearchServiceException { public void saveSelectedOccurrencePoints(String destinationFolderId, String fileName, SaveFileFormat fileFormat, OccurrencesSaveEnum typeCSV) throws SearchServiceException {
logger.info("saveSelectedOccurrencePoints destinationFolderId: "+destinationFolderId+" fileName: "+fileName+" fileFormat: "+fileFormat+" typeCSV: "+typeCSV); logger.info("saveSelectedOccurrencePoints destinationFolderId: "+destinationFolderId+" fileName: "+fileName+" fileFormat: "+fileFormat+" typeCSV: "+typeCSV);
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#saveSelectedTaxonomyPoints(java.lang.String, java.lang.String, org.gcube.portlets.user.speciesdiscovery.shared.SaveFileFormat)
*/
@Override @Override
public void saveSelectedTaxonomyPoints(String destinationFolderId, String fileName, SaveFileFormat fileFormat) throws SearchServiceException { public void saveSelectedTaxonomyPoints(String destinationFolderId, String fileName, SaveFileFormat fileFormat) throws SearchServiceException {
//TODO OLD CALL //TODO OLD CALL
} }
/**
* Gets the selected occurrence keys.
*
* @return the selected occurrence keys
* @throws SearchServiceException the search service exception
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected List<String> getSelectedOccurrenceKeys() throws SearchServiceException protected List<String> getSelectedOccurrenceKeys() throws SearchServiceException
{ {
@ -966,6 +1081,12 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/**
* Gets the selected result row id.
*
* @return the selected result row id
* @throws SearchServiceException the search service exception
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected List<String> getSelectedResultRowId() throws SearchServiceException protected List<String> getSelectedResultRowId() throws SearchServiceException
{ {
@ -996,6 +1117,12 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return listId; return listId;
} }
/**
* Gets the selected taxonomy id and data source.
*
* @return the selected taxonomy id and data source
* @throws SearchServiceException the search service exception
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected Map<String, String> getSelectedTaxonomyIdAndDataSource() throws SearchServiceException protected Map<String, String> getSelectedTaxonomyIdAndDataSource() throws SearchServiceException
{ {
@ -1027,6 +1154,14 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return hashIdTaxonDataSource; return hashIdTaxonDataSource;
} }
/**
* Generate csv file.
*
* @param ids the ids
* @param csvType the csv type
* @return the file
* @throws Exception the exception
*/
protected File generateCSVFile(List<String> ids, OccurrencesSaveEnum csvType) throws Exception protected File generateCSVFile(List<String> ids, OccurrencesSaveEnum csvType) throws Exception
{ {
File csvFile = File.createTempFile("test", ".csv"); File csvFile = File.createTempFile("test", ".csv");
@ -1066,6 +1201,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#loadDataSourceList()
*/
@Override @Override
public List<DataSourceModel> loadDataSourceList() throws SearchServiceException { public List<DataSourceModel> loadDataSourceList() throws SearchServiceException {
logger.info("loadDataSourceList... "); logger.info("loadDataSourceList... ");
@ -1094,6 +1232,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#loadListCommonNameByRowId(java.lang.String)
*/
@Override @Override
@Deprecated @Deprecated
public ArrayList<CommonName> loadListCommonNameByRowId(String resultRowId) throws Exception { public ArrayList<CommonName> loadListCommonNameByRowId(String resultRowId) throws Exception {
@ -1103,6 +1244,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return listCommonName; return listCommonName;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#getParentsList(org.gcube.portlets.user.speciesdiscovery.shared.Taxon)
*/
@Override @Override
@Deprecated @Deprecated
public List<Taxon> getParentsList(Taxon taxon) throws Exception { public List<Taxon> getParentsList(Taxon taxon) throws Exception {
@ -1111,6 +1255,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#loadListChildrenByParentId(java.lang.String)
*/
@Override @Override
public ArrayList<LightTaxonomyRow> loadListChildrenByParentId(String parentId) throws Exception { public ArrayList<LightTaxonomyRow> loadListChildrenByParentId(String parentId) throws Exception {
logger.info("Load List Children By ParentId: " + parentId); logger.info("Load List Children By ParentId: " + parentId);
@ -1163,6 +1310,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return listLightTaxonomyRow; return listLightTaxonomyRow;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#getListTaxonomyJobs()
*/
@Override @Override
public List<JobTaxonomyModel> getListTaxonomyJobs() throws Exception { public List<JobTaxonomyModel> getListTaxonomyJobs() throws Exception {
logger.info("getListTaxonomyJobs... "); logger.info("getListTaxonomyJobs... ");
@ -1213,13 +1363,14 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
/** /**
* Creates the taxonomy job by children.
* *
* @param taxonomyServiceId * @param taxonomyServiceId the taxonomy service id
* @param taxonomyName * @param taxonomyName the taxonomy name
* @param taxonomyRank * @param taxonomyRank the taxonomy rank
* @param dataSourceName * @param dataSourceName the data source name
* @return * @return the job taxonomy model
* @throws Exception * @throws Exception the exception
*/ */
@Override @Override
public JobTaxonomyModel createTaxonomyJobByChildren(String taxonomyServiceId, String taxonomyName, String taxonomyRank, String dataSourceName) throws Exception { public JobTaxonomyModel createTaxonomyJobByChildren(String taxonomyServiceId, String taxonomyName, String taxonomyRank, String dataSourceName) throws Exception {
@ -1254,6 +1405,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#createTaxonomyJobByIds(java.lang.String, java.util.List)
*/
@Override @Override
public JobTaxonomyModel createTaxonomyJobByIds(String search, List<DataSourceModel> dataSources) throws Exception { public JobTaxonomyModel createTaxonomyJobByIds(String search, List<DataSourceModel> dataSources) throws Exception {
@ -1296,6 +1450,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#resubmitTaxonomyJob(java.lang.String)
*/
@Override @Override
public JobTaxonomyModel resubmitTaxonomyJob(String jobIdentifier) throws Exception { public JobTaxonomyModel resubmitTaxonomyJob(String jobIdentifier) throws Exception {
@ -1343,6 +1500,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return jobSpeciesModel; return jobSpeciesModel;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#cancelTaxonomyJob(java.lang.String)
*/
@Override @Override
public boolean cancelTaxonomyJob(String jobIdentifier) throws Exception { public boolean cancelTaxonomyJob(String jobIdentifier) throws Exception {
@ -1368,6 +1528,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return false; return false;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#saveTaxonomyJob(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override @Override
public boolean saveTaxonomyJob(String jobIdentifier, String destinationFolderId, String fileName, String scientificName, String dataSourceName) throws Exception { public boolean saveTaxonomyJob(String jobIdentifier, String destinationFolderId, String fileName, String scientificName, String dataSourceName) throws Exception {
@ -1404,6 +1567,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#saveTaxonomyJobError(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override @Override
public boolean saveTaxonomyJobError(String jobIdentifier, String destinationFolderId, String fileName, String scientificName, String dataSourceName) throws Exception { public boolean saveTaxonomyJobError(String jobIdentifier, String destinationFolderId, String fileName, String scientificName, String dataSourceName) throws Exception {
logger.info("saveSpeciesJob error jobId: "+jobIdentifier+" destinationFolderId: "+destinationFolderId+" fileName: "+fileName); logger.info("saveSpeciesJob error jobId: "+jobIdentifier+" destinationFolderId: "+destinationFolderId+" fileName: "+fileName);
@ -1439,6 +1605,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#retrieveTaxonomyByIds(java.util.List)
*/
@Override @Override
public List<LightTaxonomyRow> retrieveTaxonomyByIds(List<String> ids) throws Exception{ public List<LightTaxonomyRow> retrieveTaxonomyByIds(List<String> ids) throws Exception{
logger.info("retrieveTaxonomyByIds ids size: " + ids.size()); logger.info("retrieveTaxonomyByIds ids size: " + ids.size());
@ -1490,6 +1659,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#retrieveSynonymsByRefId(java.lang.String)
*/
@Override @Override
public List<LightTaxonomyRow> retrieveSynonymsByRefId(String refId) throws Exception{ public List<LightTaxonomyRow> retrieveSynonymsByRefId(String refId) throws Exception{
logger.info("retrieveSynonymsById id: " + refId); logger.info("retrieveSynonymsById id: " + refId);
@ -1604,6 +1776,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#resubmitOccurrencesJob(java.lang.String)
*/
@Override @Override
public List<JobOccurrencesModel> resubmitOccurrencesJob(String jobIdentifier) throws Exception { public List<JobOccurrencesModel> resubmitOccurrencesJob(String jobIdentifier) throws Exception {
logger.info("createOccurencesJobFromSelection..."); logger.info("createOccurencesJobFromSelection...");
@ -1657,6 +1832,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#getListOccurrencesJob()
*/
@Override @Override
public List<JobOccurrencesModel> getListOccurrencesJob() throws Exception{ public List<JobOccurrencesModel> getListOccurrencesJob() throws Exception{
logger.info("getListOccurencesJob... "); logger.info("getListOccurencesJob... ");
@ -1706,6 +1884,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#getListGisLayerJob()
*/
@Override @Override
public List<JobGisLayerModel> getListGisLayerJob() throws Exception{ public List<JobGisLayerModel> getListGisLayerJob() throws Exception{
logger.info("getListGisLayerJob... "); logger.info("getListGisLayerJob... ");
@ -1767,6 +1948,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#saveOccurrenceJob(org.gcube.portlets.user.speciesdiscovery.shared.JobOccurrencesModel, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override @Override
public boolean saveOccurrenceJob(JobOccurrencesModel jobModel, String destinationFolderId, String fileName, String scientificName, String dataSourceName) throws Exception { public boolean saveOccurrenceJob(JobOccurrencesModel jobModel, String destinationFolderId, String fileName, String scientificName, String dataSourceName) throws Exception {
logger.info("saveOccurrenceJob jobId: "+jobModel.getJobIdentifier()+" destinationFolderId: "+destinationFolderId+" fileName: "+fileName + " file format: "+jobModel.getFileFormat()); logger.info("saveOccurrenceJob jobId: "+jobModel.getJobIdentifier()+" destinationFolderId: "+destinationFolderId+" fileName: "+fileName + " file format: "+jobModel.getFileFormat());
@ -1811,6 +1995,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#saveOccurrenceJobError(org.gcube.portlets.user.speciesdiscovery.shared.JobOccurrencesModel, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override @Override
public boolean saveOccurrenceJobError(JobOccurrencesModel jobModel, String destinationFolderId, String fileName, String scientificName, String dataSourceName) throws Exception { public boolean saveOccurrenceJobError(JobOccurrencesModel jobModel, String destinationFolderId, String fileName, String scientificName, String dataSourceName) throws Exception {
@ -1849,6 +2036,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#cancelOccurrenceJob(java.lang.String)
*/
@Override @Override
public boolean cancelOccurrenceJob(String jobIdentifier) throws Exception { public boolean cancelOccurrenceJob(String jobIdentifier) throws Exception {
logger.info("cancelOccurrenceJob jobIdentifier: "+jobIdentifier); logger.info("cancelOccurrenceJob jobIdentifier: "+jobIdentifier);
@ -1871,6 +2061,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return false; return false;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#loadStructuresForResultRowClustering()
*/
@Override @Override
public ClusterStructuresForResultRow loadStructuresForResultRowClustering() throws Exception { public ClusterStructuresForResultRow loadStructuresForResultRowClustering() throws Exception {
@ -1907,6 +2100,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return cluster; return cluster;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#loadClusterCommonNameForResultRowByScientificName(java.lang.String)
*/
@Override @Override
public ClusterCommonNameDataSourceForResultRow loadClusterCommonNameForResultRowByScientificName(String scientificName) throws Exception { public ClusterCommonNameDataSourceForResultRow loadClusterCommonNameForResultRowByScientificName(String scientificName) throws Exception {
@ -1927,6 +2123,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#loadDataSourceForResultRow(boolean, boolean)
*/
@Override @Override
public List<DataSource> loadDataSourceForResultRow(boolean selected, boolean distinct) throws Exception { public List<DataSource> loadDataSourceForResultRow(boolean selected, boolean distinct) throws Exception {
@ -1965,6 +2164,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#loadStructuresForTaxonomyClustering()
*/
@Override @Override
public ClusterStructuresForTaxonomyRow loadStructuresForTaxonomyClustering() throws Exception { public ClusterStructuresForTaxonomyRow loadStructuresForTaxonomyClustering() throws Exception {
@ -2017,6 +2219,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#changeStatusOccurrenceJob(java.lang.String, org.gcube.portlets.user.speciesdiscovery.shared.DownloadState)
*/
@Override @Override
public boolean changeStatusOccurrenceJob(String jobIdentifier, DownloadState state) throws Exception { public boolean changeStatusOccurrenceJob(String jobIdentifier, DownloadState state) throws Exception {
@ -2031,6 +2236,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#changeStatusTaxonomyJob(java.lang.String, org.gcube.portlets.user.speciesdiscovery.shared.DownloadState)
*/
@Override @Override
public boolean changeStatusTaxonomyJob(String jobIdentifier, DownloadState state) throws Exception { public boolean changeStatusTaxonomyJob(String jobIdentifier, DownloadState state) throws Exception {
@ -2081,6 +2289,9 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
} }
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#getLastQuery()
*/
@Override @Override
public String getLastQuery(){ public String getLastQuery(){
logger.info("getLastQuery..."); logger.info("getLastQuery...");
@ -2246,4 +2457,6 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
// //
// return jobGisLayerModel; // return jobGisLayerModel;
} }
} }

View File

@ -11,7 +11,7 @@
<!-- <inherits name="org.gcube.portlets.user.gcubegisviewer.GCubeGisViewer" /> --> <!-- <inherits name="org.gcube.portlets.user.gcubegisviewer.GCubeGisViewer" /> -->
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" /> <inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
<set-property name="log_DivLogger" value="DISABLED" /> <set-property name="log_DivLogger" value="ENABLED" />
<!-- <inherits name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' <!-- <inherits name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree'
/> --> /> -->