Working on Task #7001
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@142466 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6f0417e86e
commit
4e5b889342
|
@ -17,30 +17,30 @@ import com.google.gwt.event.shared.SimpleEventBus;
|
||||||
import com.google.gwt.user.client.Timer;
|
import com.google.gwt.user.client.Timer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SearchBorderLayoutPanel extends ContentPanel {
|
public class SearchBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a singleton
|
* This is a singleton
|
||||||
*/
|
*/
|
||||||
private static SearchBorderLayoutPanel instance;
|
private static SearchBorderLayoutPanel instance;
|
||||||
|
|
||||||
private BorderLayoutData northData;
|
private BorderLayoutData northData;
|
||||||
private BorderLayoutData centerData;
|
private BorderLayoutData centerData;
|
||||||
private BorderLayoutData westData;
|
private BorderLayoutData westData;
|
||||||
private BorderLayoutData southData;
|
private BorderLayoutData southData;
|
||||||
private final BorderLayout layout = new BorderLayout();
|
private final BorderLayout layout = new BorderLayout();
|
||||||
|
|
||||||
private static SearchController searchController;
|
private static SearchController searchController;
|
||||||
private SpeciesSearchFormPanel speciesNorthPanel;
|
private SpeciesSearchFormPanel speciesNorthPanel;
|
||||||
private SpeciesResultsPanelCardLayout speciesCenterPanel;
|
private SpeciesResultsPanelCardLayout speciesCenterPanel;
|
||||||
private SpeciesResultFilterAccordionPanel speciesWestPanel;
|
private SpeciesResultFilterAccordionPanel speciesWestPanel;
|
||||||
|
|
||||||
private SpeciesJobPanel speciesSouthPanel;
|
private SpeciesJobPanel speciesSouthPanel;
|
||||||
|
|
||||||
private final EventBus eventBus;
|
private final EventBus eventBus;
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,78 +53,79 @@ public class SearchBorderLayoutPanel extends ContentPanel {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private SearchBorderLayoutPanel() {
|
private SearchBorderLayoutPanel() {
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
setHeaderVisible(false);
|
setHeaderVisible(false);
|
||||||
|
|
||||||
eventBus = new SimpleEventBus();
|
eventBus = new SimpleEventBus();
|
||||||
|
|
||||||
searchController = new SearchController(eventBus, this);
|
searchController = new SearchController(eventBus, this);
|
||||||
speciesNorthPanel = new SpeciesSearchFormPanel(eventBus);
|
speciesNorthPanel = new SpeciesSearchFormPanel(eventBus);
|
||||||
// speciesNorthPanel.setScrollMode(Scroll.AUTO);
|
// speciesNorthPanel.setScrollMode(Scroll.AUTO);
|
||||||
|
|
||||||
speciesSouthPanel = new SpeciesJobPanel(eventBus);
|
speciesSouthPanel = new SpeciesJobPanel(eventBus);
|
||||||
|
|
||||||
//TODO REMOVE searchController.getStreamPagingLoader()
|
//TODO REMOVE searchController.getStreamPagingLoader()
|
||||||
speciesCenterPanel = new SpeciesResultsPanelCardLayout(eventBus, searchController.getStreamPagingLoader(), searchController);
|
speciesCenterPanel = new SpeciesResultsPanelCardLayout(eventBus, searchController.getStreamPagingLoader(), searchController);
|
||||||
|
|
||||||
northData = new BorderLayoutData(LayoutRegion.NORTH, DEFAULTNORTHHEIGHT);
|
|
||||||
northData.setCollapsible(false);
|
|
||||||
northData.setFloatable(false);
|
|
||||||
northData.setHideCollapseTool(true);
|
|
||||||
northData.setSplit(false);
|
|
||||||
|
|
||||||
westData = new BorderLayoutData(LayoutRegion.WEST, 250, 300, 350);
|
|
||||||
westData.setSplit(true);
|
|
||||||
westData.setCollapsible(true);
|
|
||||||
westData.setMargins(new Margins(0,0,0,0));
|
|
||||||
|
|
||||||
centerData = new BorderLayoutData(LayoutRegion.CENTER);
|
northData = new BorderLayoutData(LayoutRegion.NORTH, DEFAULTNORTHHEIGHT);
|
||||||
centerData.setMargins(new Margins(0));
|
northData.setCollapsible(false);
|
||||||
|
northData.setFloatable(false);
|
||||||
southData = new BorderLayoutData(LayoutRegion.SOUTH, 34, 34, 34);
|
northData.setHideCollapseTool(true);
|
||||||
// southData = new BorderLayoutData(LayoutRegion.SOUTH, 150, 250, 250);
|
northData.setSplit(false);
|
||||||
// southData.setSplit(true);
|
|
||||||
// southData.setCollapsible(true);
|
westData = new BorderLayoutData(LayoutRegion.WEST, 250, 300, 350);
|
||||||
|
westData.setSplit(true);
|
||||||
|
westData.setCollapsible(true);
|
||||||
|
westData.setMargins(new Margins(0,0,0,0));
|
||||||
|
|
||||||
|
centerData = new BorderLayoutData(LayoutRegion.CENTER);
|
||||||
|
centerData.setMargins(new Margins(0));
|
||||||
|
|
||||||
|
southData = new BorderLayoutData(LayoutRegion.SOUTH, 34, 34, 34);
|
||||||
|
// southData = new BorderLayoutData(LayoutRegion.SOUTH, 150, 250, 250);
|
||||||
|
// southData.setSplit(true);
|
||||||
|
// southData.setCollapsible(true);
|
||||||
|
|
||||||
southData.setMargins(new Margins(0,0,0,0));
|
southData.setMargins(new Margins(0,0,0,0));
|
||||||
|
|
||||||
speciesWestPanel = new SpeciesResultFilterAccordionPanel(eventBus, searchController.getStreamPagingLoader());
|
speciesWestPanel = new SpeciesResultFilterAccordionPanel(eventBus, searchController.getStreamPagingLoader());
|
||||||
|
|
||||||
// eventBus.fireEvent(new LoadDataSourceEvent()); //load Data source event is fired
|
// eventBus.fireEvent(new LoadDataSourceEvent()); //load Data source event is fired
|
||||||
|
|
||||||
add(speciesNorthPanel, northData);
|
add(speciesNorthPanel, northData);
|
||||||
add(speciesCenterPanel, centerData);
|
add(speciesCenterPanel, centerData);
|
||||||
add(speciesWestPanel, westData);
|
add(speciesWestPanel, westData);
|
||||||
|
|
||||||
add(speciesSouthPanel, southData);
|
add(speciesSouthPanel, southData);
|
||||||
|
|
||||||
initApplication();
|
initApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initApplication(){
|
private void initApplication(){
|
||||||
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
eventBus.fireEvent(new LoadDataSourceEvent()); //load Data source event is fired
|
eventBus.fireEvent(new LoadDataSourceEvent()); //load Data source event is fired
|
||||||
|
|
||||||
SearchController.excecuteGetJobs(SearchResultType.TAXONOMY_ITEM, false);
|
SearchController.excecuteGetJobs(SearchResultType.TAXONOMY_ITEM, false);
|
||||||
SearchController.excecuteGetJobs(SearchResultType.OCCURRENCE_POINT, false);
|
SearchController.excecuteGetJobs(SearchResultType.OCCURRENCE_POINT, false);
|
||||||
|
SearchController.excecuteGetJobs(SearchResultType.GIS_LAYER_POINT, false);
|
||||||
|
|
||||||
pollSpeciesJobs(ConstantsSpeciesDiscovery.JOBPOLLINGMILLISECONDS);
|
pollSpeciesJobs(ConstantsSpeciesDiscovery.JOBPOLLINGMILLISECONDS);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void pollSpeciesJobs(int milliseconds){
|
public static void pollSpeciesJobs(int milliseconds){
|
||||||
|
|
||||||
Timer timer = new Timer() {
|
Timer timer = new Timer() {
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
|
@ -132,16 +133,17 @@ public class SearchBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
SearchController.excecuteGetJobs(SearchResultType.TAXONOMY_ITEM, false);
|
SearchController.excecuteGetJobs(SearchResultType.TAXONOMY_ITEM, false);
|
||||||
SearchController.excecuteGetJobs(SearchResultType.OCCURRENCE_POINT, false);
|
SearchController.excecuteGetJobs(SearchResultType.OCCURRENCE_POINT, false);
|
||||||
|
SearchController.excecuteGetJobs(SearchResultType.GIS_LAYER_POINT, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
timer.scheduleRepeating(milliseconds);
|
timer.scheduleRepeating(milliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateNorthSize(int height){
|
public void updateNorthSize(int height){
|
||||||
northData.setSize(height);
|
northData.setSize(height);
|
||||||
layout(true);
|
layout(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpeciesSearchFormPanel getSpeciesNorthPanel() {
|
public SpeciesSearchFormPanel getSpeciesNorthPanel() {
|
||||||
|
|
|
@ -286,9 +286,9 @@ public class SearchController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(JobGisLayerModel jobId) {
|
public void onSuccess(JobGisLayerModel gisJob) {
|
||||||
|
GWT.log("Returned gis job: "+gisJob);
|
||||||
Info.display("Gis Layer Occurrence Job", "Generating Gis layer: "+jobId.getJobName()+" submitted");
|
Info.display("Gis Layer Occurrence Job", "Generating Gis layer: "+gisJob.getJobName()+" submitted");
|
||||||
excecuteGetJobs(SearchResultType.GIS_LAYER_POINT, false);
|
excecuteGetJobs(SearchResultType.GIS_LAYER_POINT, false);
|
||||||
searchBorderLayoutPanel.getSpeciesSouthPanel().setIconGisLayerByCounter(1);
|
searchBorderLayoutPanel.getSpeciesSouthPanel().setIconGisLayerByCounter(1);
|
||||||
|
|
||||||
|
@ -297,35 +297,6 @@ public class SearchController {
|
||||||
// showMap(layerName);
|
// showMap(layerName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// SpeciesDiscovery.taxonomySearchService.createOccurrencesJob(listJobOccurrenceModel, createOccurrenceJobEvent.getFileFormat(), createOccurrenceJobEvent.getSaveEnum(), createOccurrenceJobEvent.isByDataSource(), createOccurrenceJobEvent.getExpectedOccurrences(), new AsyncCallback<List<JobOccurrencesModel>>() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFailure(Throwable caught) {
|
|
||||||
// Info.display("Error", "Sorry, An error occurred on create job. Please try again later");
|
|
||||||
// Log.error("Error on loading", "An error occurred on create job, retry." +caught.getMessage());
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess(List<JobOccurrencesModel> result) {
|
|
||||||
//
|
|
||||||
// if(result!=null){
|
|
||||||
// int jobs = result.size();
|
|
||||||
// if(jobs>0){
|
|
||||||
// String msg = jobs==1? "was":"were";
|
|
||||||
// Info.display("Species Occurrence Job", result.size() + " occurrence job "+msg+" submitted");
|
|
||||||
// excecuteGetJobs(SearchResultType.OCCURRENCE_POINT, false);
|
|
||||||
// searchBorderLayoutPanel.getSpeciesSouthPanel().setIconOccurrenceByCounter(result.size());
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// Info.display("Species Occurrence Job","An error occurred on submit job, retry");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1719,6 +1690,7 @@ public class SearchController {
|
||||||
if(resetStructures)
|
if(resetStructures)
|
||||||
GisLayerJobSpeciesPanel.getInstance(eventBus).getGridJob().mask("Loading", ConstantsSpeciesDiscovery.LOADINGSTYLE);
|
GisLayerJobSpeciesPanel.getInstance(eventBus).getGridJob().mask("Loading", ConstantsSpeciesDiscovery.LOADINGSTYLE);
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
|
||||||
SpeciesDiscovery.taxonomySearchService.getListGisLayerJob(new AsyncCallback<List<JobGisLayerModel>>() {
|
SpeciesDiscovery.taxonomySearchService.getListGisLayerJob(new AsyncCallback<List<JobGisLayerModel>>() {
|
||||||
|
|
||||||
|
|
|
@ -518,7 +518,7 @@ public class GisLayerGridJob extends ContentPanel{
|
||||||
public void handleEvent(BaseEvent be) {
|
public void handleEvent(BaseEvent be) {
|
||||||
|
|
||||||
// resetStore();
|
// resetStore();
|
||||||
eventBus.fireEvent(new ReLoadListJobEvent(SearchResultType.OCCURRENCE_POINT));
|
eventBus.fireEvent(new ReLoadListJobEvent(SearchResultType.GIS_LAYER_POINT));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class GisLayerJobSpeciesPanel extends ContentPanel {
|
||||||
private static String LASTOPERATION = "Last Operation: ";
|
private static String LASTOPERATION = "Last Operation: ";
|
||||||
private Html lastOperation = new Html(LASTOPERATION);
|
private Html lastOperation = new Html(LASTOPERATION);
|
||||||
private LayoutContainer lc;
|
private LayoutContainer lc;
|
||||||
private static String WINDOWTITLE = "Species Occurrence Jobs";
|
private static String WINDOWTITLE = "Gis Layer Jobs";
|
||||||
private static final String FAILED = "failed";
|
private static final String FAILED = "failed";
|
||||||
private static final String COMPLETED = "completed";
|
private static final String COMPLETED = "completed";
|
||||||
private static final String LOADING = "loading";
|
private static final String LOADING = "loading";
|
||||||
|
|
|
@ -334,7 +334,7 @@ public class ViewDetailsWindow extends Window {
|
||||||
|
|
||||||
Button btnShowInGisViewer = new Button(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER);
|
Button btnShowInGisViewer = new Button(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER);
|
||||||
btnShowInGisViewer.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getGisProducts()));
|
btnShowInGisViewer.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getGisProducts()));
|
||||||
btnShowInGisViewer.setToolTip(new ToolTipConfig(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER, "Create a Gis Layer from selected occurences points in a Gis Viewer Map"));
|
btnShowInGisViewer.setToolTip(new ToolTipConfig(ConstantsSpeciesDiscovery.CREATE_GIS_LAYER, "Create a Gis Layer from selected occurences points."));
|
||||||
btnShowInGisViewer.setScale(ButtonScale.SMALL);
|
btnShowInGisViewer.setScale(ButtonScale.SMALL);
|
||||||
btnShowInGisViewer.setIconAlign(IconAlign.TOP);
|
btnShowInGisViewer.setIconAlign(IconAlign.TOP);
|
||||||
btnShowInGisViewer.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
btnShowInGisViewer.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||||
|
@ -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("Gis Layer by: "+lastSearchEvent.getSearchTerm(), "Gis Layer generated from SPD Portlet by gCube Framework", count));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -858,6 +858,7 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
|
||||||
String author = getASLSession().getUsername();
|
String author = getASLSession().getUsername();
|
||||||
String credits = "";
|
String credits = "";
|
||||||
GisLayerJobPersistence gisLayerJob = DaoSession.getGisLayersJobDAO(getASLSession());
|
GisLayerJobPersistence gisLayerJob = DaoSession.getGisLayersJobDAO(getASLSession());
|
||||||
|
logger.trace("GisLayerJobPersistence found");
|
||||||
return GisLayerJobUtil.createGisLayerJobByOccurrenceKeys(occurrenceKeys, taxonomyService, layerTitle, layerDescr, author, credits, totalPoints, gisLayerJob);
|
return GisLayerJobUtil.createGisLayerJobByOccurrenceKeys(occurrenceKeys, taxonomyService, layerTitle, layerDescr, author, credits, totalPoints, gisLayerJob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("An error occurred creating the map", e);
|
logger.error("An error occurred creating the map", e);
|
||||||
|
@ -1712,35 +1713,41 @@ public class TaxonomySearchServiceImpl extends RemoteServiceServlet implements T
|
||||||
try {
|
try {
|
||||||
|
|
||||||
GisLayerJobPersistence gisLayerJobDao = DaoSession.getGisLayersJobDAO(getASLSession());
|
GisLayerJobPersistence gisLayerJobDao = DaoSession.getGisLayersJobDAO(getASLSession());
|
||||||
|
|
||||||
Iterator<GisLayerJob> iterator = gisLayerJobDao.getList().iterator();
|
Iterator<GisLayerJob> iterator = gisLayerJobDao.getList().iterator();
|
||||||
SpeciesService taxonomyService = getSpeciesService();
|
SpeciesService taxonomyService = getSpeciesService();
|
||||||
|
|
||||||
while (iterator!=null && iterator.hasNext()) {
|
while (iterator!=null && iterator.hasNext()) {
|
||||||
GisLayerJob job = iterator.next();
|
GisLayerJob job = iterator.next();
|
||||||
CompleteJobStatus statusResponse = taxonomyService.getOccurrenceJobById(job.getId());
|
|
||||||
logger.info("get occurrence job "+job.getId()+ " from service");
|
|
||||||
|
|
||||||
try{
|
if(job.getId()==null || job.getId().isEmpty()){
|
||||||
|
logger.warn("Gis job has an id null or empty, skipping");
|
||||||
|
}else{
|
||||||
|
CompleteJobStatus statusResponse = taxonomyService.getGisLayerByJobId(job.getId());
|
||||||
|
logger.info("get occurrence job "+job.getId()+ " from service");
|
||||||
|
|
||||||
if(statusResponse!=null){
|
try{
|
||||||
logger.info("statusResponse of gis layer job is not null..." + job.getId());
|
|
||||||
JobGisLayerModel convertJob = GisLayerJobUtil.convertJob(job, statusResponse, gisLayerJobDao);
|
|
||||||
|
|
||||||
if(convertJob!=null){
|
if(statusResponse!=null){
|
||||||
logger.info("added list jobOccurrenceId: "+convertJob.getJobIdentifier() + " status "+convertJob.getDownloadState());
|
logger.info("statusResponse of gis layer job is not null..." + job.getId());
|
||||||
listJobs.add(convertJob);
|
JobGisLayerModel convertJob = GisLayerJobUtil.convertJob(job, statusResponse, gisLayerJobDao);
|
||||||
|
|
||||||
|
if(convertJob!=null){
|
||||||
|
logger.info("added list jobOccurrenceId: "+convertJob.getJobIdentifier() + " status "+convertJob.getDownloadState());
|
||||||
|
listJobs.add(convertJob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
logger.info("statusResponse of occurrence job is null..." + job.getId());
|
||||||
|
logger.info("deleting job ..." + job.getId());
|
||||||
|
GisLayerJobUtil.deleteGisLayerJobById(job.getId(),gisLayerJobDao);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else{
|
|
||||||
logger.info("statusResponse of occurrence job is null..." + job.getId());
|
|
||||||
logger.info("deleting job ..." + job.getId());
|
|
||||||
GisLayerJobUtil.deleteGisLayerJobById(job.getId(),gisLayerJobDao);
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("Error on getListGisLayerJob ", e);
|
logger.error("Error on getListGisLayerJob ", e);
|
||||||
throw new Exception("Error on getListGisLayerJob", e);
|
throw new Exception("Error on getListGisLayerJob", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,9 @@ public class GisLayerJobUtil {
|
||||||
Date submitTime = DateUtil.getDateFormat(Calendar.getInstance());
|
Date submitTime = DateUtil.getDateFormat(Calendar.getInstance());
|
||||||
GisLayerJob gisLJ = new GisLayerJob(jobId, layerTitle, 0, submitTime.getTime(), 0, 0, layerDescr, DownloadState.PENDING.toString(), totalPoints);
|
GisLayerJob gisLJ = new GisLayerJob(jobId, layerTitle, 0, submitTime.getTime(), 0, 0, layerDescr, DownloadState.PENDING.toString(), totalPoints);
|
||||||
gisLayerJob.insert(gisLJ);
|
gisLayerJob.insert(gisLJ);
|
||||||
return new JobGisLayerModel(jobId, layerTitle, DownloadState.PENDING,null, submitTime, null, null, layerDescr, 0, totalPoints);
|
JobGisLayerModel jobModel = new JobGisLayerModel(jobId, layerTitle, DownloadState.PENDING,null, submitTime, null, null, layerDescr, 0, totalPoints);
|
||||||
|
logger.info("Returning job: "+jobModel);
|
||||||
|
return jobModel;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("An error occurred creating the map", e);
|
logger.error("An error occurred creating the map", e);
|
||||||
throw new Exception(e.getMessage());
|
throw new Exception(e.getMessage());
|
||||||
|
|
|
@ -489,10 +489,8 @@ public class SpeciesService {
|
||||||
return creator.createLayer(keyStream, details);
|
return creator.createLayer(keyStream, details);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
logger.error(
|
logger.error("Error calling the Species Service: " + e.getMessage(), e);
|
||||||
"Error calling the Species Service: " + e.getMessage(), e);
|
throw new SearchServiceException("Error calling the Species Service: " + e.getMessage());
|
||||||
throw new SearchServiceException(
|
|
||||||
"Error calling the Species Service: " + e.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,22 @@ package org.gcube.portlets.user.speciesdiscovery.shared;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.MappedSuperclass;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Feb 9, 2017
|
* Feb 9, 2017
|
||||||
*/
|
*/
|
||||||
|
@MappedSuperclass
|
||||||
public class DefaultJob implements Serializable{
|
public class DefaultJob implements Serializable{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -4448201743475516557L;
|
private static final long serialVersionUID = 5677419614560436596L;
|
||||||
|
|
||||||
public final static String ID_FIELD = "id";
|
public final static String ID_FIELD = "id";
|
||||||
public final static String NAME = "name";
|
public final static String NAME = "name";
|
||||||
public final static String DESCRIPTION = "description";
|
public final static String DESCRIPTION = "description";
|
||||||
|
@ -44,8 +47,6 @@ public class DefaultJob implements Serializable{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -56,11 +57,7 @@ public class DefaultJob implements Serializable{
|
||||||
* @param state
|
* @param state
|
||||||
* @param elapsedTime
|
* @param elapsedTime
|
||||||
*/
|
*/
|
||||||
public DefaultJob(
|
public DefaultJob(String id, String name, long startTime, long submitTime, long endTime, String description, String state, long elapsedTime) {
|
||||||
String id, String name, long startTime, long submitTime, long endTime,
|
|
||||||
String description, String state, long elapsedTime) {
|
|
||||||
|
|
||||||
super();
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
|
@ -73,177 +70,177 @@ public class DefaultJob implements Serializable{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the id
|
* @return the id
|
||||||
*/
|
*/
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the name
|
* @return the name
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the startTime
|
* @return the startTime
|
||||||
*/
|
*/
|
||||||
public long getStartTime() {
|
public long getStartTime() {
|
||||||
|
|
||||||
return startTime;
|
return startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the submitTime
|
* @return the submitTime
|
||||||
*/
|
*/
|
||||||
public long getSubmitTime() {
|
public long getSubmitTime() {
|
||||||
|
|
||||||
return submitTime;
|
return submitTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the endTime
|
* @return the endTime
|
||||||
*/
|
*/
|
||||||
public long getEndTime() {
|
public long getEndTime() {
|
||||||
|
|
||||||
return endTime;
|
return endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the description
|
* @return the description
|
||||||
*/
|
*/
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
|
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the state
|
* @return the state
|
||||||
*/
|
*/
|
||||||
public String getState() {
|
public String getState() {
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the elapsedTime
|
* @return the elapsedTime
|
||||||
*/
|
*/
|
||||||
public long getElapsedTime() {
|
public long getElapsedTime() {
|
||||||
|
|
||||||
return elapsedTime;
|
return elapsedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id the id to set
|
* @param id the id to set
|
||||||
*/
|
*/
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name the name to set
|
* @param name the name to set
|
||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param startTime the startTime to set
|
* @param startTime the startTime to set
|
||||||
*/
|
*/
|
||||||
public void setStartTime(long startTime) {
|
public void setStartTime(long startTime) {
|
||||||
|
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param submitTime the submitTime to set
|
* @param submitTime the submitTime to set
|
||||||
*/
|
*/
|
||||||
public void setSubmitTime(long submitTime) {
|
public void setSubmitTime(long submitTime) {
|
||||||
|
|
||||||
this.submitTime = submitTime;
|
this.submitTime = submitTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param endTime the endTime to set
|
* @param endTime the endTime to set
|
||||||
*/
|
*/
|
||||||
public void setEndTime(long endTime) {
|
public void setEndTime(long endTime) {
|
||||||
|
|
||||||
this.endTime = endTime;
|
this.endTime = endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param description the description to set
|
* @param description the description to set
|
||||||
*/
|
*/
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
|
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state the state to set
|
* @param state the state to set
|
||||||
*/
|
*/
|
||||||
public void setState(String state) {
|
public void setState(String state) {
|
||||||
|
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param elapsedTime the elapsedTime to set
|
* @param elapsedTime the elapsedTime to set
|
||||||
*/
|
*/
|
||||||
public void setElapsedTime(long elapsedTime) {
|
public void setElapsedTime(long elapsedTime) {
|
||||||
|
|
||||||
this.elapsedTime = elapsedTime;
|
this.elapsedTime = elapsedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
package org.gcube.portlets.user.speciesdiscovery.shared;
|
package org.gcube.portlets.user.speciesdiscovery.shared;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,6 +24,9 @@ public class GisLayerJob extends DefaultJob{
|
||||||
private static final long serialVersionUID = 2604265579184366453L;
|
private static final long serialVersionUID = 2604265579184366453L;
|
||||||
private long totalPoints;
|
private long totalPoints;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
protected int internalId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new gis layer job.
|
* Instantiates a new gis layer job.
|
||||||
|
@ -28,8 +34,6 @@ public class GisLayerJob extends DefaultJob{
|
||||||
public GisLayerJob() {
|
public GisLayerJob() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new gis layer job.
|
* Instantiates a new gis layer job.
|
||||||
*
|
*
|
||||||
|
@ -41,16 +45,11 @@ public class GisLayerJob extends DefaultJob{
|
||||||
* @param description the description
|
* @param description the description
|
||||||
* @param state the state
|
* @param state the state
|
||||||
*/
|
*/
|
||||||
public GisLayerJob(
|
public GisLayerJob(String id, String name, long startTime, long submitTime, long endTime,long elapsedTime, String description, String state, long totalPoints) {
|
||||||
String id, String name, long startTime, long submitTime, long endTime,
|
|
||||||
long elapsedTime, String description, String state, long totalPoints) {
|
|
||||||
super(id, name, startTime, submitTime, endTime, description, state, elapsedTime);
|
super(id, name, startTime, submitTime, endTime, description, state, elapsedTime);
|
||||||
this.totalPoints = totalPoints;
|
this.totalPoints = totalPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the totalPoints
|
* @return the totalPoints
|
||||||
*/
|
*/
|
||||||
|
@ -60,8 +59,6 @@ public class GisLayerJob extends DefaultJob{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param totalPoints the totalPoints to set
|
* @param totalPoints the totalPoints to set
|
||||||
*/
|
*/
|
||||||
|
@ -72,6 +69,16 @@ public class GisLayerJob extends DefaultJob{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the internalId
|
||||||
|
*/
|
||||||
|
public int getInternalId() {
|
||||||
|
|
||||||
|
return internalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
*/
|
*/
|
||||||
|
@ -81,6 +88,8 @@ public class GisLayerJob extends DefaultJob{
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("GisLayerJob [totalPoints=");
|
builder.append("GisLayerJob [totalPoints=");
|
||||||
builder.append(totalPoints);
|
builder.append(totalPoints);
|
||||||
|
builder.append(", internalId=");
|
||||||
|
builder.append(internalId);
|
||||||
builder.append(", id=");
|
builder.append(", id=");
|
||||||
builder.append(id);
|
builder.append(id);
|
||||||
builder.append(", name=");
|
builder.append(", name=");
|
||||||
|
@ -101,6 +110,4 @@ public class GisLayerJob extends DefaultJob{
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ package org.gcube.portlets.user.speciesdiscovery.shared;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +17,7 @@ import java.util.Date;
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Feb 9, 2017
|
* Feb 9, 2017
|
||||||
*/
|
*/
|
||||||
public class JobGisLayerModel implements Serializable{
|
public class JobGisLayerModel implements Serializable, IsSerializable{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -92,7 +94,6 @@ public class JobGisLayerModel implements Serializable{
|
||||||
String layerDescription, long completedPoints,
|
String layerDescription, long completedPoints,
|
||||||
long totalPoints) {
|
long totalPoints) {
|
||||||
|
|
||||||
super();
|
|
||||||
this.jobIdentifier = jobIdentifier;
|
this.jobIdentifier = jobIdentifier;
|
||||||
this.jobName = jobName;
|
this.jobName = jobName;
|
||||||
this.downloadState = downloadState;
|
this.downloadState = downloadState;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<entity-mappings version="2.0" xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">
|
||||||
|
<mapped-superclass class="DefaultJob">
|
||||||
|
</mapped-superclass>
|
||||||
|
</entity-mappings>
|
|
@ -2,8 +2,7 @@
|
||||||
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
|
||||||
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
|
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
|
||||||
<persistence-unit name="SPD_PERSISTENCE_FACTORY"
|
<persistence-unit name="SPD_PERSISTENCE_FACTORY" transaction-type="RESOURCE_LOCAL">
|
||||||
transaction-type="RESOURCE_LOCAL">
|
|
||||||
<class>org.gcube.portlets.user.speciesdiscovery.shared.CommonName</class>
|
<class>org.gcube.portlets.user.speciesdiscovery.shared.CommonName</class>
|
||||||
<class>org.gcube.portlets.user.speciesdiscovery.shared.Taxon</class>
|
<class>org.gcube.portlets.user.speciesdiscovery.shared.Taxon</class>
|
||||||
<class>org.gcube.portlets.user.speciesdiscovery.shared.ResultRow</class>
|
<class>org.gcube.portlets.user.speciesdiscovery.shared.ResultRow</class>
|
||||||
|
@ -12,11 +11,12 @@
|
||||||
<class>org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyRow</class>
|
<class>org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyRow</class>
|
||||||
<class>org.gcube.portlets.user.speciesdiscovery.shared.OccurrencesJob</class>
|
<class>org.gcube.portlets.user.speciesdiscovery.shared.OccurrencesJob</class>
|
||||||
<class>org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyJob</class>
|
<class>org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyJob</class>
|
||||||
|
<class>org.gcube.portlets.user.speciesdiscovery.shared.GisLayerJob</class>
|
||||||
<properties>
|
<properties>
|
||||||
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
|
||||||
<property name="eclipselink.ddl-generation" value="create-tables" />
|
<property name="eclipselink.ddl-generation" value="create-tables" />
|
||||||
<property name="eclipselink.ddl-generation.output-mode"
|
<property name="eclipselink.ddl-generation.output-mode"
|
||||||
value="database" />
|
value="database" />
|
||||||
</properties>
|
</properties>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
</persistence>
|
</persistence>
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.speciesdiscovery.client;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.data.spd.client.plugins.AbstractPlugin;
|
||||||
|
import org.gcube.data.spd.client.proxies.ExecutorClient;
|
||||||
|
import org.gcube.data.spd.model.service.types.CompleteJobStatus;
|
||||||
|
import org.gcube.data.spd.model.service.types.JobStatus;
|
||||||
|
import org.gcube.data.spd.model.service.types.MetadataDetails;
|
||||||
|
import org.gcube.data.streams.Stream;
|
||||||
|
import org.gcube.data.streams.dsl.Streams;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Feb 10, 2017
|
||||||
|
*/
|
||||||
|
public class GisJob {
|
||||||
|
|
||||||
|
static List<String> keys = new ArrayList<String>();
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
ScopeProvider.instance.set("/gcube/devsec");
|
||||||
|
|
||||||
|
keys.add("OBIS:161||666236");
|
||||||
|
ExecutorClient creator = AbstractPlugin.executor().build();
|
||||||
|
Stream<String> keyStream = Streams.convert(keys);
|
||||||
|
System.out.println("keys are: "+keys.toString());
|
||||||
|
|
||||||
|
MetadataDetails details= new MetadataDetails("title", "descr", "tile", "author", "credits");
|
||||||
|
System.out.println("submittings job...");
|
||||||
|
String jobId = creator.createLayer(keyStream, details);
|
||||||
|
System.out.println("The job id is: "+jobId);
|
||||||
|
|
||||||
|
CompleteJobStatus status = creator.getStatus(jobId);
|
||||||
|
|
||||||
|
JobStatus sta = status.getStatus();
|
||||||
|
while(sta!=JobStatus.COMPLETED && sta!=JobStatus.FAILED){
|
||||||
|
Thread.sleep(1000);
|
||||||
|
sta = creator.getStatus(jobId).getStatus();
|
||||||
|
System.out.println("checking status.."+sta);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("job terminated");
|
||||||
|
|
||||||
|
}catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Reference in New Issue