completed work on Create Gis Layer using SPD job
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@142603 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b1b268db1d
commit
5b68060b5f
|
@ -91,7 +91,7 @@ public final class ConstantsSpeciesDiscovery {
|
||||||
public static final String SAVE_OCCURRENCES = "Save Occurrences";
|
public static final String SAVE_OCCURRENCES = "Save Occurrences";
|
||||||
public static final String CREATE_GIS_LAYER_TITLE = "Create Gis Layer";
|
public static final String CREATE_GIS_LAYER_TITLE = "Create Gis Layer";
|
||||||
public static final String CREATE_GIS_LAYER_TEXT = "Create a Gis Layer from selected occurences points";
|
public static final String CREATE_GIS_LAYER_TEXT = "Create a Gis Layer from selected occurences points";
|
||||||
public static final String GIS_LAYER_EVENT_TEXT = "Gis Layer generated from SPD Portlet by gCube Framework";
|
public static final String GIS_LAYER_EVENT_TEXT = "Gis Layer generated via SPD Service by gCube Framework";
|
||||||
|
|
||||||
public static final String SAVE_TAXONOMY_ITEMS = "Save Taxonomy Items";
|
public static final String SAVE_TAXONOMY_ITEMS = "Save Taxonomy Items";
|
||||||
public final static String DETAILS = "Details";
|
public final static String DETAILS = "Details";
|
||||||
|
|
|
@ -243,6 +243,8 @@ public class SearchController {
|
||||||
}
|
}
|
||||||
else if(reSubmitJobEvent.getLoadType().equals(SearchResultType.TAXONOMY_ITEM)){
|
else if(reSubmitJobEvent.getLoadType().equals(SearchResultType.TAXONOMY_ITEM)){
|
||||||
resubmitJob(reSubmitJobEvent.getLoadType(), reSubmitJobEvent.getJobTaxonomyModel().getIdentifier());
|
resubmitJob(reSubmitJobEvent.getLoadType(), reSubmitJobEvent.getJobTaxonomyModel().getIdentifier());
|
||||||
|
}else if(reSubmitJobEvent.getLoadType().equals(SearchResultType.GIS_LAYER_POINT)){
|
||||||
|
resubmitJob(reSubmitJobEvent.getLoadType(), reSubmitJobEvent.getJobGisModel().getJobIdentifier());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -271,30 +273,44 @@ public class SearchController {
|
||||||
eventBus.addHandler(CreateGisLayerJobEvent.TYPE, new CreateGisLayerJobEventHandler() {
|
eventBus.addHandler(CreateGisLayerJobEvent.TYPE, new CreateGisLayerJobEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateGisLayerJob(CreateGisLayerJobEvent createGisLayerJobEvent) {
|
public void onCreateGisLayerJob(final CreateGisLayerJobEvent createGisLayerJobEvent) {
|
||||||
|
|
||||||
// TODO Auto-generated method stub
|
SpeciesDiscovery.taxonomySearchService.retrieveOccurencesFromSelection(new AsyncCallback<Integer>() {
|
||||||
|
|
||||||
SpeciesDiscovery.taxonomySearchService.createGisLayerJobFromSelectedOccurrenceKeys(createGisLayerJobEvent.getJobName(), createGisLayerJobEvent.getJobDescription(), createGisLayerJobEvent.getTotalPoints(), new AsyncCallback<JobGisLayerModel>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onSuccess(Integer returnedPoints) {
|
||||||
|
Long expectedPoints = createGisLayerJobEvent.getTotalPoints();
|
||||||
|
Log.trace("Expected points: "+expectedPoints);
|
||||||
|
if(returnedPoints==null || returnedPoints.intValue()==0){
|
||||||
|
Info.display("Info", "There are no occurrence points selected to create a gis layer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.trace("Returned points: "+expectedPoints);
|
||||||
|
|
||||||
Info.display("Error generating the map", "An error occurred generating the map, retry");
|
SpeciesDiscovery.taxonomySearchService.createGisLayerJobFromSelectedOccurrenceKeys(createGisLayerJobEvent.getJobName(), createGisLayerJobEvent.getJobDescription(), createGisLayerJobEvent.getTotalPoints(), new AsyncCallback<JobGisLayerModel>() {
|
||||||
Log.error("Error on loading", "An error occurred on edit listner, retry." +caught.getMessage());
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
Info.display("Error generating the map", "An error occurred generating the map, retry");
|
||||||
|
Log.error("Error on loading", "An error occurred on edit listner, retry." +caught.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(JobGisLayerModel gisJob) {
|
||||||
|
GWT.log("Returned gis job: "+gisJob);
|
||||||
|
Info.display("Gis Layer Occurrence Job", "Generating Gis layer: "+gisJob.getJobName()+" submitted");
|
||||||
|
excecuteGetJobs(SearchResultType.GIS_LAYER_POINT, false);
|
||||||
|
searchBorderLayoutPanel.getSpeciesSouthPanel().setIconGisLayerByCounter(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(JobGisLayerModel gisJob) {
|
public void onFailure(Throwable caught) {
|
||||||
GWT.log("Returned gis job: "+gisJob);
|
Info.display("Error getting occurrences", "Error getting occurrences, retry");
|
||||||
Info.display("Gis Layer Occurrence Job", "Generating Gis layer: "+gisJob.getJobName()+" submitted");
|
Log.trace("Error getting occurrences", caught);
|
||||||
excecuteGetJobs(SearchResultType.GIS_LAYER_POINT, false);
|
|
||||||
searchBorderLayoutPanel.getSpeciesSouthPanel().setIconGisLayerByCounter(1);
|
|
||||||
|
|
||||||
|
|
||||||
// progress.close();
|
|
||||||
// showMap(layerName);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -412,6 +428,8 @@ public class SearchController {
|
||||||
}
|
}
|
||||||
else if(saveJobEvent.getItemType().equals(SearchResultType.OCCURRENCE_POINT)){
|
else if(saveJobEvent.getItemType().equals(SearchResultType.OCCURRENCE_POINT)){
|
||||||
saveOccurencesJob(saveJobEvent.getJobOccurrenceModel(), saveJobEvent.getScientificName(), saveJobEvent.getListDataSources());
|
saveOccurencesJob(saveJobEvent.getJobOccurrenceModel(), saveJobEvent.getScientificName(), saveJobEvent.getListDataSources());
|
||||||
|
}else if(saveJobEvent.getItemType().equals(SearchResultType.GIS_LAYER_POINT)){
|
||||||
|
saveGisLayerJob(saveJobEvent.getJobGisLayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,9 +785,7 @@ public class SearchController {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}else if(resultType.equals(SearchResultType.TAXONOMY_ITEM)){
|
||||||
|
|
||||||
else if(resultType.equals(SearchResultType.TAXONOMY_ITEM)){
|
|
||||||
|
|
||||||
SpeciesDiscovery.taxonomySearchService.resubmitTaxonomyJob(jobIdentifier, new AsyncCallback<JobTaxonomyModel>() {
|
SpeciesDiscovery.taxonomySearchService.resubmitTaxonomyJob(jobIdentifier, new AsyncCallback<JobTaxonomyModel>() {
|
||||||
|
|
||||||
|
@ -790,6 +806,27 @@ public class SearchController {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}else if(resultType.equals(SearchResultType.GIS_LAYER_POINT)){
|
||||||
|
|
||||||
|
SpeciesDiscovery.taxonomySearchService.resubmitGisLayerJob(jobIdentifier, new AsyncCallback<JobGisLayerModel>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Info.display("Error on resubmit", "An error occurred on resubmit job, retry.");
|
||||||
|
Log.error("Error on resubmit", "An error occurred on resubmit job, retry." +caught.getMessage());
|
||||||
|
caught.printStackTrace();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(JobGisLayerModel result) {
|
||||||
|
|
||||||
|
if(result!=null)
|
||||||
|
excecuteGetJobs(SearchResultType.GIS_LAYER_POINT, false);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1154,6 +1191,54 @@ public class SearchController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveGisLayerJob(final JobGisLayerModel jobGisLayer) {
|
||||||
|
|
||||||
|
String fileName = jobGisLayer.getJobName();
|
||||||
|
final WorkspaceExplorerSaveDialog navigator = new WorkspaceExplorerSaveDialog("Save Gis Layer", fileName, false);
|
||||||
|
WorskpaceExplorerSaveNotificationListener listener = new WorskpaceExplorerSaveNotificationListener(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaving(Item parent, final String fileName) {
|
||||||
|
GWT.log("onSaving parent: "+parent +", fileName" +fileName);
|
||||||
|
navigator.hide();
|
||||||
|
|
||||||
|
Info.display("Saving in progress", "...");
|
||||||
|
|
||||||
|
SpeciesDiscovery.taxonomySearchService.saveGisLayerAsWsLink(jobGisLayer, parent.getId(), fileName, new AsyncCallback<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean result) {
|
||||||
|
|
||||||
|
if(result){
|
||||||
|
Info.display("File saved", "The "+fileName+" file has been saved in the workspace.");
|
||||||
|
changeStatusJob(SearchResultType.GIS_LAYER_POINT, jobGisLayer.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());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAborted() {
|
||||||
|
GWT.log("onAborted");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed(Throwable throwable) {
|
||||||
|
GWT.log("onFailed");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
navigator.addWorkspaceExplorerSaveNotificationListener(listener);
|
||||||
|
navigator.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void saveOccurencesJob(final JobOccurrencesModel jobOccurrencesModel,final String scientificName, List<org.gcube.portlets.user.speciesdiscovery.shared.DataSource> dataSourceList) {
|
private void saveOccurencesJob(final JobOccurrencesModel jobOccurrencesModel,final String scientificName, List<org.gcube.portlets.user.speciesdiscovery.shared.DataSource> dataSourceList) {
|
||||||
|
|
||||||
|
@ -1261,9 +1346,26 @@ public class SearchController {
|
||||||
if(result)
|
if(result)
|
||||||
excecuteGetJobs(SearchResultType.TAXONOMY_ITEM, true);
|
excecuteGetJobs(SearchResultType.TAXONOMY_ITEM, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else if(jobType.equals(SearchResultType.GIS_LAYER_POINT)){
|
||||||
|
SpeciesDiscovery.taxonomySearchService.changeStatusGisLayerJob(jobId, state, new AsyncCallback<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Log.error("Error on change status", "An error occurred on change status, retry." +caught.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean result) {
|
||||||
|
if(result)
|
||||||
|
excecuteGetJobs(SearchResultType.GIS_LAYER_POINT, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1685,7 +1787,8 @@ public class SearchController {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}else if(type.equals(SearchResultType.GIS_LAYER_POINT)){
|
}
|
||||||
|
else if(type.equals(SearchResultType.GIS_LAYER_POINT)){
|
||||||
|
|
||||||
if(resetStructures)
|
if(resetStructures)
|
||||||
GisLayerJobSpeciesPanel.getInstance(eventBus).getGridJob().mask("Loading", ConstantsSpeciesDiscovery.LOADINGSTYLE);
|
GisLayerJobSpeciesPanel.getInstance(eventBus).getGridJob().mask("Loading", ConstantsSpeciesDiscovery.LOADINGSTYLE);
|
||||||
|
@ -1697,8 +1800,6 @@ public class SearchController {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -39,6 +39,15 @@ public class ReSubmitJobEvent extends GwtEvent<ReSubmitJobEventHandler> {
|
||||||
this.jobGisModel = jobGisModel;
|
this.jobGisModel = jobGisModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the jobGisModel
|
||||||
|
*/
|
||||||
|
public JobGisLayerModel getJobGisModel() {
|
||||||
|
|
||||||
|
return jobGisModel;
|
||||||
|
}
|
||||||
|
|
||||||
public SearchResultType getLoadType() {
|
public SearchResultType getLoadType() {
|
||||||
return loadType;
|
return loadType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,15 @@ public class SaveJobEvent extends GwtEvent<SaveJobEventHandler> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the jobGisLayer
|
||||||
|
*/
|
||||||
|
public JobGisLayerModel getJobGisLayer() {
|
||||||
|
|
||||||
|
return jobGisLayer;
|
||||||
|
}
|
||||||
|
|
||||||
public String getJobIdentifier() {
|
public String getJobIdentifier() {
|
||||||
return jobIdentifier;
|
return jobIdentifier;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,12 @@ import com.google.gwt.event.shared.EventBus;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ResultRowResultsPanel.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Feb 16, 2017
|
||||||
|
*/
|
||||||
public class ResultRowResultsPanel extends ContentPanel {
|
public class ResultRowResultsPanel extends ContentPanel {
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,11 +116,23 @@ public class ResultRowResultsPanel extends ContentPanel {
|
||||||
private Button btnCreateGisLayer;
|
private Button btnCreateGisLayer;
|
||||||
private Button btnOccurrencesMenu;
|
private Button btnOccurrencesMenu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the single instance of ResultRowResultsPanel.
|
||||||
|
*
|
||||||
|
* @return single instance of ResultRowResultsPanel
|
||||||
|
*/
|
||||||
public static ResultRowResultsPanel getInstance() {
|
public static ResultRowResultsPanel getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new result row results panel.
|
||||||
|
*
|
||||||
|
* @param eventBus the event bus
|
||||||
|
* @param loader the loader
|
||||||
|
* @param searchController the search controller
|
||||||
|
*/
|
||||||
public ResultRowResultsPanel(final EventBus eventBus, StreamPagingLoader loader, SearchController searchController) {
|
public ResultRowResultsPanel(final EventBus eventBus, StreamPagingLoader loader, SearchController searchController) {
|
||||||
|
|
||||||
instance=this;
|
instance=this;
|
||||||
|
@ -294,14 +312,23 @@ public class ResultRowResultsPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Active tool bar buttons.
|
||||||
|
*
|
||||||
|
* @param bool the bool
|
||||||
|
*/
|
||||||
public void activeToolBarButtons(boolean bool){
|
public void activeToolBarButtons(boolean bool){
|
||||||
btnShowOnlySelectedButton.setEnabled(bool);
|
btnShowOnlySelectedButton.setEnabled(bool);
|
||||||
btnViewDetails.setEnabled(bool);
|
btnViewDetails.setEnabled(bool);
|
||||||
// btnShowInGisViewer.setEnabled(bool);
|
|
||||||
btnOccurrencesMenu.setEnabled(bool);
|
btnOccurrencesMenu.setEnabled(bool);
|
||||||
|
btnCreateGisLayer.setEnabled(bool);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset filter.
|
||||||
|
*/
|
||||||
public void resetFilter (){
|
public void resetFilter (){
|
||||||
labelFilter.setLabel(ConstantsSpeciesDiscovery.FILTER);
|
labelFilter.setLabel(ConstantsSpeciesDiscovery.FILTER);
|
||||||
labelFilterValue.setLabel(ConstantsSpeciesDiscovery.NONE);
|
labelFilterValue.setLabel(ConstantsSpeciesDiscovery.NONE);
|
||||||
|
@ -311,6 +338,12 @@ public class ResultRowResultsPanel extends ContentPanel {
|
||||||
pageToolBar.reset(); //ADDED 03/08/2012
|
pageToolBar.reset(); //ADDED 03/08/2012
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the filter active.
|
||||||
|
*
|
||||||
|
* @param isActive the is active
|
||||||
|
* @param label the label
|
||||||
|
*/
|
||||||
public void setFilterActive(boolean isActive, String label){
|
public void setFilterActive(boolean isActive, String label){
|
||||||
|
|
||||||
if(isActive){
|
if(isActive){
|
||||||
|
@ -322,11 +355,22 @@ public class ResultRowResultsPanel extends ContentPanel {
|
||||||
resetFilter();
|
resetFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind.
|
||||||
|
*
|
||||||
|
* @param eventBus the event bus
|
||||||
|
* @param loader the loader
|
||||||
|
*/
|
||||||
protected void bind(EventBus eventBus, StreamPagingLoader loader)
|
protected void bind(EventBus eventBus, StreamPagingLoader loader)
|
||||||
{
|
{
|
||||||
// this.gridViewManager = new GridViewManager(eventBus, loader);
|
// this.gridViewManager = new GridViewManager(eventBus, loader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle view.
|
||||||
|
*
|
||||||
|
* @param view the view
|
||||||
|
*/
|
||||||
protected void toggleView(ContentPanel view)
|
protected void toggleView(ContentPanel view)
|
||||||
{
|
{
|
||||||
instance.mask("Switching view..");
|
instance.mask("Switching view..");
|
||||||
|
@ -357,6 +401,9 @@ public class ResultRowResultsPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.extjs.gxt.ui.client.widget.Container#onAfterLayout()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onAfterLayout() {
|
protected void onAfterLayout() {
|
||||||
super.onAfterLayout();
|
super.onAfterLayout();
|
||||||
|
@ -365,12 +412,20 @@ public class ResultRowResultsPanel extends ContentPanel {
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload.
|
||||||
|
*/
|
||||||
public void reload() {
|
public void reload() {
|
||||||
// if (currentView!=null)
|
// if (currentView!=null)
|
||||||
// this.gridViewManager.reload();
|
// this.gridViewManager.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Active btn show only selected.
|
||||||
|
*
|
||||||
|
* @param bool the bool
|
||||||
|
*/
|
||||||
public void activeBtnShowOnlySelected(boolean bool) {
|
public void activeBtnShowOnlySelected(boolean bool) {
|
||||||
|
|
||||||
this.btnShowOnlySelectedButton.removeSelectionListener(btnOnlySelectedListner);
|
this.btnShowOnlySelectedButton.removeSelectionListener(btnOnlySelectedListner);
|
||||||
|
@ -386,16 +441,29 @@ public class ResultRowResultsPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset store.
|
||||||
|
*/
|
||||||
public void resetStore() {
|
public void resetStore() {
|
||||||
this.store.removeAll();
|
this.store.removeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the classic grid view.
|
||||||
|
*
|
||||||
|
* @return the classic grid view
|
||||||
|
*/
|
||||||
public SpeciesGrid getClassicGridView() {
|
public SpeciesGrid getClassicGridView() {
|
||||||
return classicGridView;
|
return classicGridView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select all rows.
|
||||||
|
*
|
||||||
|
* @param selectionValue the selection value
|
||||||
|
*/
|
||||||
public void selectAllRows(boolean selectionValue) {
|
public void selectAllRows(boolean selectionValue) {
|
||||||
if(selectionValue)
|
if(selectionValue)
|
||||||
classicGridView.selectAll();
|
classicGridView.selectAll();
|
||||||
|
@ -404,11 +472,19 @@ public class ResultRowResultsPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Active check all rows.
|
||||||
|
*
|
||||||
|
* @param active the active
|
||||||
|
*/
|
||||||
public void activeCheckAllRows(boolean active) {
|
public void activeCheckAllRows(boolean active) {
|
||||||
btnSelectAllRow.setEnabled(active);
|
btnSelectAllRow.setEnabled(active);
|
||||||
btnDeSelectAllRow.setEnabled(active);
|
btnDeSelectAllRow.setEnabled(active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the buttons occurrences job.
|
||||||
|
*/
|
||||||
public void addButtonsOccurrencesJob(){
|
public void addButtonsOccurrencesJob(){
|
||||||
|
|
||||||
btnOccurrencesMenu = new Button(ConstantsSpeciesDiscovery.SAVE_OCCURRENCES);
|
btnOccurrencesMenu = new Button(ConstantsSpeciesDiscovery.SAVE_OCCURRENCES);
|
||||||
|
@ -507,10 +583,9 @@ public class ResultRowResultsPanel extends ContentPanel {
|
||||||
|
|
||||||
|
|
||||||
btnCreateGisLayer = new Button(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TITLE);
|
btnCreateGisLayer = new Button(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TITLE);
|
||||||
btnCreateGisLayer.setMenu(formatSubMenu);
|
|
||||||
btnCreateGisLayer.setScale(ButtonScale.MEDIUM);
|
btnCreateGisLayer.setScale(ButtonScale.MEDIUM);
|
||||||
// btnOccurrencesMenu.setIconAlign(IconAlign.TOP);
|
// btnOccurrencesMenu.setIconAlign(IconAlign.TOP);
|
||||||
btnCreateGisLayer.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getGisLayerLogo()));
|
btnCreateGisLayer.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getGlobe24()));
|
||||||
btnCreateGisLayer.setToolTip(new ToolTipConfig(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TITLE, ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TEXT));
|
btnCreateGisLayer.setToolTip(new ToolTipConfig(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TITLE, ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TEXT));
|
||||||
|
|
||||||
btnCreateGisLayer.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
btnCreateGisLayer.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
@ -540,6 +615,11 @@ public class ResultRowResultsPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is search by common name.
|
||||||
|
*
|
||||||
|
* @return true, if is search by common name
|
||||||
|
*/
|
||||||
protected boolean isSearchByCommonName() {
|
protected boolean isSearchByCommonName() {
|
||||||
|
|
||||||
if(searchController.getLastSearchEvent().getType().equals(SearchType.BY_COMMON_NAME))
|
if(searchController.getLastSearchEvent().getType().equals(SearchType.BY_COMMON_NAME))
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.gcube.portlets.user.speciesdiscovery.client.ConstantsSpeciesDiscovery
|
||||||
import org.gcube.portlets.user.speciesdiscovery.client.SpeciesDiscovery;
|
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.ReLoadListJobEvent;
|
||||||
import org.gcube.portlets.user.speciesdiscovery.client.event.ReSubmitJobEvent;
|
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.event.SaveJobEvent;
|
||||||
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.MessageBoxConfirm;
|
import org.gcube.portlets.user.speciesdiscovery.client.window.MessageBoxConfirm;
|
||||||
|
@ -82,8 +81,8 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
private Button buttonInfo;
|
private Button buttonInfo;
|
||||||
private Button buttonCancel;
|
private Button buttonCancel;
|
||||||
private Button buttonSave;
|
private Button buttonSave;
|
||||||
private Button buttonSaveError;
|
|
||||||
private Button buttonReSubmit;
|
private Button buttonReSubmit;
|
||||||
|
private Button buttonOpenGisViewerApp;
|
||||||
private Button buttonRefreshList;
|
private Button buttonRefreshList;
|
||||||
private Menu menu = new Menu();
|
private Menu menu = new Menu();
|
||||||
|
|
||||||
|
@ -99,22 +98,11 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
ColumnConfig name = new ColumnConfig(JobGisLayerModel.JOBNAME, JobGisLayerModel.JOBNAME, 220);
|
ColumnConfig name = new ColumnConfig(JobGisLayerModel.JOBNAME, JobGisLayerModel.JOBNAME, 220);
|
||||||
ColumnConfig progress = new ColumnConfig(JobGisLayerModel.PROGRESS, JobGisLayerModel.PROGRESS, 150);
|
ColumnConfig progress = new ColumnConfig(JobGisLayerModel.PROGRESS, JobGisLayerModel.PROGRESS, 150);
|
||||||
ColumnConfig startDate = new ColumnConfig(JobGisLayerModel.STARTTIME, JobGisLayerModel.STARTTIME, 140);
|
ColumnConfig startDate = new ColumnConfig(JobGisLayerModel.STARTTIME, JobGisLayerModel.STARTTIME, 140);
|
||||||
|
|
||||||
//ColumnConfig submitDate = new ColumnConfig(JobGisLayerModel.SUBMITTIME, JobGisLayerModel.SUBMITTIME, 140);
|
|
||||||
// creationDate.setDateTimeFormat(DateTimeFormat.getFormat(DATE_TIME_FORMAT));
|
|
||||||
|
|
||||||
ColumnConfig endTime = new ColumnConfig(JobGisLayerModel.ENDTIME, JobGisLayerModel.ENDTIME, 140);
|
ColumnConfig endTime = new ColumnConfig(JobGisLayerModel.ENDTIME, JobGisLayerModel.ENDTIME, 140);
|
||||||
// endTime.setDateTimeFormat(DateTimeFormat.getFormat(DATE_TIME_FORMAT));
|
|
||||||
|
|
||||||
//ColumnConfig elapsedTime = new ColumnConfig(JobGisLayerModel.ELAPSEDTIME, JobGisLayerModel.ELAPSEDTIME + " Days, " + ConstantsSpeciesDiscovery.TIMEFORMAT_HH_MM_SS, 100);
|
|
||||||
// elapsedTime.setHidden(true);
|
|
||||||
|
|
||||||
ColumnConfig layerUUID = new ColumnConfig(JobGisLayerModel.LAYERUUID, JobGisLayerModel.LAYERUUID, 140);
|
ColumnConfig layerUUID = new ColumnConfig(JobGisLayerModel.LAYERUUID, JobGisLayerModel.LAYERUUID, 140);
|
||||||
ColumnConfig gisViewerAppLink = new ColumnConfig(JobGisLayerModel.GISVIEWERAPPLINK, JobGisLayerModel.GISVIEWERAPPLINK, 140);
|
ColumnConfig gisViewerAppLink = new ColumnConfig(JobGisLayerModel.GISVIEWERAPPLINK, JobGisLayerModel.GISVIEWERAPPLINK, 140);
|
||||||
|
|
||||||
|
|
||||||
ColumnConfig status = new ColumnConfig(JobGisLayerModel.STATUS, JobGisLayerModel.STATUS, 80);
|
ColumnConfig status = new ColumnConfig(JobGisLayerModel.STATUS, JobGisLayerModel.STATUS, 80);
|
||||||
|
//final ColumnModel cm = new ColumnModel(Arrays.asList(name, progress, status, layerUUID, gisViewerAppLink, startDate, endTime));
|
||||||
final ColumnModel cm = new ColumnModel(Arrays.asList(name, progress, status, layerUUID, gisViewerAppLink, startDate, endTime));
|
final ColumnModel cm = new ColumnModel(Arrays.asList(name, progress, status, layerUUID, gisViewerAppLink, startDate, endTime));
|
||||||
|
|
||||||
setBodyBorder(false);
|
setBodyBorder(false);
|
||||||
|
@ -292,11 +280,11 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the species job by identifier.
|
* Removes the gis layer job by identifier.
|
||||||
*
|
*
|
||||||
* @param jobIdentifier the job identifier
|
* @param jobIdentifier the job identifier
|
||||||
*/
|
*/
|
||||||
public void removeSpeciesJobByIdentifier(String jobIdentifier) {
|
public void removeGisLayerJobByIdentifier(String jobIdentifier) {
|
||||||
BaseModelData job = store.findModel(JobGisLayerModel.JOBINDENTIFIER, jobIdentifier);
|
BaseModelData job = store.findModel(JobGisLayerModel.JOBINDENTIFIER, jobIdentifier);
|
||||||
if(job!=null){
|
if(job!=null){
|
||||||
store.remove(job);
|
store.remove(job);
|
||||||
|
@ -339,13 +327,13 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
|
|
||||||
final String jobIdentifier = baseModelData.get(JobGisLayerModel.JOBINDENTIFIER);
|
final String jobIdentifier = baseModelData.get(JobGisLayerModel.JOBINDENTIFIER);
|
||||||
|
|
||||||
SpeciesDiscovery.taxonomySearchService.cancelOccurrenceJob(jobIdentifier, new AsyncCallback<Boolean>() {
|
SpeciesDiscovery.taxonomySearchService.cancelGisLayerJob(jobIdentifier, new AsyncCallback<Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean result) {
|
public void onSuccess(Boolean result) {
|
||||||
|
|
||||||
if(result)
|
if(result)
|
||||||
removeSpeciesJobByIdentifier(jobIdentifier);
|
removeGisLayerJobByIdentifier(jobIdentifier);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,33 +378,6 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Save error job.
|
|
||||||
*/
|
|
||||||
private void saveErrorJob() {
|
|
||||||
|
|
||||||
BaseModelData baseModelData = grid.getSelectionModel().getSelectedItem();
|
|
||||||
|
|
||||||
if(baseModelData!=null){
|
|
||||||
|
|
||||||
String load = baseModelData.get(JobGisLayerModel.STATUS).toString();
|
|
||||||
|
|
||||||
if(load.compareTo(DownloadState.COMPLETED.toString())==0 || load.compareTo(DownloadState.SAVED.toString())==0 || load.compareTo(DownloadState.FAILED.toString())==0){
|
|
||||||
|
|
||||||
String jobIdentifier = baseModelData.get(JobGisLayerModel.JOBINDENTIFIER);
|
|
||||||
JobGisLayerModel jobModel = baseModelData.get(jobIdentifier);
|
|
||||||
eventBus.fireEvent(new SaveJobErrorEvent(jobIdentifier, jobModel.getJobName(), jobModel, SearchResultType.GIS_LAYER_POINT));
|
|
||||||
}
|
|
||||||
|
|
||||||
else{
|
|
||||||
String name = baseModelData.get(JobGisLayerModel.JOBNAME);
|
|
||||||
MessageBox.alert(ConstantsSpeciesDiscovery.ALERT, "The error file "+ name+ " " +ConstantsSpeciesDiscovery.IS_NOT_COMPLETED, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resubmit job.
|
* Resubmit job.
|
||||||
*/
|
*/
|
||||||
|
@ -515,19 +476,33 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
buttonOpenGisViewerApp = new Button(OPEN_GIS_LAYER);
|
||||||
|
buttonOpenGisViewerApp.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getGlobe16()));
|
||||||
|
buttonOpenGisViewerApp.setScale(ButtonScale.MEDIUM);
|
||||||
|
buttonOpenGisViewerApp.addListener(Events.OnClick, new Listener<BaseEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleEvent(BaseEvent be) {
|
||||||
|
|
||||||
|
openLayerSelectedWithGisViewerApp();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
toolBar.add(buttonInfo);
|
toolBar.add(buttonInfo);
|
||||||
toolBar.add(new SeparatorToolItem());
|
toolBar.add(new SeparatorToolItem());
|
||||||
|
|
||||||
toolBar.add(buttonSave);
|
toolBar.add(buttonSave);
|
||||||
toolBar.add(new SeparatorToolItem());
|
toolBar.add(new SeparatorToolItem());
|
||||||
|
|
||||||
toolBar.add(buttonSaveError);
|
|
||||||
toolBar.add(new SeparatorToolItem());
|
|
||||||
|
|
||||||
toolBar.add(buttonCancel);
|
toolBar.add(buttonCancel);
|
||||||
toolBar.add(new SeparatorToolItem());
|
toolBar.add(new SeparatorToolItem());
|
||||||
|
|
||||||
toolBar.add(buttonReSubmit);
|
//toolBar.add(buttonReSubmit);
|
||||||
|
//toolBar.add(new SeparatorToolItem());
|
||||||
|
|
||||||
|
toolBar.add(buttonOpenGisViewerApp);
|
||||||
toolBar.add(new SeparatorToolItem());
|
toolBar.add(new SeparatorToolItem());
|
||||||
|
|
||||||
toolBar.add(new FillToolItem());
|
toolBar.add(new FillToolItem());
|
||||||
|
@ -539,6 +514,25 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
enableButtonOnClick(false);
|
enableButtonOnClick(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open layer selected with gis viewer app.
|
||||||
|
*/
|
||||||
|
private void openLayerSelectedWithGisViewerApp(){
|
||||||
|
|
||||||
|
BaseModelData baseModelData = grid.getSelectionModel().getSelectedItem();
|
||||||
|
|
||||||
|
if(baseModelData!=null){
|
||||||
|
String url = baseModelData.get(JobGisLayerModel.GISVIEWERAPPLINK);
|
||||||
|
if(url==null){
|
||||||
|
Window.alert("The task '" +baseModelData.get(JobGisLayerModel.JOBNAME) +"' does not contain a valid GisViewer App link, Is it completed?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Window.open(url, "", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable tool bar.
|
* Enable tool bar.
|
||||||
*
|
*
|
||||||
|
@ -565,7 +559,6 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
this.buttonInfo.setEnabled(bool);
|
this.buttonInfo.setEnabled(bool);
|
||||||
this.buttonSave.setEnabled(bool);
|
this.buttonSave.setEnabled(bool);
|
||||||
this.buttonReSubmit.setEnabled(bool);
|
this.buttonReSubmit.setEnabled(bool);
|
||||||
this.buttonSaveError.setEnabled(bool);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -575,31 +568,20 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
|
|
||||||
MenuItem menuOpenWithGis = new MenuItem();
|
MenuItem menuOpenWithGis = new MenuItem();
|
||||||
menuOpenWithGis.setText(OPEN_GIS_LAYER);
|
menuOpenWithGis.setText(OPEN_GIS_LAYER);
|
||||||
menuOpenWithGis.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getGlobe()));
|
menuOpenWithGis.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getGlobe16()));
|
||||||
|
|
||||||
menuOpenWithGis.addSelectionListener(new SelectionListener<MenuEvent>() {
|
menuOpenWithGis.addSelectionListener(new SelectionListener<MenuEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(MenuEvent ce) {
|
public void componentSelected(MenuEvent ce) {
|
||||||
|
|
||||||
BaseModelData baseModelData = grid.getSelectionModel().getSelectedItem();
|
openLayerSelectedWithGisViewerApp();
|
||||||
|
|
||||||
if(baseModelData!=null){
|
|
||||||
String url = baseModelData.get(JobGisLayerModel.GISVIEWERAPPLINK);
|
|
||||||
if(url==null){
|
|
||||||
Window.alert("The task '" +baseModelData.get(JobGisLayerModel.JOBNAME) +"' does not contain a valid GisViewer App link, Is it completed?");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Window.open(url, "", "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.add(menuOpenWithGis);
|
menu.add(menuOpenWithGis);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MenuItem menuInfo = new MenuItem();
|
MenuItem menuInfo = new MenuItem();
|
||||||
menuInfo.setText(INFO);
|
menuInfo.setText(INFO);
|
||||||
menuInfo.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getInfoIcon()));
|
menuInfo.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getInfoIcon()));
|
||||||
|
@ -659,7 +641,7 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.add(menuResubmit);
|
//menu.add(menuResubmit);
|
||||||
grid.setContextMenu(menu);
|
grid.setContextMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,12 +175,11 @@ public interface Resources extends ClientBundle {
|
||||||
@Source("help.html")
|
@Source("help.html")
|
||||||
TextResource help();
|
TextResource help();
|
||||||
|
|
||||||
/**
|
@Source("gislayer/globe24.png")
|
||||||
* @return
|
ImageResource getGlobe24();
|
||||||
*/
|
|
||||||
|
|
||||||
@Source("globe24.png")
|
@Source("gislayer/globe16.png")
|
||||||
ImageResource getGisLayerLogo();
|
ImageResource getGlobe16();
|
||||||
|
|
||||||
@Source("gislayer/globe.png")
|
@Source("gislayer/globe.png")
|
||||||
ImageResource getGlobe();
|
ImageResource getGlobe();
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 879 B |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -213,4 +213,13 @@ public interface TaxonomySearchService extends RemoteService {
|
||||||
List<JobGisLayerModel> getListGisLayerJob()
|
List<JobGisLayerModel> getListGisLayerJob()
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
|
boolean saveGisLayerAsWsLink(
|
||||||
|
JobGisLayerModel jobGisLayer, String destinationFolderId, String fileName) throws Exception;
|
||||||
|
|
||||||
|
boolean changeStatusGisLayerJob(String jobId, DownloadState state);
|
||||||
|
|
||||||
|
boolean cancelGisLayerJob(String jobIdentifier) throws Exception;
|
||||||
|
|
||||||
|
JobGisLayerModel resubmitGisLayerJob(String jobIdentifier) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,4 +171,36 @@ public interface TaxonomySearchServiceAsync {
|
||||||
|
|
||||||
void getListGisLayerJob(AsyncCallback<List<JobGisLayerModel>> callback);
|
void getListGisLayerJob(AsyncCallback<List<JobGisLayerModel>> callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param jobGisLayer
|
||||||
|
* @param id
|
||||||
|
* @param fileName
|
||||||
|
* @param asyncCallback
|
||||||
|
*/
|
||||||
|
public void saveGisLayerAsWsLink(
|
||||||
|
JobGisLayerModel jobGisLayer, String id, String fileName,
|
||||||
|
AsyncCallback<Boolean> asyncCallback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param jobId
|
||||||
|
* @param state
|
||||||
|
* @param asyncCallback
|
||||||
|
*/
|
||||||
|
public void changeStatusGisLayerJob(
|
||||||
|
String jobId, DownloadState state, AsyncCallback<Boolean> asyncCallback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param jobIdentifier
|
||||||
|
* @param asyncCallback
|
||||||
|
*/
|
||||||
|
public void cancelGisLayerJob(
|
||||||
|
String jobIdentifier, AsyncCallback<Boolean> asyncCallback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param jobIdentifier
|
||||||
|
* @param asyncCallback
|
||||||
|
*/
|
||||||
|
public void resubmitGisLayerJob(
|
||||||
|
String jobIdentifier, AsyncCallback<JobGisLayerModel> asyncCallback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,7 +333,7 @@ public class ViewDetailsWindow extends Window {
|
||||||
ToolBar toolbar = new ToolBar();
|
ToolBar toolbar = new ToolBar();
|
||||||
|
|
||||||
Button btnShowInGisViewer = new Button(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TITLE);
|
Button btnShowInGisViewer = new Button(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TITLE);
|
||||||
btnShowInGisViewer.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getGisProducts()));
|
btnShowInGisViewer.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getGlobe16()));
|
||||||
btnShowInGisViewer.setToolTip(new ToolTipConfig(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TITLE, ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TEXT));
|
btnShowInGisViewer.setToolTip(new ToolTipConfig(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TITLE, ConstantsSpeciesDiscovery.CREATE_GIS_LAYER_TEXT));
|
||||||
btnShowInGisViewer.setScale(ButtonScale.SMALL);
|
btnShowInGisViewer.setScale(ButtonScale.SMALL);
|
||||||
btnShowInGisViewer.setIconAlign(IconAlign.TOP);
|
btnShowInGisViewer.setIconAlign(IconAlign.TOP);
|
||||||
|
@ -342,7 +342,7 @@ public class ViewDetailsWindow extends Window {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
SearchController.eventBus.fireEvent(new CreateGisLayerJobEvent(lastSearchEvent.getSearchTerm() + " occurrences Layer", "Gis Layer generated from SPD Portlet by gCube Framework", count));
|
SearchController.eventBus.fireEvent(new CreateGisLayerJobEvent(lastSearchEvent.getSearchTerm() + " occurrences layer", ConstantsSpeciesDiscovery.GIS_LAYER_EVENT_TEXT, count));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,8 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it" -
|
|
||||||
* @author "Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it"
|
* @author "Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it"
|
||||||
|
* @author "Federico De Faveri defaveri@isti.cnr.it" -
|
||||||
*/
|
*/
|
||||||
public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements TaxonomySearchService {
|
public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements TaxonomySearchService {
|
||||||
|
|
||||||
|
@ -2123,4 +2123,123 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
|
||||||
|
|
||||||
return cluster;
|
return cluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#saveGisLayerAsWsLink(org.gcube.portlets.user.speciesdiscovery.shared.JobGisLayerModel, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean saveGisLayerAsWsLink(JobGisLayerModel jobGisLayer, String destinationFolderId, String fileName) throws Exception{
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Workspace workspace = GetWorkspaceUtil.getWorskspace(getASLSession());
|
||||||
|
logger.info("input stream is not null");
|
||||||
|
WorkspaceFolder folder = (WorkspaceFolder) workspace.getItem(destinationFolderId);
|
||||||
|
fileName = WorkspaceUtil.getUniqueName(fileName, folder);
|
||||||
|
workspace.createExternalUrl(fileName, jobGisLayer.getLayerDescription() + "- Layer UUID: "+jobGisLayer.getLayerUUID(), jobGisLayer.getGisViewerAppLink(), destinationFolderId);
|
||||||
|
// System.out.println("input stream is not null");
|
||||||
|
logger.info("Saving External link "+fileName +" completed");
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Sorry, an error occurred saving the file '"+fileName+"' in your Workspace, try again",e);
|
||||||
|
throw new Exception(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#changeStatusGisLayerJob(java.lang.String, org.gcube.portlets.user.speciesdiscovery.shared.DownloadState)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean changeStatusGisLayerJob(String jobId, DownloadState state) {
|
||||||
|
|
||||||
|
GisLayerJobPersistence gisLayerDAO;
|
||||||
|
try {
|
||||||
|
gisLayerDAO = DaoSession.getGisLayersJobDAO(getASLSession());
|
||||||
|
|
||||||
|
int count = GisLayerJobUtil.changetStatusGisLayerJob(jobId, state, gisLayerDAO);
|
||||||
|
|
||||||
|
if(count==1)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
logger.error("An error occured in changeStatusGisLayerJob for jobId: "+jobId);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#cancelGisLayerJob(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean cancelGisLayerJob(String jobIdentifier) throws Exception {
|
||||||
|
|
||||||
|
try{
|
||||||
|
SpeciesService speciesService = getSpeciesService();
|
||||||
|
//REMOVE JOB ON THE SERVICE
|
||||||
|
speciesService.cancelGisLayerByJobId(jobIdentifier);
|
||||||
|
GisLayerJobPersistence gisLayerDao = DaoSession.getGisLayersJobDAO(getASLSession());
|
||||||
|
int count = GisLayerJobUtil.deleteGisLayerJobById(jobIdentifier, gisLayerDao);
|
||||||
|
if(count==1)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.error("Erroron deleting gis layer job ", e);
|
||||||
|
throw new Exception("Sorry, an error occurred deleting gis layer job", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService#resubmitGisLayerJob(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JobGisLayerModel resubmitGisLayerJob(String jobIdentifier) throws Exception {
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// logger.info("Resubmit gis layer job by id: " + jobIdentifier);
|
||||||
|
// JobGisLayerModel jobGisLayerModel = null;
|
||||||
|
// GisLayerJobPersistence gisLayerJobDAO = DaoSession.getGisLayersJobDAO(getASLSession());
|
||||||
|
//
|
||||||
|
// CriteriaBuilder queryBuilder = gisLayerJobDAO.getCriteriaBuilder();
|
||||||
|
// CriteriaQuery<Object> cq = queryBuilder.createQuery();
|
||||||
|
// Predicate pr1 = queryBuilder.equal(gisLayerJobDAO.rootFrom(cq).get(GisLayerJob.ID_FIELD), jobIdentifier);
|
||||||
|
// cq.where(pr1);
|
||||||
|
//
|
||||||
|
// Iterator<GisLayerJob> iterator = gisLayerJobDAO.executeCriteriaQuery(cq).iterator();
|
||||||
|
//
|
||||||
|
// GisLayerJob gisLayerJob;
|
||||||
|
//
|
||||||
|
// if(iterator.hasNext())
|
||||||
|
// gisLayerJob = iterator.next();
|
||||||
|
// else
|
||||||
|
// return jobGisLayerModel;
|
||||||
|
//
|
||||||
|
// SpeciesService speciesService = getSpeciesService();
|
||||||
|
//
|
||||||
|
// //recover taxomyId
|
||||||
|
// String speciesJobId = speciesService.generateGisLayerFromOccurrenceKeys(occurrenceKeys, layerTitle, layerDescr, author, credits)
|
||||||
|
//
|
||||||
|
// long submitTime = Calendar.getInstance().getTimeInMillis();
|
||||||
|
//
|
||||||
|
// String name = RESUBMIT + ": " +NormalizeString.lowerCaseUpFirstChar(gisLayerJob.getDescriptiveName());
|
||||||
|
//
|
||||||
|
// //STORE INTO DAO
|
||||||
|
// TaxonomyJob speciesJob = new TaxonomyJob(speciesJobId, DownloadState.PENDING.toString(), name, gisLayerJob.getDescriptiveName(), gisLayerJob.getDataSourceName(), gisLayerJob.getRank(), 0, submitTime, 0, gisLayerJob.getTaxonomyId());
|
||||||
|
// gisLayerJobDAO.insert(speciesJob);
|
||||||
|
//
|
||||||
|
// jobGisLayerModel = new JobTaxonomyModel(speciesJob.getId(), speciesJob.getDescriptiveName(), DownloadState.PENDING, null, gisLayerJob.getDescriptiveName(), gisLayerJob.getDataSourceName(), gisLayerJob.getRank());
|
||||||
|
//
|
||||||
|
// Date submit = DateUtil.millisecondsToDate(speciesJob.getSubmitTime());
|
||||||
|
//// jobSpeciesModel.setStartTime(DateUtil.dateToDateFormatString(start));
|
||||||
|
// jobGisLayerModel.setSubmitTime(submit);
|
||||||
|
// jobGisLayerModel.setEndTime(null);
|
||||||
|
//
|
||||||
|
// return jobGisLayerModel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,13 @@ package org.gcube.portlets.user.speciesdiscovery.server.job;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
|
import javax.persistence.criteria.Predicate;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.data.spd.model.service.types.CompleteJobStatus;
|
import org.gcube.data.spd.model.service.types.CompleteJobStatus;
|
||||||
|
@ -18,6 +23,7 @@ import org.gcube.portlets.user.speciesdiscovery.server.util.DateUtil;
|
||||||
import org.gcube.portlets.user.speciesdiscovery.shared.DownloadState;
|
import org.gcube.portlets.user.speciesdiscovery.shared.DownloadState;
|
||||||
import org.gcube.portlets.user.speciesdiscovery.shared.GisLayerJob;
|
import org.gcube.portlets.user.speciesdiscovery.shared.GisLayerJob;
|
||||||
import org.gcube.portlets.user.speciesdiscovery.shared.JobGisLayerModel;
|
import org.gcube.portlets.user.speciesdiscovery.shared.JobGisLayerModel;
|
||||||
|
import org.gcube.portlets.user.speciesdiscovery.shared.OccurrencesJob;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -225,4 +231,40 @@ public class GisLayerJobUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param jobId
|
||||||
|
* @param state
|
||||||
|
* @param gisLayerDAO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int changetStatusGisLayerJob(String jobId, DownloadState state, GisLayerJobPersistence gisLayerDAO) {
|
||||||
|
logger.trace("Changing status for Gis Layer job id: " + jobId);
|
||||||
|
// System.out.println("Delete job id: " + jobIdentifier);
|
||||||
|
int result = 0;
|
||||||
|
try{
|
||||||
|
|
||||||
|
CriteriaBuilder queryBuilder = gisLayerDAO.getCriteriaBuilder();
|
||||||
|
CriteriaQuery<Object> cq = queryBuilder.createQuery();
|
||||||
|
Predicate pr1 = queryBuilder.equal(gisLayerDAO.rootFrom(cq).get(OccurrencesJob.ID_FIELD), jobId);
|
||||||
|
cq.where(pr1);
|
||||||
|
|
||||||
|
Iterator<GisLayerJob> iterator = gisLayerDAO.executeCriteriaQuery(cq).iterator();
|
||||||
|
GisLayerJob job;
|
||||||
|
if(iterator.hasNext())
|
||||||
|
job = iterator.next();
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
job.setState(state.toString());
|
||||||
|
gisLayerDAO.update(job);
|
||||||
|
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.error("An error occured in updating status for jobId: " + jobId + " exception: "+e, e );
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -501,8 +501,8 @@ public class SpeciesService {
|
||||||
*
|
*
|
||||||
* @param serverJobId the server job id
|
* @param serverJobId the server job id
|
||||||
* @return the gis layer by job id
|
* @return the gis layer by job id
|
||||||
* @throws SearchServiceException the search service exception
|
* @throws InvalidJobIdException the invalid job id exception
|
||||||
* @throws InvalidJobIdException
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public CompleteJobStatus getGisLayerByJobId(String serverJobId) throws InvalidJobIdException, Exception{
|
public CompleteJobStatus getGisLayerByJobId(String serverJobId) throws InvalidJobIdException, Exception{
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ public class SpeciesService {
|
||||||
*
|
*
|
||||||
* @param serverJobId the server job id
|
* @param serverJobId the server job id
|
||||||
* @return the gis layer result link by job id
|
* @return the gis layer result link by job id
|
||||||
* @throws SearchServiceException the search service exception
|
* @throws InvalidJobIdException the invalid job id exception
|
||||||
*/
|
*/
|
||||||
public String getGisLayerResultLinkByJobId(String serverJobId) throws InvalidJobIdException {
|
public String getGisLayerResultLinkByJobId(String serverJobId) throws InvalidJobIdException {
|
||||||
|
|
||||||
|
@ -543,14 +543,13 @@ public class SpeciesService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the gis layer by job id.
|
* Cancel gis layer by job id.
|
||||||
*
|
*
|
||||||
* @param serverJobId the server job id
|
* @param serverJobId the server job id
|
||||||
* @return the string
|
|
||||||
* @throws SearchServiceException the search service exception
|
|
||||||
*/
|
*/
|
||||||
public void removeGisLayerByJobId(String serverJobId) {
|
public void cancelGisLayerByJobId(String serverJobId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExecutorClient creator = AbstractPlugin.executor().build();
|
ExecutorClient creator = AbstractPlugin.executor().build();
|
||||||
|
@ -893,13 +892,7 @@ public class SpeciesService {
|
||||||
|
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
try {
|
try {
|
||||||
String url = this.executorCall.getResultLink(jobIdentifier); // CHANGE
|
String url = this.executorCall.getResultLink(jobIdentifier);
|
||||||
// INTO
|
|
||||||
// OCCURRENCE
|
|
||||||
// JOB
|
|
||||||
// **************************************************************************************
|
|
||||||
// **
|
|
||||||
// //TODO
|
|
||||||
logger.trace("URL returned by species service is: " + url);
|
logger.trace("URL returned by species service is: " + url);
|
||||||
if (url == null || url.isEmpty()) {
|
if (url == null || url.isEmpty()) {
|
||||||
logger.error("URL returned by species service is: " + url);
|
logger.error("URL returned by species service is: " + url);
|
||||||
|
|
|
@ -35,39 +35,6 @@
|
||||||
<url-pattern>/speciesdiscovery/TaxonomyRowTable</url-pattern>
|
<url-pattern>/speciesdiscovery/TaxonomyRowTable</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<!-- GisViewer Servlets -->
|
|
||||||
<!-- <servlet> -->
|
|
||||||
<!-- <servlet-name>GisViewerService</servlet-name> -->
|
|
||||||
<!-- <servlet-class>org.gcube.portlets.user.gcubegisviewer.server.GCubeGisViewerServletImpl</servlet-class> -->
|
|
||||||
<!-- </servlet> -->
|
|
||||||
|
|
||||||
<!-- <servlet-mapping> -->
|
|
||||||
<!-- <servlet-name>GisViewerService</servlet-name> -->
|
|
||||||
<!-- <url-pattern>/speciesdiscovery/GisViewerService</url-pattern> -->
|
|
||||||
<!-- </servlet-mapping> -->
|
|
||||||
|
|
||||||
<!-- GISVIEWER MAP GENERATOR -->
|
|
||||||
<!-- <servlet> -->
|
|
||||||
<!-- <servlet-name>MapGenerator</servlet-name> -->
|
|
||||||
<!-- <servlet-class>org.gcube.portlets.user.gisviewer.server.MapGenerator</servlet-class> -->
|
|
||||||
<!-- </servlet> -->
|
|
||||||
|
|
||||||
<!-- <servlet-mapping> -->
|
|
||||||
<!-- <servlet-name>MapGenerator</servlet-name> -->
|
|
||||||
<!-- <url-pattern>/speciesdiscovery/MapGenerator</url-pattern> -->
|
|
||||||
<!-- </servlet-mapping> -->
|
|
||||||
|
|
||||||
<!-- Workspace Light Tree servlet -->
|
|
||||||
<!-- <servlet> -->
|
|
||||||
<!-- <servlet-name>WorkspaceLightService</servlet-name> -->
|
|
||||||
<!-- <servlet-class>org.gcube.portlets.widgets.lighttree.server.WorkspaceServiceImpl</servlet-class> -->
|
|
||||||
<!-- </servlet> -->
|
|
||||||
|
|
||||||
<!-- <servlet-mapping> -->
|
|
||||||
<!-- <servlet-name>WorkspaceLightService</servlet-name> -->
|
|
||||||
<!-- <url-pattern>/speciesdiscovery/WorkspaceLightService</url-pattern> -->
|
|
||||||
<!-- </servlet-mapping> -->
|
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>workspaceExplorer</servlet-name>
|
<servlet-name>workspaceExplorer</servlet-name>
|
||||||
<servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class>
|
<servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class>
|
||||||
|
|
Reference in New Issue