enhancements on expand query

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@79240 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-07-16 17:36:40 +00:00
parent e73179719b
commit 39bcc6b4db
25 changed files with 1236 additions and 98 deletions

View File

@ -100,11 +100,11 @@ public final class ConstantsSpeciesDiscovery {
public final static String BYSCIENTIFICNAME = "by scientific name";
public final static String SCIENTIFICNAME = "Scientific name";
public final static String BYCOMMONNAME = "by common name";
public static final String CAN_NO_BE_RE_SUBMITTED_UNTIL_IT_HAS_COMPLETED = "can no be re-submitted until it has completed!";
public static final String CAN_NOT_BE_RE_SUBMITTED_UNTIL_IT_HAS_COMPLETED = "can not be re-submitted until it has completed!";
public static final String MESSAGE_CONFIRM_DELETE_JOB = "Are you sure you want to delete the job";
public static final String CONFIRM_DELETE = "Confirm delete";
public static final String ALERT = "Alert";
public static final String IS_NOT_COMPLETED = " is not completed!";
public static final String IS_NOT_COMPLETED = "can not be saved until it has completed!";
//USED IN TABLE FOR TAXONOMY ROW
public static final String SAVES_IN_DARWIN_CORE_ARCHIVE_FORMAT = "Saves in Darwin Core Archive format";

View File

@ -6,6 +6,7 @@ import org.gcube.portlets.user.speciesdiscovery.client.job.SpeciesJobPanel;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchResultType;
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
@ -44,7 +45,8 @@ public class SearchBorderLayoutPanel extends ContentPanel {
private final EventBus eventBus;
public static final int DEFAULTNORTHHEIGHT = 77;
public static final int DEFAULTNORTHHEIGHT = 77; //->33
// public static final int DEFAULTNORTHHEIGHT = 97; //->33
public static synchronized SearchBorderLayoutPanel getInstance() {
if (instance == null)
@ -62,6 +64,7 @@ public class SearchBorderLayoutPanel extends ContentPanel {
searchController = new SearchController(eventBus, this);
speciesNorthPanel = new SpeciesSearchFormPanel(eventBus);
// speciesNorthPanel.setScrollMode(Scroll.AUTO);
speciesSouthPanel = new SpeciesJobPanel(eventBus);

View File

@ -7,7 +7,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.gcube.portlets.user.gcubegisviewer.client.GCubeGisViewer;
@ -41,6 +40,8 @@ import org.gcube.portlets.user.speciesdiscovery.client.event.ReSubmitJobEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.ReSubmitJobEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.SaveItemsEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SaveItemsEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.SaveJobErrorEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SaveJobErrorEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.SaveJobEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SaveJobEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.SearchEvent;
@ -378,6 +379,21 @@ public class SearchController {
});
eventBus.addHandler(SaveJobErrorEvent.TYPE, new SaveJobErrorEventHandler() {
@Override
public void onSaveJobError(SaveJobErrorEvent saveJobErrorEvent) {
if(saveJobErrorEvent.getItemType().equals(SearchResultType.TAXONOMY_ITEM)){
saveTaxonomyJobError(saveJobErrorEvent.getJobTaxonomyModel(), saveJobErrorEvent.getScientificName(), saveJobErrorEvent.getListDataSources(), saveJobErrorEvent.getRank());
}
else if(saveJobErrorEvent.getItemType().equals(SearchResultType.OCCURRENCE_POINT)){
saveOccurencesJobError(saveJobErrorEvent.getJobOccurrenceModel(), saveJobErrorEvent.getScientificName(), saveJobErrorEvent.getListDataSources());
}
}
});
eventBus.addHandler(CreateTaxonomyJobEvent.TYPE, new CreateTaxonomyJobEventHandler() {
@Override
@ -950,6 +966,81 @@ public class SearchController {
}
public void saveTaxonomyJobError(final JobTaxonomyModel jobTaxonomyModel, final String scientificName, final List<org.gcube.portlets.user.speciesdiscovery.shared.DataSource> listDataSources, final String rank) {
// IN THIS CASE THERE IS ONE DATASOURCE
final String dataSourceName = listDataSources.get(0)!=null?listDataSources.get(0).getName():"no datasource";
final String fileName = "Error on DWCA " +rank + " -"+scientificName +"- from "+dataSourceName+".zip";
SpeciesDiscovery.taxonomySearchService.isAvailableTaxonomyJobReportError(jobTaxonomyModel.getIdentifier(), new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
Info.display("Error saving the file", "An error occurred saving the file, retry.");
Log.error("Error saving the file", "An error occurred saving the file, retry." +caught.getMessage());
}
@Override
public void onSuccess(Boolean result) {
if(result)
saveTaxonomyJobErrorFile();
else
Info.display("Info", "The selected job has not got an error file");
}
private void saveTaxonomyJobErrorFile() {
WorkspaceLightTreeSavePopup popup = new WorkspaceLightTreeSavePopup("Select where to save the file with Job error", true, fileName);
popup.setModal(false);
popup.setSelectableTypes(ItemType.FOLDER, ItemType.ROOT);
popup.center();
popup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (!event.isCanceled()){
org.gcube.portlets.user.workspace.lighttree.client.Item destinationFolder = event.getSelectedItem();
final String name = event.getName();
Info.display("Saving in progress", "...");
SpeciesDiscovery.taxonomySearchService.saveTaxonomyJob(jobTaxonomyModel.getIdentifier(), destinationFolder.getId(), name, scientificName, dataSourceName, new AsyncCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
if(result){
Info.display("File saved", "The "+name+" file has been saved in the workspace.");
changeStatusJob(SearchResultType.TAXONOMY_ITEM, jobTaxonomyModel.getIdentifier(), DownloadState.SAVED);
}
}
@Override
public void onFailure(Throwable caught) {
Info.display("Error saving the file", "An error occurred saving the file, retry.");
Log.error("Error saving the file", "An error occurred saving the file, retry." +caught.getMessage());
}
});
}
}
});
popup.addDataLoadHandler(new DataLoadHandler() {
@Override
public void onDataLoad(DataLoadEvent event) {
if (event.isFailed())GWT.log("Workspace loading failure", event.getCaught());
}
});
popup.show();
}
});
}
public void saveTaxonomyJob(final JobTaxonomyModel jobTaxonomyModel, final String scientificName, final List<org.gcube.portlets.user.speciesdiscovery.shared.DataSource> listDataSources, String rank) {
@ -1006,6 +1097,105 @@ public class SearchController {
}
private void saveOccurencesJobError(final JobOccurrencesModel jobOccurrencesModel,final String scientificName, List<org.gcube.portlets.user.speciesdiscovery.shared.DataSource> dataSourceList) {
String dataSourceName = "";
for (org.gcube.portlets.user.speciesdiscovery.shared.DataSource dataSource : dataSourceList) {
dataSourceName+= dataSource.getName() + "-";
}
//remove last - char
dataSourceName = dataSourceName.substring(0, dataSourceName.lastIndexOf("-"));
final String dataSources = dataSourceName;
String extension = null;
switch (jobOccurrencesModel.getFileFormat()) {
case CSV: {
extension = "csv";
} break;
case DARWIN_CORE:{
extension = "xml";
} break;
}
final String fileName = "Error on Occurrences results of "+scientificName +"- from "+dataSourceName+"."+extension;
SpeciesDiscovery.taxonomySearchService.isAvailableOccurrenceJobReportError(jobOccurrencesModel.getJobIdentifier(), new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
Info.display("Error saving the file", "An error occurred saving the file, retry.");
Log.error("Error saving the file", "An error occurred saving the file, retry." +caught.getMessage());
}
@Override
public void onSuccess(Boolean result) {
if(result){
saveOccurrenceJobError();
}
else
Info.display("Info", "The selected job has not got an error file");
}
private void saveOccurrenceJobError() {
WorkspaceLightTreeSavePopup popup = new WorkspaceLightTreeSavePopup("Select where to save the Occurrence points", true, fileName);
popup.setModal(false);
popup.setSelectableTypes(ItemType.FOLDER, ItemType.ROOT);
popup.center();
popup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (!event.isCanceled()){
org.gcube.portlets.user.workspace.lighttree.client.Item destinationFolder = event.getSelectedItem();
final String name = event.getName();
Info.display("Saving in progress", "...");
SpeciesDiscovery.taxonomySearchService.saveOccurrenceJob(jobOccurrencesModel, destinationFolder.getId(), name, scientificName, dataSources, new AsyncCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
if(result){
Info.display("File saved", "The "+name+" file has been saved in the workspace.");
changeStatusJob(SearchResultType.OCCURRENCE_POINT, jobOccurrencesModel.getJobIdentifier(), DownloadState.SAVED);
}
}
@Override
public void onFailure(Throwable caught) {
Info.display("Error saving the file", "An error occurred saving the file, retry.");
Log.error("Error saving the file", "An error occurred saving the file, retry." +caught.getMessage());
}
});
}
}
});
popup.addDataLoadHandler(new DataLoadHandler() {
@Override
public void onDataLoad(DataLoadEvent event) {
if (event.isFailed())GWT.log("Workspace loading failure", event.getCaught());
}
});
popup.show();
}
});
}
private void saveOccurencesJob(final JobOccurrencesModel jobOccurrencesModel,final String scientificName, List<org.gcube.portlets.user.speciesdiscovery.shared.DataSource> dataSourceList) {

View File

@ -14,6 +14,7 @@ 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.filterresult.ResultFilterPanelManager;
import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources;
import org.gcube.portlets.user.speciesdiscovery.client.switchbutton.SwitchButton;
import org.gcube.portlets.user.speciesdiscovery.client.window.HelpQueryWindow;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchType;
@ -30,6 +31,8 @@ import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.Text;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
@ -52,7 +55,7 @@ import com.google.gwt.user.client.ui.Button;
*
*/
public class SpeciesSearchFormPanel extends ContentPanel {
protected static final String EXSEARCH = "ex. sarda sarda, solea solea";
protected static final String EXSEARCH = "e.g. sarda sarda, solea solea";
protected Button buttSimpleSearch;
protected Button buttSimpleExample;
protected SimpleComboBox<String> searchType;
@ -63,7 +66,7 @@ public class SpeciesSearchFormPanel extends ContentPanel {
private HorizontalPanel hpAdvancedSearchLinks = new HorizontalPanel();
private final Html htmlLabelAdvs = new Html("Advanced Option");
private HorizontalPanel horizontalQueryPanel = new HorizontalPanel();
public static final int NORTHHEIGHT = 140;
public static final int NORTHHEIGHT = 150;
private List<ToggleButton> tabItemList = new ArrayList<ToggleButton>();
private AdvancedSearchPanelManager advSearchPanelsManager = AdvancedSearchPanelManager.getInstance();
private final int DEFAULTLINKPANELTHEIGHT = 22;
@ -91,11 +94,13 @@ public class SpeciesSearchFormPanel extends ContentPanel {
horizontalQueryPanel.setStyleAttribute("margin-left", "10px");
horizontalQueryPanel.setStyleAttribute("margin-top", "15px");
// horizontalQueryPanel.setScrollMode(Scroll.AUTO);
// simpleSearchPanel.setScrollMode(Scroll.AUTO);
htmlLabelAdvs.setStyleAttribute("font-size", "11px");
htmlLabelAdvs.setStyleAttribute("margin-left", "10px");
buttSearchBy.setStyleName("button-hyperlink");
buttSearchBy.setStyleAttribute("margin-top", "8px");
buttSearchBy.setStyleAttribute("margin-left", "5px");
setLayout(new FlowLayout());
setFrame(false);
@ -136,8 +141,6 @@ public class SpeciesSearchFormPanel extends ContentPanel {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
eventBus.fireEvent(new CapabilitySelectedEvent(getCapability(se.getSelectedItem().getValue())));
//TODO
}
});
@ -184,7 +187,7 @@ public class SpeciesSearchFormPanel extends ContentPanel {
protected void init()
{
horizontalQueryPanel.setBorders(false);
horizontalQueryPanel.setSize(935, 33);
horizontalQueryPanel.setSize(1150, 33);
searchTypeResults.setStyleAttribute("margin-right", "10px");
@ -237,7 +240,7 @@ public class SpeciesSearchFormPanel extends ContentPanel {
@Override
public void onClick(ClickEvent event) {
textArea.setValue("SEARCH BY SN 'Carcharodon carcharias' in OBIS RETURN Product");
textArea.setValue("SEARCH BY SN 'Carcharodon carcharias' in OBIS RETURN Occurrence");
}
});
@ -275,11 +278,127 @@ public class SpeciesSearchFormPanel extends ContentPanel {
private void initSimpleSearchPanel() {
simpleSearchPanel.setSpacing(5);
simpleSearchPanel.add(searchTypeResults);
simpleSearchPanel.add(searchType);
simpleSearchPanel.setVerticalAlign(VerticalAlignment.MIDDLE);
VerticalPanel vtPanel = new VerticalPanel();
HorizontalPanel hpPanel = new HorizontalPanel();
hpPanel.setVerticalAlign(VerticalAlignment.MIDDLE);
Text textSearch = new Text("Search:");
textSearch.setStyleAttribute("margin-left", "5px");
textSearch.setStyleAttribute("margin-right", "5px");
hpPanel.add(textSearch);
hpPanel.add(searchTypeResults);
Text textBy = new Text("By:");
textBy.setStyleAttribute("margin-left", "5px");
textBy.setStyleAttribute("margin-right", "5px");
hpPanel.add(textBy);
hpPanel.add(searchType);
Text textTerm = new Text("Term:");
textTerm.setStyleAttribute("margin-left", "10px");
textTerm.setStyleAttribute("margin-right", "5px");
hpPanel.add(textTerm);
searchField = new TextField<String>();
searchField.setStyleAttribute("margin-left", "10px");
searchField.setStyleAttribute("margin-left", "0px");
searchField.setStyleAttribute("margin-right", "10px");
searchField.setEmptyText(EXSEARCH);
searchField.setWidth(300);
searchField.addKeyListener(new KeyListener(){
@Override
public void componentKeyPress(ComponentEvent event) {
if (event.getKeyCode()==KeyCodes.KEY_ENTER) search();
}
});
hpPanel.add(searchField);
checkValidateOccurrences.setBoxLabel("validate occurrences");
checkValidateOccurrences.setValueAttribute("validate occurrences");
checkValidateOccurrences.setStyleAttribute("margin-right", "10px");
// simpleSearchPanel.add(checkValidateOccurrences);
buttSimpleSearch = new Button("Search");
buttSimpleSearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
search();
}
});
buttSimpleSearch.setStyleName("wizardButton");
hpPanel.add(buttSimpleSearch);
buttSimpleExample = new Button("Example", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
searchField.setValue("Carcharodon carcharias");
}
});
buttSimpleExample.setStyleName("wizardButton");
hpPanel.add(buttSimpleExample);
HorizontalPanel hpPanelExpand = new HorizontalPanel();
hpPanelExpand.setVerticalAlign(VerticalAlignment.MIDDLE);
hpPanelExpand.setStyleAttribute("margin-top", "10px");
Text textExpand = new Text("Expand with synonyms: ");
textExpand.setStyleAttribute("margin-left", "5px");
textExpand.setStyleAttribute("margin-right", "5px");
// SwitchButton button = new SwitchButton(false);
// hpPanelExpand.add(textExpand);
// hpPanelExpand.add(new SimpleComboBox<String>());
// hpPanelExpand.add(button);
vtPanel.add(hpPanel);
// vtPanel.add(hpPanelExpand);
simpleSearchPanel.add(vtPanel);
/*
simpleSearchPanel.setSpacing(5);
simpleSearchPanel.setVerticalAlign(VerticalAlignment.MIDDLE);
Text textSearch = new Text("Search:");
textSearch.setStyleAttribute("margin-left", "5px");
textSearch.setStyleAttribute("margin-right", "5px");
simpleSearchPanel.add(textSearch);
simpleSearchPanel.add(searchTypeResults);
Text textBy = new Text("By:");
textBy.setStyleAttribute("margin-left", "5px");
textBy.setStyleAttribute("margin-right", "5px");
simpleSearchPanel.add(textBy);
simpleSearchPanel.add(searchType);
Text textTerm = new Text("Term:");
textTerm.setStyleAttribute("margin-left", "10px");
textTerm.setStyleAttribute("margin-right", "5px");
simpleSearchPanel.add(textTerm);
searchField = new TextField<String>();
searchField.setStyleAttribute("margin-left", "0px");
searchField.setStyleAttribute("margin-right", "10px");
searchField.setEmptyText(EXSEARCH);
searchField.setWidth(300);
@ -326,7 +445,18 @@ public class SpeciesSearchFormPanel extends ContentPanel {
buttSimpleExample.setStyleName("wizardButton");
simpleSearchPanel.add(buttSimpleExample);
Text textExpand = new Text("Expand:");
textExpand.setStyleAttribute("margin-left", "10px");
textExpand.setStyleAttribute("margin-right", "5px");
SwitchButton button = new SwitchButton(false);
simpleSearchPanel.add(textExpand);
simpleSearchPanel.add(button);
*/
}
public boolean getValueCheckValidateOcccurrences(){

View File

@ -6,7 +6,13 @@ package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
*
*/
public enum AdvancedSearchPanelEnum {
BOUNDS("Bounds"), DATE("Date"), TYPE("Type"), REGION("Region"), DATASOURCE("Data Source"), CLASSIFICATION("Classification");
BOUNDS("Filter by BBox"),
DATE("Filter by Date"),
TYPE("Type"),
REGION("Region"),
SYNONYMS("Synonyms From"),
DATASOURCE("Filter by Source"),
CLASSIFICATION("Classification");
private String label;

View File

@ -29,6 +29,7 @@ public class AdvancedSearchPanelManager extends ContentPanel implements Advanced
// private ClassificationFilter classificationFilter;
private HashMap<String,DataSourceModel> listDataSources;
private SpeciesCapability currentSelectedCapability;
private SynonymsFilter synonymsFilter;
public static synchronized AdvancedSearchPanelManager getInstance() {
if (instance == null)
@ -42,6 +43,7 @@ public class AdvancedSearchPanelManager extends ContentPanel implements Advanced
dateFilter = new DateFilter();
regionFilter = new RegionFilter();
dataSourceFilter = new DataSourceFilter();
synonymsFilter = new SynonymsFilter();
// classificationFilter = new ClassificationFilter();
init();
@ -49,6 +51,7 @@ public class AdvancedSearchPanelManager extends ContentPanel implements Advanced
listAdvacedPanels.add(dataSourceFilter.getName());
listAdvacedPanels.add(boundsFilter.getName());
listAdvacedPanels.add(dateFilter.getName());
listAdvacedPanels.add(synonymsFilter.getName());
// listAdvacedPanels.add(regionFilter.getName());
}
@ -57,14 +60,17 @@ public class AdvancedSearchPanelManager extends ContentPanel implements Advanced
setLayout(cardLayout);
setHeaderVisible(false);
setSize(925, 70);
setSize(925, 90);
setBodyBorder(false);
add(boundsFilter.getPanel());
add(dateFilter.getPanel());
add(dataSourceFilter.getPanel());
add(regionFilter.getPanel());
// add(classificationFilter.getPanel());
add(synonymsFilter.getPanel());
cardLayout.setActiveItem(boundsFilter.getPanel());
}
@ -83,6 +89,8 @@ public class AdvancedSearchPanelManager extends ContentPanel implements Advanced
cardLayout.setActiveItem(dataSourceFilter.getPanel());
else if(name.equals(AdvancedSearchPanelEnum.REGION.getLabel()))
cardLayout.setActiveItem(regionFilter.getPanel());
else if(name.equals(AdvancedSearchPanelEnum.SYNONYMS.getLabel()))
cardLayout.setActiveItem(synonymsFilter.getPanel());
// else if(name.equals(AdvancedSearchPanelEnum.CLASSIFICATION.getLabel()))
// cardLayout.setActiveItem(classificationFilter.getPanel());
}
@ -120,6 +128,8 @@ public class AdvancedSearchPanelManager extends ContentPanel implements Advanced
public void loadDataSource(List<DataSourceModel> result) {
dataSourceFilter.loadDataSource(result);
synonymsFilter.loadDataSource(result);
listDataSources = new HashMap<String, DataSourceModel>();
//fill hash
@ -150,6 +160,8 @@ public class AdvancedSearchPanelManager extends ContentPanel implements Advanced
dateFilter.addAvailablePlugInfo(dsm, SpeciesCapability.TODATE);
else if(capabilityEnum.equals(SpeciesCapability.UPPERBOUND))
boundsFilter.addAvailablePlugInfo(dsm, SpeciesCapability.UPPERBOUND);
else if(capabilityEnum.equals(SpeciesCapability.SYNONYMS))
boundsFilter.addAvailablePlugInfo(dsm, SpeciesCapability.SYNONYMS);
}
}

View File

@ -101,11 +101,6 @@ public class DataSourceFilter implements AdvancedSearchPanelInterface {
htmlSource2.setStyleName("margin-occurrence-link");
// htmlSource.setStyleAttribute("margin-top", "2px");
// htmlSource.setStyleAttribute("margin-right", "5px");
// htmlSource2.setStyleAttribute("margin-top", "2px");
// htmlSource2.setStyleAttribute("margin-right", "5px");
hp1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
hp2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
@ -114,33 +109,7 @@ public class DataSourceFilter implements AdvancedSearchPanelInterface {
hp1.add(checkGroupOccurrences);
hp2.add(checkGroupClassification);
// Anchor anchorAbout1 = new Anchor("<nobr>Abouts</nobr>", true);
//
// anchorAbout1.addClickHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
// new WindowCredits("Occurrences data sources credits", hashMapDataSourceOccurrences);
//
// }
// });
//
// Anchor anchorAbout2 = new Anchor("<nobr>Abouts</nobr>", true);
//
// anchorAbout2.addClickHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
// new WindowCredits("Classification data sources credits", hashMapDataSourceClassification);
//
// }
// });
// hp1.add(anchorAbout1);
// hp2.add(anchorAbout2);
vp.add(hp1);
vp.add(hp2);

View File

@ -0,0 +1,139 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceCapability;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.Text;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Jul 16, 2013
*
*/
public class SynonymsFilter implements AdvancedSearchPanelInterface{
private Button btnResetAllFilters = new Button("Reset Filters");
private ContentPanel synonymsFilterPanel = new ContentPanel();
private CheckBoxGroup checkGroup = new CheckBoxGroup();
@Override
public ContentPanel getPanel() {
btnResetAllFilters.setStyleName("button-hyperlink");
return synonymsFilterPanel;
}
public SynonymsFilter(){
init();
}
/**
*
*/
private void init() {
synonymsFilterPanel.setHeaderVisible(false);
synonymsFilterPanel.setBodyBorder(false);
synonymsFilterPanel.setLayout(new FitLayout());
synonymsFilterPanel.setStyleAttribute("marginLeft", "10px");
synonymsFilterPanel.setStyleAttribute("marginRight", "10px");
synonymsFilterPanel.setStyleAttribute("padding", "5px");
Text text = new Text("Expand with synonyms from: ");
text.setStyleAttribute("margin-left", "5px");
text.setStyleAttribute("margin-right", "5px");
HorizontalPanel hp = new HorizontalPanel();
hp.setVerticalAlign(VerticalAlignment.MIDDLE);
hp.add(text);
hp.add(checkGroup);
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.advancedsearch.AdvancedSearchPanelInterface#getName()
*/
@Override
public String getName() {
return AdvancedSearchPanelEnum.SYNONYMS.getLabel();
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.advancedsearch.AdvancedSearchPanelInterface#resetAdvancedFields()
*/
@Override
public void resetAdvancedFields() {
}
@Override
public ArrayList<DataSourceModel> getAvailablePlugIn() {
return null;
}
private static Comparator<DataSourceModel> COMPARATOR = new Comparator<DataSourceModel>() {
// This is where the sorting happens.
public int compare(DataSourceModel o1, DataSourceModel o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
};
public void loadDataSource(List<DataSourceModel> result) {
Collections.sort(result, COMPARATOR);
if(result!=null){
for(DataSourceModel dsm: result){
System.out.println("Data Source name " + dsm.getName());
CheckBox check = null;
for (DataSourceCapability dsc : dsm.getListCapabilities()) {
System.out.println("\tData Source capability name: " + dsc.getCapability().getName());
if(dsc.getCapability().getName().compareTo(SpeciesCapability.SYNONYMS.getName())==0){
check = createCheckBox(dsm, SpeciesCapability.RESULTITEM.getName());
System.out.println("\t\t added check " + dsm.getName() + " to checkGroupOccurences " + dsc.getCapability().getName());
checkGroup.add(check);
}
}
}
}
}
private CheckBox createCheckBox(DataSourceModel dsm, String property) {
CheckBox check = new CheckBox();
check.setBoxLabel(dsm.getName());
check.setValueAttribute(dsm.getName());
check.setData("capability", dsm);
check.setToolTip(new ToolTipConfig(dsm.getDescription()));
return check;
}
}

View File

@ -0,0 +1,122 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSource;
import org.gcube.portlets.user.speciesdiscovery.shared.JobOccurrencesModel;
import org.gcube.portlets.user.speciesdiscovery.shared.JobTaxonomyModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchResultType;
import com.google.gwt.event.shared.GwtEvent;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class SaveJobErrorEvent extends GwtEvent<SaveJobErrorEventHandler> {
public static final GwtEvent.Type<SaveJobErrorEventHandler> TYPE = new Type<SaveJobErrorEventHandler>();
private String jobIdentifier;
private String scientificName;
private String rank;
private SearchResultType itemType;
private List<DataSource> listDataSources;
private JobTaxonomyModel jobTaxonomyModel;
private JobOccurrencesModel jobOccurrenceModel;
@Override
public Type<SaveJobErrorEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(SaveJobErrorEventHandler handler) {
handler.onSaveJobError(this);
}
/**
*
* @param jobIdentifier
* @param scientificName
* @param listDataSource
* @param rank
* @param type
* @param jobTaxonomyModel
*/
public SaveJobErrorEvent(String jobIdentifier, String scientificName, List<DataSource> dataSourceList, String rank, SearchResultType type, JobTaxonomyModel jobTaxonomyModel) {
this.jobIdentifier = jobIdentifier;
this.scientificName = scientificName;
this.listDataSources = dataSourceList;
this.rank = rank;
this.itemType = type;
this.jobTaxonomyModel = jobTaxonomyModel;
}
/**
*
* @param jobIdentifier
* @param scientificName
* @param dataSourceList
* @param type
* @param jobOccurrenceModel
*/
public SaveJobErrorEvent(String jobIdentifier, String scientificName, List<DataSource> dataSourceList, SearchResultType type, JobOccurrencesModel jobOccurrenceModel) {
this.jobIdentifier = jobIdentifier;
this.scientificName = scientificName;
this.listDataSources = dataSourceList;
this.itemType = type;
this.jobOccurrenceModel = jobOccurrenceModel;
}
public String getJobIdentifier() {
return jobIdentifier;
}
public void setJobIdentifier(String jobIdentifier) {
this.jobIdentifier = jobIdentifier;
}
public String getScientificName() {
return scientificName;
}
public String getRank() {
return rank;
}
public SearchResultType getItemType() {
return itemType;
}
public JobTaxonomyModel getJobTaxonomyModel() {
return jobTaxonomyModel;
}
public JobOccurrencesModel getJobOccurrenceModel() {
return jobOccurrenceModel;
}
public void setJobTaxonomyModel(JobTaxonomyModel jobTaxonomyModel) {
this.jobTaxonomyModel = jobTaxonomyModel;
}
public void setJobOccurrenceModel(JobOccurrencesModel jobOccurrenceModel) {
this.jobOccurrenceModel = jobOccurrenceModel;
}
public List<DataSource> getListDataSources() {
return listDataSources;
}
public void setListDataSources(List<DataSource> listDataSources) {
this.listDataSources = listDataSources;
}
}

View File

@ -0,0 +1,19 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface SaveJobErrorEventHandler extends EventHandler {
/**
* @param saveErrorJobEvent
*/
public void onSaveJobError(SaveJobErrorEvent saveErrorJobEvent);
}

View File

@ -8,6 +8,7 @@ import org.gcube.portlets.user.speciesdiscovery.client.ConstantsSpeciesDiscovery
import org.gcube.portlets.user.speciesdiscovery.client.SpeciesDiscovery;
import org.gcube.portlets.user.speciesdiscovery.client.event.ReLoadListJobEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.ReSubmitJobEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SaveJobErrorEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SaveJobEvent;
import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources;
import org.gcube.portlets.user.speciesdiscovery.client.window.MessageBoxConfirm;
@ -66,6 +67,7 @@ public class OccurrenceGridJob extends ContentPanel{
private static final String REFRESH_LIST = "Refresh List";
private static final String RE_SUBMIT = "Re-submit";
private static final String SAVE = "Save";
private static final String SAVEERROR = "Save Errors";
private static final String CANCEL = "Cancel";
private static final String INFO = "Info";
// public static final String DATE_TIME_FORMAT = "yyyy.MM.dd 'at' HH:mm:ss";
@ -79,6 +81,7 @@ public class OccurrenceGridJob extends ContentPanel{
private Button buttonInfo;
private Button buttonCancel;
private Button buttonSave;
private Button buttonSaveError;
private Button buttonReSubmit;
private Button buttonRefreshList;
private Menu menu = new Menu();
@ -387,6 +390,34 @@ public class OccurrenceGridJob extends ContentPanel{
}
private void saveErrorJob() {
BaseModelData baseModelData = grid.getSelectionModel().getSelectedItem();
if(baseModelData!=null){
String load = baseModelData.get(JobOccurrencesModel.STATUS).toString();
if(load.compareTo(DownloadState.COMPLETED.toString())==0 || load.compareTo(DownloadState.SAVED.toString())==0 ){
String jobIdentifier = baseModelData.get(JobOccurrencesModel.JOBINDENTIFIER);
String scientificName = baseModelData.get(JobOccurrencesModel.SCIENTIFICNAME);
JobOccurrencesModel jobModel = baseModelData.get(jobIdentifier);
List<DataSource> dataSourceList = jobModel.getDataSources();
eventBus.fireEvent(new SaveJobErrorEvent(jobIdentifier, scientificName, dataSourceList, SearchResultType.OCCURRENCE_POINT, jobModel));
}
else{
String name = baseModelData.get(JobOccurrencesModel.JOBNAME);
MessageBox.alert(ConstantsSpeciesDiscovery.ALERT, "The job "+ name+ " " +ConstantsSpeciesDiscovery.IS_NOT_COMPLETED, null);
}
}
}
private void resubmitJob() {
@ -407,7 +438,7 @@ public class OccurrenceGridJob extends ContentPanel{
else{
String name = baseModelData.get(JobTaxonomyModel.JOBNAME);
MessageBox.alert(INFO, "The job "+ name+ " " + ConstantsSpeciesDiscovery.CAN_NO_BE_RE_SUBMITTED_UNTIL_IT_HAS_COMPLETED, null);
MessageBox.alert(INFO, "The job "+ name+ " " + ConstantsSpeciesDiscovery.CAN_NOT_BE_RE_SUBMITTED_UNTIL_IT_HAS_COMPLETED, null);
}
@ -456,6 +487,20 @@ public class OccurrenceGridJob extends ContentPanel{
}
});
buttonSaveError = new Button(SAVEERROR);
buttonSaveError.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getSaveProducts()));
buttonSaveError.setScale(ButtonScale.MEDIUM);
buttonSaveError.addListener(Events.OnClick, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
saveErrorJob();
}
});
buttonReSubmit = new Button(RE_SUBMIT);
buttonReSubmit.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getReSubmit()));
buttonReSubmit.setScale(ButtonScale.MEDIUM);
@ -492,6 +537,9 @@ public class OccurrenceGridJob extends ContentPanel{
toolBar.add(buttonSave);
toolBar.add(new SeparatorToolItem());
toolBar.add(buttonSaveError);
toolBar.add(new SeparatorToolItem());
toolBar.add(buttonCancel);
toolBar.add(new SeparatorToolItem());
@ -520,6 +568,7 @@ public class OccurrenceGridJob extends ContentPanel{
this.buttonInfo.setEnabled(bool);
this.buttonSave.setEnabled(bool);
this.buttonReSubmit.setEnabled(bool);
this.buttonSaveError.setEnabled(bool);
}
public void createMenuItemsOnGrid(){
@ -554,6 +603,21 @@ public class OccurrenceGridJob extends ContentPanel{
menu.add(menuSave);
MenuItem menuSaveError = new MenuItem();
menuSaveError.setText(SAVEERROR);
menuSaveError.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getSaveProducts()));
menuSaveError.addSelectionListener(new SelectionListener<MenuEvent>() {
@Override
public void componentSelected(MenuEvent ce) {
saveJob();
}
});
menu.add(menuSaveError);
MenuItem menuCancel= new MenuItem();
menuCancel.setText(CANCEL);

View File

@ -9,11 +9,13 @@ import org.gcube.portlets.user.speciesdiscovery.client.ConstantsSpeciesDiscovery
import org.gcube.portlets.user.speciesdiscovery.client.SpeciesDiscovery;
import org.gcube.portlets.user.speciesdiscovery.client.event.ReLoadListJobEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.ReSubmitJobEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SaveJobErrorEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SaveJobEvent;
import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources;
import org.gcube.portlets.user.speciesdiscovery.client.window.MessageBoxConfirm;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSource;
import org.gcube.portlets.user.speciesdiscovery.shared.DownloadState;
import org.gcube.portlets.user.speciesdiscovery.shared.JobOccurrencesModel;
import org.gcube.portlets.user.speciesdiscovery.shared.JobTaxonomyModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchResultType;
@ -63,6 +65,10 @@ import com.google.gwt.user.client.ui.AbstractImagePrototype;
public class TaxonomyGridJob extends ContentPanel{
/**
*
*/
private static final String SAVE_ERROR = "Save Errors";
private static final String REFRESH_LIST = "Refresh List";
private static final String RE_SUBMIT = "Re-submit";
private static final String SAVE = "Save";
@ -81,8 +87,10 @@ public class TaxonomyGridJob extends ContentPanel{
private Button buttonSave;
private Button buttonReSubmit;
private Button buttonRefreshList;
private Button buttonSaveError;
private Menu menu = new Menu();
public TaxonomyGridJob(EventBus eventBus) {
@ -399,6 +407,38 @@ public class TaxonomyGridJob extends ContentPanel{
}
private void saveJobErrors() {
BaseModelData baseModelData = grid.getSelectionModel().getSelectedItem();
if(baseModelData!=null){
String load = baseModelData.get(JobTaxonomyModel.STATUS).toString();
if(load.compareTo(DownloadState.COMPLETED.toString())==0 || load.compareTo(DownloadState.SAVED.toString())==0 ){
String jobIdentifier = baseModelData.get(JobTaxonomyModel.JOBINDENTIFIER);
String scientificName = baseModelData.get(JobTaxonomyModel.SCIENTIFICNAME);
String dataSource = baseModelData.get(JobTaxonomyModel.DATASOURCE);
String rank = baseModelData.get(JobTaxonomyModel.RANK);
JobTaxonomyModel jobModel = baseModelData.get(jobIdentifier);
List<org.gcube.portlets.user.speciesdiscovery.shared.DataSource> dataSourceList = new ArrayList<org.gcube.portlets.user.speciesdiscovery.shared.DataSource>();
dataSourceList.add(new DataSource(dataSource,dataSource));
eventBus.fireEvent(new SaveJobErrorEvent(jobIdentifier, scientificName, dataSourceList, rank, SearchResultType.TAXONOMY_ITEM, jobModel));
}
else{
String name = baseModelData.get(JobTaxonomyModel.JOBNAME);
MessageBox.alert(ConstantsSpeciesDiscovery.ALERT, "The job "+ name+ " " +ConstantsSpeciesDiscovery.IS_NOT_COMPLETED, null);
}
}
}
private void resubmitJob() {
BaseModelData baseModelData = grid.getSelectionModel().getSelectedItem();
@ -418,7 +458,7 @@ public class TaxonomyGridJob extends ContentPanel{
else{
String name = baseModelData.get(JobTaxonomyModel.JOBNAME);
MessageBox.alert(INFO, "The job "+ name+" "+ConstantsSpeciesDiscovery.CAN_NO_BE_RE_SUBMITTED_UNTIL_IT_HAS_COMPLETED, null);
MessageBox.alert(INFO, "The job "+ name+" "+ConstantsSpeciesDiscovery.CAN_NOT_BE_RE_SUBMITTED_UNTIL_IT_HAS_COMPLETED, null);
}
}
@ -467,6 +507,20 @@ public class TaxonomyGridJob extends ContentPanel{
}
});
buttonSaveError = new Button(SAVE_ERROR);
buttonSaveError.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getSaveProducts()));
buttonSaveError.setScale(ButtonScale.MEDIUM);
// buttonSave.setIconAlign(IconAlign.TOP);
// buttonSave.setArrowAlign(ButtonArrowAlign.BOTTOM);
buttonSaveError.addListener(Events.OnClick, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
saveJobErrors();
}
});
buttonReSubmit = new Button(RE_SUBMIT);
buttonReSubmit.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getReSubmit()));
buttonReSubmit.setScale(ButtonScale.MEDIUM);
@ -498,6 +552,9 @@ public class TaxonomyGridJob extends ContentPanel{
toolBar.add(buttonSave);
toolBar.add(new SeparatorToolItem());
toolBar.add(buttonSaveError);
toolBar.add(new SeparatorToolItem());
toolBar.add(buttonCancel);
toolBar.add(new SeparatorToolItem());
@ -520,6 +577,7 @@ public class TaxonomyGridJob extends ContentPanel{
this.buttonInfo.setEnabled(bool);
this.buttonSave.setEnabled(bool);
this.buttonReSubmit.setEnabled(bool);
this.buttonSaveError.setEnabled(bool);
}
public void resetStore(){
@ -554,6 +612,19 @@ public class TaxonomyGridJob extends ContentPanel{
menu.add(menuSave);
MenuItem menuSaveError = new MenuItem();
menuSaveError.setText(SAVE_ERROR);
menuSaveError.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getSaveProducts()));
menuSaveError.addSelectionListener(new SelectionListener<MenuEvent>() {
@Override
public void componentSelected(MenuEvent ce) {
saveJobErrors();
}
});
menu.add(menuSaveError);
MenuItem menuCancel= new MenuItem();
menuCancel.setText(CANCEL);
menuCancel.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getDelete()));

View File

@ -74,7 +74,10 @@ public interface Resources extends ClientBundle {
@Source("info-icon.png")
ImageResource getInfoIcon();
@Source("help.jpeg")
// @Source("help.jpeg")
// ImageResource getHelpIcon();
@Source("question-mark.gif")
ImageResource getHelpIcon();
@Source("checkyes.png")

View File

@ -2,25 +2,25 @@
<h3><span class="info-title">Examples</span></h3>
<p class="info-query-description">Search all the products about the scientific name 'sarda sarda' in all available datasources.</p>
<p class="info-query-text">SEARCH BY SN 'sarda sarda' RETURN Product</p>
<p class="info-query-text">SEARCH BY SN 'sarda sarda' RETURN Occurrence</p>
<p class="info-query-description">Search all the products about 'sarda sarda' and his synonyms in WoRMS, in all available datasources.</p>
<p class="info-query-text">SEARCH BY SN 'sarda sarda' EXPAND WITH WoRMS</p>
<p class="info-query-description">Search all the products about 'sarda sarda' and its synonyms in WoRMS, in all available datasources.</p>
<p class="info-query-text">SEARCH BY SN 'sarda sarda' EXPAND WITH WoRMS RETURN Occurrence</p>
<p class="info-query-description">Search all the products about 'sarda sarda' and his synonyms found in WoRMS, in ITIS datasource.</p>
<p class="info-query-text">SEARCH BY SN 'sarda sarda' EXPAND WITH WoRMS IN ITIS</p>
<p class="info-query-description">Search all the products about 'sarda sarda' and its synonyms found in WoRMS, in GBIF datasource.</p>
<p class="info-query-text">SEARCH BY SN 'sarda sarda' EXPAND WITH WoRMS IN GBIF RETURN Occurrence</p>
<p class="info-query-description">Search all the Taxa about 'sarda sarda' and his synonyms found in WoRMS, in ITIS datasource.</p>
<p class="info-query-description">Search all the Taxa about 'sarda sarda' and its synonyms found in WoRMS, in ITIS datasource.</p>
<p class="info-query-text">SEARCH BY SN 'sarda sarda' EXPAND WITH WoRMS IN ITIS RETURN TAXON</p>
<p class="info-query-description">Search all the products about the scientific names retrieved searching the common 'shark' in the datasource OBIS and mapping it into a scientific name using ITIS. Accept only the results with coordinate less or equals to (15.12, 16.12).</p>
<p class="info-query-text">SEARCH BY CN 'shark' RESOLVE WITH OBIS EXPAND WITH ITIS WHERE coordinate &lt;= 15.12, 16.12 RETURN Product</p>
<p class="info-query-description">Search all the products about the scientific names retrieved searching the common 'shark' in the datasource WoRMS and mapping it into a scientific name using ITIS. Accept only the results with coordinate less or equals to (15.12, 16.12).</p>
<p class="info-query-text">SEARCH BY CN 'shark' RESOLVE WITH WoRMS EXPAND WITH ITIS WHERE coordinate &lt;= 15.12, 16.12 RETURN Occurrence</p>
<p class="info-query-description">Search all the occurrence points about the scientific names 'sarda sarda' and 'Carcharodon carcharias' expanded with synonyms from datasource WoRMS, found in ITIS and with an event date between 2000 and 2005.</p>
<p class="info-query-description">Search all the products about the scientific names 'sarda sarda' and 'Carcharodon carcharias' expanded with synonyms from datasource WoRMS, found in ITIS and with an event date between 2000 and 2005.</p>
<p class="info-query-text">SEARCH BY SN 'sarda sarda', 'Carcharodon carcharias' EXPAND WITH WoRMS IN ITIS WHERE eventDate &gt;= '2000' AND eventDate &lt;= '2005' RETURN Occurrence</p>
<p class="info-query-description">Search all the products about the scientific names retrieved searching the common 'shark' in the datasource OBIS and mapping it into a scientific name using ITIS. Accept only the results with coordinate less or equals to (15.12, 16.12). Results are post filtered using the xpath expression "//product[type='TAXON' and counter&gt;0]".</p>
<p class="info-query-text">SEARCH BY CN 'shark' RESOLVE WITH OBIS EXPAND WITH ITIS WHERE coordinate &lt;= 15.12, 16.12 RETURN Product HAVING xpath("//product[type='TAXON' and counter&gt;0]")</p>
<p class="info-query-text">SEARCH BY CN 'shark' RESOLVE WITH OBIS EXPAND WITH ITIS WHERE coordinate &lt;= 15.12, 16.12 RETURN Occurrence HAVING xpath("//product[type='TAXON' and counter&gt;0]")</p>
<h3><span class="info-title">Synopsis </span></h3>
@ -29,15 +29,15 @@
<pre>SEARCH BY <i><b>term</b></i> [, ...]
[ IN <i><b>datasource</b></i> [, ...] ]
[ WHERE <i><b>condition</b></i> [AND <i><b>condition</b></i>] ]
[ RETURN {OCCURRENCE | TAXON} ]
RETURN {OCCURRENCE | TAXON}
[ HAVING <i><b>having expression</b></i> ]
</pre></code>
<p class="info-padding"></p>
<p>Where <i><b>term</b></i> can be one of:</p>
<code>
<pre>CN <i>common name</i> [, ...] RESOLVE [ WITH <i><b>datasource</b></i> [, ...] ] [EXPAND [ WITH <i><b>datasource</b></i> [, ...] ] ]
SN <i>scientific name</i> [, ...] [EXPAND [ WITH <i><b>datasource</b></i> [, ...] ] ]
<pre>CN <i>'common name'</i> [, ...] RESOLVE [ WITH <i><b>datasource</b></i> [, ...] ] [EXPAND [ WITH <i><b>datasource</b></i> [, ...] ] ]
SN <i>'scientific name'</i> [, ...] [EXPAND [ WITH <i><b>datasource</b></i> [, ...] ] ]
</pre>
</code>
<p class="info-padding"></p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

View File

@ -159,4 +159,34 @@ public interface TaxonomySearchService extends RemoteService {
String taxonomyName, String taxonomyRank, String dataSourceName)
throws Exception;
/**
* @param jobIdentifier
* @param destinationFolderId
* @param fileName
* @param scientificName
* @param dataSourceName
* @return
* @throws Exception
*/
boolean saveTaxonomyJobError(String jobIdentifier,
String destinationFolderId, String fileName, String scientificName,
String dataSourceName) throws Exception;
boolean isAvailableTaxonomyJobReportError(String jobIdentifier) throws Exception;
/**
* @param jobModel
* @param destinationFolderId
* @param fileName
* @param scientificName
* @param dataSourceName
* @return
* @throws Exception
*/
boolean saveOccurrenceJobError(JobOccurrencesModel jobModel,
String destinationFolderId, String fileName, String scientificName,
String dataSourceName) throws Exception;
boolean isAvailableOccurrenceJobReportError(String jobIdentifier) throws Exception;
}

View File

@ -140,5 +140,19 @@ public interface TaxonomySearchServiceAsync {
void createTaxonomyJobByChildren(String taxonomyServiceId,
String taxonomyName, String taxonomyRank, String dataSourceName,
AsyncCallback<JobTaxonomyModel> callback);
void saveTaxonomyJobError(String jobIdentifier, String destinationFolderId,
String fileName, String scientificName, String dataSourceName,
AsyncCallback<Boolean> callback);
void saveOccurrenceJobError(JobOccurrencesModel jobModel,
String destinationFolderId, String fileName, String scientificName,
String dataSourceName, AsyncCallback<Boolean> callback);
void isAvailableOccurrenceJobReportError(String jobIdentifier,
AsyncCallback<Boolean> callback);
void isAvailableTaxonomyJobReportError(String jobIdentifier,
AsyncCallback<Boolean> callback);
}

View File

@ -0,0 +1,137 @@
package org.gcube.portlets.user.speciesdiscovery.client.switchbutton;
import static com.google.gwt.query.client.GQuery.$;
import org.gcube.portlets.user.gcubewidgets.client.elements.Div;
import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.css.CSS;
import com.google.gwt.query.client.css.Length;
import com.google.gwt.query.client.css.RGBColor;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.HasName;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.Widget;
public class SwitchButton extends Composite implements HasName, HasValue<Boolean>{
private static SwitchButtonUiBinder uiBinder = GWT
.create(SwitchButtonUiBinder.class);
interface SwitchButtonUiBinder extends UiBinder<Widget, SwitchButton> {
}
@UiField FocusPanel switchContainer;
@UiField Div switcherButton;
@UiField Span labelOff;
@UiField Span labelOn;
private String name;
private Boolean value;
private Boolean valueChangeHandlerInitialized = Boolean.FALSE;
public SwitchButton() {
name = DOM.createUniqueId();
initWidget(uiBinder.createAndBindUi(this));
value = false;
$(switcherButton).css(CSS.LEFT.with(Length.px(-1)));
ensureDomEventHandlers();
}
public SwitchButton(boolean initialValue) {
this();
setValue(initialValue);
}
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Boolean> handler) {
// Is this the first value change handler? If so, time to add handlers
if (!valueChangeHandlerInitialized) {
valueChangeHandlerInitialized = true;
}
return addHandler(handler, ValueChangeEvent.getType());
}
@Override
public Boolean getValue() {
return value;
}
/**
* Checks or unchecks the switch button box, firing {@link ValueChangeEvent} if
* appropriate.
* <p>
* Note that this <em>does not</em> set the value property of the checkbox
* input element wrapped by this widget. For access to that property, see
* {@link #setFormValue(String)}
*
* @param value true to set on, false to set off; null value implies false
*/
@Override
public void setValue(Boolean value) {
if (value == null) {
value = Boolean.FALSE;
}
Boolean oldValue = getValue();
if (value.equals(oldValue)) {
return;
}
this.value = value;
if (!value) {
$(switcherButton).animate("left: -1", 250);
labelOff.setStyleName("switch-button-label on");
labelOn.setStyleName("switch-button-label off");
} else {
$(switcherButton).animate("left: 12", 250);
labelOff.setStyleName("switch-button-label off");
labelOn.setStyleName("switch-button-label on");
}
}
/**
* Checks or unchecks the switch button box, firing {@link ValueChangeEvent} if
* appropriate.
* <p>
*
* @param value true to set on, false to set off; null value implies false
* @param fireEvents If true, and value has changed, fire a
* {@link ValueChangeEvent}
*/
@Override
public void setValue(Boolean value, boolean fireEvents) {
setValue(value);
if (fireEvents) {
ValueChangeEvent.fire(this, value);
}
}
protected void ensureDomEventHandlers() {
switchContainer.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
setValue(!value);
ValueChangeEvent.fire(SwitchButton.this, getValue());
}
});
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
}
}

View File

@ -0,0 +1,13 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:e="urn:import:org.gcube.portlets.user.gcubewidgets.client.elements"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:HTMLPanel>
<e:Span styleName="switch-button-label on" ui:field="labelOff">OFF</e:Span>
<g:FocusPanel ui:field="switchContainer" styleName="switch-button-background">
<e:Div ui:field="switcherButton" styleName="switch-button-button"></e:Div>
</g:FocusPanel>
<e:Span styleName="switch-button-label off" ui:field="labelOn">ON</e:Span>
<div style="clear: left;"></div>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1621,6 +1621,46 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
}
@Override
public boolean saveTaxonomyJobError(String jobIdentifier, String destinationFolderId, String fileName, String scientificName, String dataSourceName) throws Exception {
logger.trace("saveSpeciesJob error jobId: "+jobIdentifier+" destinationFolderId: "+destinationFolderId+" fileName: "+fileName);
// System.out.println("saveSpeciesJob jobId: "+jobIdentifier+" destinationFolderId: "+destinationFolderId+" fileName: "+fileName);
try {
SpeciesService taxonomyService = getSpeciesService();
String mimeType = "application/zip";
InputStream inputStream = taxonomyService.getTaxonomyJobErrorFileById(jobIdentifier);
if(inputStream!=null){
Workspace workspace = HomeLibrary.getUserWorkspace(getASLSession());
logger.trace("input stream is not null");
// System.out.println("input stream is not null");
WorkspaceFolder folder = (WorkspaceFolder) workspace.getItem(destinationFolderId);
fileName = WorkspaceUtil.getUniqueName(fileName, folder);
folder.createExternalFileItem(fileName,"Report errors on taxonomy job", mimeType, inputStream);
logger.trace("Save report file with errors occurred was completed");
}
else{
logger.trace("input stream is null");
return false;
}
return true;
} catch (Exception e) {
logger.error("An error occurred saving the generated file into the workspace",e);
throw new SearchServiceException(e.getMessage());
}
}
@Override
public List<TaxonomyRow> retrieveTaxonomyByIds(List<String> ids) throws Exception{
logger.trace("retrieveTaxonomyByIds ids size: " + ids.size());
@ -1948,6 +1988,56 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
}
@Override
public boolean saveOccurrenceJobError(JobOccurrencesModel jobModel, String destinationFolderId, String fileName, String scientificName, String dataSourceName) throws Exception {
logger.trace("saveOccurrenceJobError jobId: "+jobModel.getJobIdentifier()+" destinationFolderId: "+destinationFolderId+" fileName: "+fileName + " file format: "+jobModel.getFileFormat());
// System.out.println("saveSpeciesJob jobId: "+jobIdentifier+" destinationFolderId: "+destinationFolderId+" fileName: "+fileName);
try {
SpeciesService taxonomyService = getSpeciesService();
String mimeType = null;
switch (jobModel.getFileFormat()) {
case CSV: {
mimeType = "text/csv";
} break;
case DARWIN_CORE:{
mimeType = "application/xhtml+xml";
} break;
}
InputStream inputStream = taxonomyService.getOccurrenceJobErrorFileById(jobModel.getJobIdentifier());
if(inputStream!=null){
Workspace workspace = HomeLibrary.getUserWorkspace(getASLSession());
logger.trace("input stream is not null");
// System.out.println("input stream is not null");
WorkspaceFolder folder = (WorkspaceFolder) workspace.getItem(destinationFolderId);
fileName = WorkspaceUtil.getUniqueName(fileName, folder);
folder.createExternalFileItem(fileName,"Report errors occurred on occurrence job", mimeType, inputStream);
logger.trace("Save report file with errors occurred was completed");
}
else{
logger.trace("input stream is null");
return false;
}
return true;
} catch (Exception e) {
logger.error("An error occurred saving the generated file into the workspace",e);
throw new SearchServiceException(e.getMessage());
}
}
@Override
public boolean cancelOccurrenceJob(String jobIdentifier) throws Exception {
@ -2084,4 +2174,42 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
return false;
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#isAvailableTaxonomyJobReportError(java.lang.String)
*/
@Override
public boolean isAvailableTaxonomyJobReportError(String jobIdentifier) throws Exception {
logger.trace("isAvailableTaxonomyJobReportError jobId: "+jobIdentifier);
try {
SpeciesService taxonomyService = getSpeciesService();
return taxonomyService.isAvailableTaxonomyJobErrorFileById(jobIdentifier);
} catch (Exception e) {
logger.error("An error occurred getting error (taxonomy) file for jobid "+jobIdentifier,e);
return false;
}
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#isAvailableOccurrenceJobReportError(java.lang.String)
*/
@Override
public boolean isAvailableOccurrenceJobReportError(String jobIdentifier) throws Exception {
logger.trace("isAvailableOccurrenceJobReportError jobId: "+jobIdentifier);
try {
SpeciesService taxonomyService = getSpeciesService();
return taxonomyService.isAvailableOccurrenceJobErrorFileById(jobIdentifier);
} catch (Exception e) {
logger.error("An error occurred getting error (occurrence) file for jobid "+jobIdentifier,e);
return false;
}
}
}

View File

@ -50,7 +50,7 @@ public class OccurrenceJobUtil {
JobOccurrencesModel jobOccurrenceModel;
DownloadState downloadState = null;
long endTime = 0;
String status = statusResponse.getStatus();
downloadState = getDownloadState(status);
logger.trace("jobId: "+job.getId() +" download state: " + downloadState);

View File

@ -420,6 +420,12 @@ public class SpeciesService {
try {
String url = this.executorCall.getResultLink(jobIdentifier);
if(url==null || url.isEmpty()){
logger.error("URL returned by species service is: "+url);
throw new StorageUrlIsEmpty();
}
logger.trace("URL returned by species service is: "+url);
is = StorageUtil.getInputStreamByStorageClient(url);
@ -431,6 +437,51 @@ public class SpeciesService {
return is;
}
public InputStream getTaxonomyJobErrorFileById(String jobIdentifier) throws Exception {
InputStream is = null;
ScopeProvider.instance.set(scope.toString());
try {
String url = this.executorCall.getErrorLink(jobIdentifier);
if(url==null || url.isEmpty()){
logger.error("URL returned by species service is: "+url);
throw new StorageUrlIsEmpty();
}
logger.trace("URL returned by species service is: "+url);
is = StorageUtil.getInputStreamByStorageClient(url);
} catch (Exception e) {
// e.printStackTrace();
logger.error("Error saving error file: "+e.getMessage(), e);
throw new Exception("Error saving file: "+e.getMessage());
}
return is;
}
public boolean isAvailableTaxonomyJobErrorFileById(String jobIdentifier) throws Exception {
ScopeProvider.instance.set(scope.toString());
try {
String url = this.executorCall.getErrorLink(jobIdentifier);
if(url==null || url.isEmpty()){
return false;
}
return true;
} catch (Exception e) {
logger.error("Error in is Available Taxonomy JobError File: "+e.getMessage(), e);
throw new Exception("Error in is Available Taxonomy JobError File: "+e.getMessage());
}
}
public String createTaxonomyJobForDWCAByChildren(String taxonomyId) throws Exception {
@ -470,7 +521,6 @@ public class SpeciesService {
public Status getOccurrenceJobById(String jobId) {
try{
ScopeProvider.instance.set(scope.toString());
return this.executorCall.getStatus(jobId); //CHANGE INTO OCCURRENCE JOB ************************************************************************************** //TODO
@ -537,13 +587,18 @@ public class SpeciesService {
public InputStream getOccurrenceJobFileById(String jobIdentifier) throws Exception {
InputStream is = null;
ScopeProvider.instance.set(scope.toString());
try {
String url = this.executorCall.getResultLink(jobIdentifier); //CHANGE INTO OCCURRENCE JOB ************************************************************************************** ** //TODO
logger.trace("URL returned by species service is: "+url);
if(url==null || url.isEmpty()){
logger.error("URL returned by species service is: "+url);
throw new StorageUrlIsEmpty();
}
is = StorageUtil.getInputStreamByStorageClient(url);
} catch (Exception e) {
@ -554,6 +609,50 @@ public class SpeciesService {
return is;
}
public InputStream getOccurrenceJobErrorFileById(String jobIdentifier) throws Exception {
InputStream is = null;
ScopeProvider.instance.set(scope.toString());
try {
String url = this.executorCall.getErrorLink(jobIdentifier);
logger.trace("URL returned by species service is: "+url);
if(url==null || url.isEmpty()){
logger.error("URL returned by species service is: "+url);
throw new StorageUrlIsEmpty();
}
is = StorageUtil.getInputStreamByStorageClient(url);
} catch (Exception e) {
// e.printStackTrace();
logger.error("Error saving file: "+e.getMessage(), e);
throw new Exception("Error saving file: "+e.getMessage());
}
return is;
}
public boolean isAvailableOccurrenceJobErrorFileById(String jobIdentifier) throws Exception {
ScopeProvider.instance.set(scope.toString());
try {
String url = this.executorCall.getErrorLink(jobIdentifier);
if(url==null || url.isEmpty()){
return false;
}
return true;
} catch (Exception e) {
logger.error("Error in is Available Occurrence JobError File: "+e.getMessage(), e);
throw new Exception("Error in is Available Occurrence JobError File: "+e.getMessage());
}
}
}

View File

@ -0,0 +1,19 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.server.service;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Jul 16, 2013
*
*/
public class StorageUrlIsEmpty extends Exception {
/**
*
*/
private static final long serialVersionUID = -1216401443727844088L;
}

View File

@ -17,19 +17,8 @@ public class DataSourceCapability implements Serializable{
private ArrayList<SpeciesCapability> listFilters;
// private String id;
// private String name;
private SpeciesCapability capability;
//
// public DataSourceCapability(String id, String name, ArrayList<CapabilityEnum> listFilters) {
// super();
// this.id=id;
// this.name=name;
// this.listFilters = listFilters;
//
// }
public DataSourceCapability(SpeciesCapability capability, ArrayList<SpeciesCapability> listFilters) {
super();
this.capability = capability;
@ -37,27 +26,8 @@ public class DataSourceCapability implements Serializable{
}
public DataSourceCapability() {}
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
public ArrayList<SpeciesCapability> getListFilters() {
return listFilters;
}