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

@ -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

@ -119,7 +119,7 @@ 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
} }
} }

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;
@ -108,7 +109,7 @@ public class ResultFilterPanelManager{
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));
} }
@ -116,7 +117,7 @@ public class ResultFilterPanelManager{
@Override @Override
public void onStreamStartLoading() { public void onStreamStartLoading() {
resetFilters(); resetFilters();
eventBus.fireEvent(new ActiveButtonCheckAllRowEvent(false)); eventBus.fireEvent(new StreamEvent(false, Event.STRARTED));
} }
}); });

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);
// } // }
/**
* Gets the ASL session.
*
* @return the ASL session
*/
protected ASLSession getASLSession() 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'
/> --> /> -->