Inserted promote api

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/spatial-data/gis-interface@131873 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Fabio Sinibaldi 2016-09-27 14:19:57 +00:00
parent ed1c98acf9
commit 8ac93d091c
1 changed files with 8 additions and 8 deletions

View File

@ -107,12 +107,12 @@ public class GISInterface {
public PublishResponse addGeoTIFF(String workspace, String storeName, String coverageName, public PublishResponse addGeoTIFF(String workspace, String storeName, String coverageName,
File toPublishFile,String srs, File toPublishFile,String srs,
ProjectionPolicy policy,String defaultStyle, double[] bbox, ProjectionPolicy policy,String defaultStyle, double[] bbox,
Metadata geoNetworkMeta, String gnCategory,String gnStylesheet, LoginLevel level){ Metadata geoNetworkMeta, String gnCategory,String gnStylesheet, LoginLevel level, boolean promoteMetadataPublishing){
try{ try{
GeoNetworkPublisher gn=getGN(); GeoNetworkPublisher gn=getGN();
gn.login(level); gn.login(level);
GNInsertConfiguration config=gn.getCurrentUserConfiguration(gnCategory, gnStylesheet); GNInsertConfiguration config=gn.getCurrentUserConfiguration(gnCategory, gnStylesheet);
return addGeoTIFF(workspace, storeName, coverageName, toPublishFile, srs, policy, defaultStyle, bbox, geoNetworkMeta, config, level); return addGeoTIFF(workspace, storeName, coverageName, toPublishFile, srs, policy, defaultStyle, bbox, geoNetworkMeta, config, level,promoteMetadataPublishing);
}catch(Exception e){ }catch(Exception e){
PublishResponse response=new PublishResponse(geoNetworkMeta); PublishResponse response=new PublishResponse(geoNetworkMeta);
response.getMetaOperationMessages().add("Unable to get GN Configuration , cause :"+e.getMessage()); response.getMetaOperationMessages().add("Unable to get GN Configuration , cause :"+e.getMessage());
@ -121,12 +121,12 @@ public class GISInterface {
} }
public PublishResponse publishDBTable(String workspace, String storeName, GSFeatureTypeEncoder fte,GSLayerEncoder layerEncoder, public PublishResponse publishDBTable(String workspace, String storeName, GSFeatureTypeEncoder fte,GSLayerEncoder layerEncoder,
Metadata geoNetworkMeta, String gnCategory,String gnStylesheet,LoginLevel level){ Metadata geoNetworkMeta, String gnCategory,String gnStylesheet,LoginLevel level, boolean promoteMetadataPublishing){
try{ try{
GeoNetworkPublisher gn=getGN(); GeoNetworkPublisher gn=getGN();
gn.login(level); gn.login(level);
GNInsertConfiguration config=gn.getCurrentUserConfiguration(gnCategory, gnStylesheet); GNInsertConfiguration config=gn.getCurrentUserConfiguration(gnCategory, gnStylesheet);
return publishDBTable(workspace, storeName, fte, layerEncoder, geoNetworkMeta, config, level); return publishDBTable(workspace, storeName, fte, layerEncoder, geoNetworkMeta, config, level,promoteMetadataPublishing);
}catch(Exception e){ }catch(Exception e){
PublishResponse response=new PublishResponse(geoNetworkMeta); PublishResponse response=new PublishResponse(geoNetworkMeta);
response.getMetaOperationMessages().add("Unable to get GN Configuration , cause :"+e.getMessage()); response.getMetaOperationMessages().add("Unable to get GN Configuration , cause :"+e.getMessage());
@ -143,7 +143,7 @@ public class GISInterface {
public PublishResponse addGeoTIFF(String workspace, String storeName, String coverageName, public PublishResponse addGeoTIFF(String workspace, String storeName, String coverageName,
File toPublishFile,String srs, File toPublishFile,String srs,
ProjectionPolicy policy,String defaultStyle, double[] bbox, ProjectionPolicy policy,String defaultStyle, double[] bbox,
Metadata geoNetworkMeta, GNInsertConfiguration config, LoginLevel level){ Metadata geoNetworkMeta, GNInsertConfiguration config, LoginLevel level,boolean promoteMetadataPublishing){
boolean publishResult = false; boolean publishResult = false;
PublishResponse toReturn=new PublishResponse(geoNetworkMeta); PublishResponse toReturn=new PublishResponse(geoNetworkMeta);
GeoServerRESTPublisher publisher=null; GeoServerRESTPublisher publisher=null;
@ -182,7 +182,7 @@ public class GISInterface {
Metadata enriched=enricher.getEnriched(); Metadata enriched=enricher.getEnriched();
toReturn.setPublishedMetadata(enriched); toReturn.setPublishedMetadata(enriched);
long returnedId=pub.insertMetadata(config,enriched); long returnedId=promoteMetadataPublishing?pub.insertAndPromoteMetadata(config, enriched):pub.insertMetadata(config,enriched);
toReturn.setReturnedMetaId(returnedId); toReturn.setReturnedMetaId(returnedId);
toReturn.setMetaOperationResult(OperationState.COMPLETE); toReturn.setMetaOperationResult(OperationState.COMPLETE);
@ -218,7 +218,7 @@ public class GISInterface {
} }
@Deprecated @Deprecated
public PublishResponse publishDBTable(String workspace, String storeName, GSFeatureTypeEncoder fte,GSLayerEncoder layerEncoder,Metadata geoNetworkMeta, GNInsertConfiguration config,LoginLevel level){ public PublishResponse publishDBTable(String workspace, String storeName, GSFeatureTypeEncoder fte,GSLayerEncoder layerEncoder,Metadata geoNetworkMeta, GNInsertConfiguration config,LoginLevel level,boolean promoteMetadataPublishing){
boolean publishResult = false; boolean publishResult = false;
PublishResponse toReturn=new PublishResponse(geoNetworkMeta); PublishResponse toReturn=new PublishResponse(geoNetworkMeta);
GeoServerRESTPublisher publisher=null; GeoServerRESTPublisher publisher=null;
@ -263,7 +263,7 @@ public class GISInterface {
getGN().login(level); getGN().login(level);
Metadata enriched=enricher.getEnriched(); Metadata enriched=enricher.getEnriched();
toReturn.setPublishedMetadata(enriched); toReturn.setPublishedMetadata(enriched);
long returnedId=pub.insertMetadata(config,enriched); long returnedId=promoteMetadataPublishing?pub.insertAndPromoteMetadata(config, enriched):pub.insertMetadata(config,enriched);
toReturn.setReturnedMetaId(returnedId); toReturn.setReturnedMetaId(returnedId);
toReturn.setMetaOperationResult(OperationState.COMPLETE); toReturn.setMetaOperationResult(OperationState.COMPLETE);
}else { }else {