commit
b37cd4233f
@ -0,0 +1,322 @@
|
||||
package org.gcube.application.geoportal.service.engine;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.BBOX;
|
||||
import org.gcube.application.geoportal.common.model.legacy.GeoServerContent;
|
||||
import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
|
||||
import org.gcube.application.geoportal.common.model.legacy.SDILayerDescriptor;
|
||||
import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
|
||||
import org.gcube.application.geoportal.common.utils.Files;
|
||||
import org.gcube.application.geoportal.service.model.internal.faults.SDIInteractionException;
|
||||
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||
import org.gcube.data.transfer.library.DataTransferClient;
|
||||
import org.gcube.data.transfer.library.TransferResult;
|
||||
import org.gcube.data.transfer.library.faults.RemoteServiceException;
|
||||
import org.gcube.data.transfer.model.Destination;
|
||||
import org.gcube.data.transfer.model.DestinationClashPolicy;
|
||||
import org.gcube.data.transfer.model.RemoteFileDescriptor;
|
||||
import org.gcube.spatial.data.gis.GISInterface;
|
||||
import org.gcube.spatial.data.gis.is.AbstractGeoServerDescriptor;
|
||||
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher;
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher.UploadMethod;
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTReader;
|
||||
import it.geosolutions.geoserver.rest.decoder.RESTFeatureType;
|
||||
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.datastore.GSPostGISDatastoreEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class SDIManager {
|
||||
|
||||
static private String DEFAULT_CRS="EPSG:4326";
|
||||
|
||||
|
||||
private GISInterface gis;
|
||||
@Getter
|
||||
private DataTransferClient dtGeoServer;
|
||||
private String geoserverHostName;
|
||||
|
||||
|
||||
public SDIManager() throws SDIInteractionException {
|
||||
try{
|
||||
log.debug("Initializing GIS Interface..");
|
||||
gis=GISInterface.get();
|
||||
AbstractGeoServerDescriptor geoserver=gis.getCurrentGeoServer();
|
||||
if(geoserver==null)
|
||||
throw new Exception("Unable to contact data transfer for geoserver ");
|
||||
|
||||
log.debug("Found geoserver descriptor "+geoserver);
|
||||
geoserverHostName=new URL(gis.getCurrentGeoServer().getUrl()).getHost();
|
||||
|
||||
log.debug("Contacting Data Transfer from geoserver {} ",geoserverHostName);
|
||||
dtGeoServer=DataTransferClient.getInstanceByEndpoint("http://"+geoserverHostName);
|
||||
if(!gis.getCurrentGeoServer().getReader().existGeoserver())
|
||||
throw new Exception("Geoserver not reachable");
|
||||
}catch(Exception e) {
|
||||
throw new SDIInteractionException("Unable to initialize SDI Manager",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public RemoteFileDescriptor getGeoServerRemoteFolder() throws RemoteServiceException {
|
||||
return dtGeoServer.getWebClient().getInfo("geoserver/GNA");
|
||||
}
|
||||
|
||||
public String createWorkspace(String toCreate) throws SDIInteractionException {
|
||||
try {
|
||||
if(!gis.getCurrentGeoServer().getReader().getWorkspaceNames().contains(toCreate)) {
|
||||
log.debug("Creating workspace : "+toCreate);
|
||||
if(!gis.getCurrentGeoServer().getPublisher().createWorkspace(toCreate))
|
||||
throw new SDIInteractionException("Unable to create workspace "+toCreate);
|
||||
}else log.debug("Workspace "+toCreate+" exists.");
|
||||
return toCreate;
|
||||
} catch (IllegalArgumentException | MalformedURLException e) {
|
||||
throw new SDIInteractionException("Unable to create workspace "+toCreate,e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GEOSERVER-PERSISTENCE-ID / GNA / PROJECT-ID/ LAYER-ID /FILENAME(no extension)/...
|
||||
|
||||
public GeoServerContent pushShapeLayerFileSet(SDILayerDescriptor currentElement,String workspace, String projectId) throws SDIInteractionException{
|
||||
try {
|
||||
// String remoteFolder=null;
|
||||
// String fileName=null;
|
||||
|
||||
log.debug("Publishing "+currentElement+" files to geoserver @ "+geoserverHostName);
|
||||
|
||||
GeoServerContent content=new GeoServerContent();
|
||||
content.setGeoserverHostName(geoserverHostName);
|
||||
content.setWorkspace(workspace);
|
||||
WorkspaceManager wsManager=new WorkspaceManager();
|
||||
|
||||
|
||||
|
||||
|
||||
currentElement.getActualContent().forEach((PersistedContent c)->{
|
||||
try {
|
||||
if(c instanceof WorkspaceContent) {
|
||||
WorkspaceContent wc=(WorkspaceContent) c;
|
||||
FileContainer fc=wsManager.getFileById(wc.getStorageID());
|
||||
|
||||
String completeFilename=Files.fixFilename(fc.get().getName());
|
||||
String filename=completeFilename.contains(".")?completeFilename.substring(0, completeFilename.lastIndexOf(".")):completeFilename;
|
||||
|
||||
|
||||
Destination destination=new Destination(completeFilename);
|
||||
destination.setCreateSubfolders(true);
|
||||
destination.setOnExistingFileName(DestinationClashPolicy.REWRITE);
|
||||
destination.setOnExistingSubFolder(DestinationClashPolicy.APPEND);
|
||||
|
||||
destination.setPersistenceId("geoserver");
|
||||
destination.setSubFolder("GNA/"+projectId+"/"+
|
||||
currentElement.getMongo_id()+"/"+filename);
|
||||
|
||||
log.debug("Sending "+wc+" to "+destination);
|
||||
TransferResult result=dtGeoServer.httpSource(fc.getPublicLink(), destination);
|
||||
log.debug("Transferred "+result);
|
||||
|
||||
|
||||
content.getFileNames().add(completeFilename);
|
||||
|
||||
content.setGeoserverPath(result.getRemotePath().substring(0,result.getRemotePath().lastIndexOf("/")));
|
||||
}
|
||||
}catch(Throwable t) {
|
||||
log.warn("Unable to transfer Persisted content"+c,t);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(content.getFileNames().isEmpty())
|
||||
throw new SDIInteractionException("No Persisted content found in "+currentElement);
|
||||
|
||||
String completeFileName=content.getFileNames().get(0);
|
||||
String filename=completeFileName.contains(".")?completeFileName.substring(0, completeFileName.lastIndexOf(".")):completeFileName;
|
||||
|
||||
String remoteFolder=content.getGeoserverPath();
|
||||
|
||||
String toSetLayerName=filename;
|
||||
int count=0;
|
||||
while(gis.getCurrentGeoServer().getReader().getLayer(workspace,toSetLayerName)!=null){
|
||||
count++;
|
||||
toSetLayerName=filename+"_"+count;
|
||||
log.debug("layer for "+filename+" already existing, trying "+toSetLayerName);
|
||||
};
|
||||
|
||||
|
||||
String storeName=toSetLayerName+"_store";
|
||||
content.setStore(storeName);
|
||||
content.setFeatureType(toSetLayerName);
|
||||
|
||||
GeoServerRESTPublisher publisher=gis.getCurrentGeoServer().getPublisher();
|
||||
log.debug("Trying to create remote workspace : "+workspace);
|
||||
createWorkspace(workspace);
|
||||
|
||||
log.debug("Publishing remote folder "+remoteFolder);
|
||||
|
||||
URL directoryPath=new URL("file:"+remoteFolder+"/"+filename+".shp");
|
||||
|
||||
|
||||
//TODO Evaluate SRS
|
||||
|
||||
boolean published=publisher.publishShp(
|
||||
workspace,
|
||||
storeName,
|
||||
null,
|
||||
toSetLayerName,
|
||||
// UploadMethod.FILE, // neeeds zip
|
||||
UploadMethod.EXTERNAL, // needs shp
|
||||
directoryPath.toURI(),
|
||||
DEFAULT_CRS, //SRS
|
||||
""); // default style
|
||||
|
||||
if(!published) {
|
||||
throw new SDIInteractionException("Unable to publish layer "+toSetLayerName+" under "+workspace+". Unknown Geoserver fault.");
|
||||
}
|
||||
|
||||
currentElement.setLayerName(toSetLayerName);
|
||||
GeoServerRESTReader reader=gis.getCurrentGeoServer().getReader();
|
||||
RESTLayer l=reader.getLayer(workspace, toSetLayerName);
|
||||
RESTFeatureType f= reader.getFeatureType(l);
|
||||
/*http://geoserver1.dev.d4science.org/geoserver/gna_conc_18/wms?
|
||||
service=WMS&version=1.1.0&request=GetMap&layers=gna_conc_18:pos&
|
||||
styles=&bbox=8.62091913167495,40.62975046683799,8.621178639172953,40.630257904721645&
|
||||
width=392&height=768&srs=EPSG:4326&format=application/openlayers */
|
||||
|
||||
|
||||
currentElement.setWmsLink(
|
||||
String.format("https://%1$s/geoserver/%2$s/wms?"
|
||||
+"service=WMS&version=1.1.0&request=GetMap&layers=%2$s:%3$s&"
|
||||
+ "styles=&bbox=%4$f,%5$f,%6$f,%7$f&srs=%8$s&format=application/openlayers&width=%9$d&height=%10$d",
|
||||
geoserverHostName,
|
||||
workspace,
|
||||
toSetLayerName,
|
||||
f.getMinX(),
|
||||
f.getMinY(),
|
||||
f.getMaxX(),
|
||||
f.getMaxY(),
|
||||
DEFAULT_CRS,
|
||||
400,
|
||||
400));
|
||||
|
||||
currentElement.setWorkspace(workspace);
|
||||
currentElement.setBbox(new BBOX(f.getMaxY(), f.getMaxX(), f.getMinY(), f.getMinX()));
|
||||
|
||||
|
||||
// TODO Metadata
|
||||
return content;
|
||||
// } catch (InvalidSourceException | SourceNotSetException | FailedTransferException | InitializationException
|
||||
// | InvalidDestinationException | DestinationNotSetException e) {
|
||||
// throw new SDIInteractionException("Unable to transfer fileSet for content "+currentElement,e);
|
||||
} catch (SDIInteractionException e) {
|
||||
throw e;
|
||||
} catch (Throwable t) {
|
||||
throw new SDIInteractionException("Unexpected internal fault while interacting with SDI.",t);
|
||||
}
|
||||
}
|
||||
|
||||
private String createStoreFromPostgisDB(String workspace,String storeName) throws SDIInteractionException {
|
||||
//SET BY PROVISIONING
|
||||
GSPostGISDatastoreEncoder encoder=new GSPostGISDatastoreEncoder(storeName);
|
||||
encoder.setJndiReferenceName("java:comp/env/jdbc/postgres");
|
||||
encoder.setLooseBBox(true);
|
||||
encoder.setDatabaseType("postgis");
|
||||
encoder.setEnabled(true);
|
||||
encoder.setFetchSize(1000);
|
||||
encoder.setValidateConnections(true);
|
||||
try {
|
||||
log.debug("Looking for datastore "+storeName+" under "+workspace);
|
||||
|
||||
if(gis.getCurrentGeoServer().getReader().getDatastore(workspace,storeName)==null)
|
||||
|
||||
if(!gis.getCurrentGeoServer().getDataStoreManager().create(workspace, encoder))
|
||||
throw new SDIInteractionException("Unable to create store "+storeName+" in "+workspace);
|
||||
log.debug("Store "+storeName+" exists under "+workspace);
|
||||
return storeName;
|
||||
} catch (IllegalArgumentException | MalformedURLException e) {
|
||||
throw new SDIInteractionException("Unable to create store "+storeName,e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String publishStyle(File sldFile,String name) throws SDIInteractionException {
|
||||
try {
|
||||
if(!gis.getCurrentGeoServer().getReader().existsStyle(name)) {
|
||||
log.debug("Registering style "+name);
|
||||
if(!gis.getCurrentGeoServer().getPublisher().publishStyle(sldFile, name))
|
||||
throw new SDIInteractionException("Unable to register style "+name);
|
||||
}else log.debug("Style "+name+" already existing");
|
||||
return name;
|
||||
} catch (IllegalArgumentException | MalformedURLException e) {
|
||||
throw new SDIInteractionException("Unable to create style "+name,e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String configureCentroidLayer(String name,String workspace,String storeName) throws SDIInteractionException {
|
||||
|
||||
GSFeatureTypeEncoder fte=new GSFeatureTypeEncoder();
|
||||
fte.setAbstract("Centroid layer for "+name);
|
||||
fte.setEnabled(true);
|
||||
fte.setNativeCRS(DEFAULT_CRS);
|
||||
fte.setTitle(name);
|
||||
fte.setName(name);
|
||||
|
||||
|
||||
String style="clustered_centroids";
|
||||
|
||||
GSLayerEncoder layerEncoder=new GSLayerEncoder();
|
||||
layerEncoder.setDefaultStyle(style);
|
||||
layerEncoder.setEnabled(true);
|
||||
layerEncoder.setQueryable(true);
|
||||
try {
|
||||
//Checking workspace
|
||||
createWorkspace(workspace);
|
||||
//Checking store
|
||||
createStoreFromPostgisDB(workspace, storeName);
|
||||
//Checkig layer
|
||||
publishStyle(Files.getFileFromResources("styles/clustered_points.sld"),style);
|
||||
if(gis.getCurrentGeoServer().getReader().getLayer(workspace, name)==null)
|
||||
if(!gis.getCurrentGeoServer().getPublisher().publishDBLayer(workspace, storeName, fte, layerEncoder))
|
||||
throw new SDIInteractionException("Unable to create layer "+name);
|
||||
log.debug("layer "+name+" already exists");
|
||||
return name;
|
||||
} catch (IllegalArgumentException | MalformedURLException e) {
|
||||
throw new SDIInteractionException("Unable to create layer "+name,e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void deleteContent(GeoServerContent toDelete) throws IllegalArgumentException, MalformedURLException, RemoteServiceException {
|
||||
log.debug("Deleting geoserver layer "+toDelete);
|
||||
//delete layer
|
||||
GeoServerRESTPublisher publisher=gis.getCurrentGeoServer().getPublisher();
|
||||
//delete store
|
||||
publisher.removeDatastore(toDelete.getWorkspace(), toDelete.getStore(), true);
|
||||
//delete WS if empty
|
||||
GeoServerRESTReader reader=gis.getCurrentGeoServer().getReader();
|
||||
if(reader.getDatastores(toDelete.getWorkspace()).isEmpty()) {
|
||||
log.debug("Deleting emtpy workspace "+toDelete.getWorkspace());
|
||||
publisher.removeWorkspace(toDelete.getWorkspace(), true);
|
||||
}
|
||||
//delete file
|
||||
|
||||
dtGeoServer.getWebClient().delete(toDelete.getGeoserverPath());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.gcube.application.geoportal.service.engine;
|
||||
|
||||
import org.gcube.application.geoportal.model.fault.ConfigurationException;
|
||||
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||
|
||||
public class StorageHubProvider implements Engine<StorageHubClient>{
|
||||
|
||||
|
||||
@Override
|
||||
public StorageHubClient getObject() throws ConfigurationException {
|
||||
return new StorageHubClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public void shustdown() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package org.gcube.application.geoportal.service.engine;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
|
||||
import org.gcube.application.geoportal.common.utils.Files;
|
||||
import org.gcube.application.geoportal.model.fault.ConfigurationException;
|
||||
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||
import org.gcube.common.storagehub.client.dsl.FolderContainer;
|
||||
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.Synchronized;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class WorkspaceManager {
|
||||
|
||||
private static final String APP_FOLDER=".GNA_RECORDS";
|
||||
|
||||
|
||||
private StorageHubClient sgClient=null;
|
||||
private FolderContainer appBase=null;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public static class FolderOptions{
|
||||
@NotNull
|
||||
private String folderName;
|
||||
private String folderDescription;
|
||||
private FolderContainer parent;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public static class FileOptions{
|
||||
@NotNull
|
||||
private String fileName;
|
||||
@NonNull
|
||||
private InputStream is;
|
||||
|
||||
private String fileDescription;
|
||||
private FolderContainer parent;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public WorkspaceManager() throws ConfigurationException, StorageHubException {
|
||||
sgClient= ImplementationProvider.get().getSHubProvider().getObject();
|
||||
appBase=getApplicationBaseFolder(sgClient);
|
||||
}
|
||||
|
||||
public FolderContainer createFolder(FolderOptions opts) throws StorageHubException {
|
||||
if(opts.getParent()==null)
|
||||
opts.setParent(appBase);
|
||||
return createFolder(opts,sgClient);
|
||||
}
|
||||
|
||||
public FileContainer getFileById(String id) throws StorageHubException {
|
||||
return sgClient.open(id).asFile();
|
||||
}
|
||||
|
||||
public FolderContainer getFolderById(String id) throws StorageHubException {
|
||||
return sgClient.open(id).asFolder();
|
||||
}
|
||||
|
||||
public FolderContainer getSubFolder(FolderContainer parentFolder,String path) throws StorageHubException {
|
||||
try{
|
||||
return parentFolder.openByRelativePath(path).asFolder();
|
||||
}catch(StorageHubException e) {
|
||||
log.debug("Missing subPath "+path);
|
||||
FolderContainer targetParent=parentFolder;
|
||||
String targetName=path;
|
||||
if(path.contains("/")) {
|
||||
String parent=path.substring(0, path.lastIndexOf("/"));
|
||||
log.debug("Checking intermediate "+parent);
|
||||
targetParent=getSubFolder(parentFolder,parent);
|
||||
targetName=path.substring(path.lastIndexOf("/")+1);
|
||||
}
|
||||
log.debug("Creating "+targetName);
|
||||
return createFolder(new FolderOptions(targetName,"",targetParent),sgClient);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public WorkspaceContent storeToWS(FileOptions opts) throws FileNotFoundException, StorageHubException {
|
||||
FileContainer item=createFile(opts,sgClient);
|
||||
item=sgClient.open(item.getId()).asFile();
|
||||
|
||||
WorkspaceContent content=new WorkspaceContent();
|
||||
content.setLink(item.getPublicLink().toString());
|
||||
content.setMimetype(item.get().getContent().getMimeType());
|
||||
content.setStorageID(item.getId());
|
||||
return content;
|
||||
|
||||
}
|
||||
|
||||
public void deleteFromWS(WorkspaceContent toDelete) throws StorageHubException {
|
||||
sgClient.open(toDelete.getStorageID()).asFile().forceDelete();
|
||||
}
|
||||
|
||||
// STATIC SYNCH METHODS
|
||||
|
||||
@Synchronized
|
||||
private static FolderContainer getApplicationBaseFolder(StorageHubClient sgClient) throws StorageHubException {
|
||||
FolderContainer vre=sgClient.openVREFolder();
|
||||
try {
|
||||
return vre.openByRelativePath(APP_FOLDER).asFolder();
|
||||
}catch(StorageHubException e) {
|
||||
log.debug("APP Fodler missing. Initializing..");
|
||||
FolderContainer toReturn= vre.newFolder(APP_FOLDER, "Base folder for GNA records");
|
||||
toReturn.setHidden();
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private static FolderContainer createFolder(FolderOptions opts, StorageHubClient sgClient) throws StorageHubException {
|
||||
opts.setFolderName(Files.fixFilename(opts.getFolderName()));
|
||||
return opts.getParent().newFolder(opts.getFolderName(),opts.getFolderDescription());
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private static FileContainer createFile(FileOptions opts, StorageHubClient sgClient) throws StorageHubException {
|
||||
opts.setFileName(Files.fixFilename(opts.getFileName()));
|
||||
return opts.getParent().uploadFile(opts.getIs(), opts.getFileName(), opts.getFileDescription());
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
package org.gcube.application.geoportal.service.engine.mongo;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.model.db.DBConstants;
|
||||
import org.gcube.application.geoportal.model.db.PostgisTable;
|
||||
import org.gcube.application.geoportal.model.db.PostgisTable.Field;
|
||||
import org.gcube.application.geoportal.model.db.PostgisTable.FieldType;
|
||||
import org.gcube.application.geoportal.model.fault.ConfigurationException;
|
||||
import org.gcube.application.geoportal.model.fault.PublishException;
|
||||
import org.gcube.application.geoportal.service.engine.SDIManager;
|
||||
import org.gcube.application.geoportal.service.model.internal.faults.SDIInteractionException;
|
||||
import org.gcube.application.geoportal.service.utils.Serialization;
|
||||
import org.gcube.application.geoportal.storage.PostgisDBManager;
|
||||
import org.gcube.application.geoportal.storage.PostgisDBManagerI;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class PostgisIndex {
|
||||
|
||||
@NonNull
|
||||
@Getter
|
||||
private Concessione record;
|
||||
private SDIManager sdiManager;
|
||||
|
||||
|
||||
public PostgisIndex(Concessione record) throws SDIInteractionException {
|
||||
super();
|
||||
this.record = record;
|
||||
this.sdiManager=new SDIManager();
|
||||
}
|
||||
|
||||
|
||||
protected PostgisTable getCentroidsTable() {
|
||||
return DBConstants.Concessioni.CENTROIDS;
|
||||
}
|
||||
|
||||
|
||||
public void registerCentroid() throws PublishException{
|
||||
|
||||
try {
|
||||
log.debug("Evaluating Centroid");
|
||||
Map<String,String> centroidRow=evaluateCentroid();
|
||||
|
||||
log.debug("Contacting postgis DB .. ");
|
||||
PostgisDBManagerI db=PostgisDBManager.get();
|
||||
|
||||
PostgisTable centroidsTable=getCentroidsTable();
|
||||
log.debug("Inserting / updated centroid Row {} ",centroidRow);
|
||||
|
||||
PreparedStatement ps = db.prepareInsertStatement(centroidsTable, true, true);
|
||||
|
||||
log.debug("Deleting centroid if present. ID is "+record.getId());
|
||||
db.deleteByFieldValue(centroidsTable, new Field(DBConstants.Concessioni.PRODUCT_ID,FieldType.TEXT), record.getId()+"");
|
||||
|
||||
centroidsTable.fillCSVPreparedStatament(centroidRow, ps, false);
|
||||
ps.executeUpdate();
|
||||
db.commit();
|
||||
|
||||
initCentroidLayer();
|
||||
|
||||
|
||||
}catch(SQLException e) {
|
||||
log.warn("Unable to publish Centroid for record "+record,e);
|
||||
throw new PublishException("Unable to publish centroid.",e, null);
|
||||
}catch(SDIInteractionException e) {
|
||||
log.warn("Unable to publish Centroid Layer for record type "+getRecord().getRecordType(),e);
|
||||
throw new PublishException("Unable to publish centroid.",e, null);
|
||||
} catch (ConfigurationException e) {
|
||||
log.warn("Unable to contact centroids db "+getRecord().getRecordType(),e);
|
||||
throw new PublishException("Unable to publish centroid.",e, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void initCentroidLayer() throws SDIInteractionException {
|
||||
log.debug("Checking for centroid layer configuration.. ");
|
||||
|
||||
|
||||
sdiManager.configureCentroidLayer("centroids_concessioni", "gna", "gna_postgis");
|
||||
}
|
||||
|
||||
|
||||
public void removeCentroid() {
|
||||
try {
|
||||
PostgisDBManagerI db=PostgisDBManager.get();
|
||||
PostgisTable centroidsTable=getCentroidsTable();
|
||||
log.debug("Deleting centroid if present. ID is "+record.getId());
|
||||
db.deleteByFieldValue(centroidsTable, new Field(DBConstants.Concessioni.PRODUCT_ID,FieldType.TEXT), record.getId()+"");
|
||||
}catch(Exception e) {
|
||||
log.warn("Unable to remove centroid ",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected Map<String,String> evaluateCentroid(){
|
||||
|
||||
|
||||
// CENTROID
|
||||
Map<String,String> centroidsRow=new HashMap<String, String>();
|
||||
centroidsRow.put(DBConstants.Concessioni.PRODUCT_ID, record.getId()+"");
|
||||
centroidsRow.put(DBConstants.Concessioni.ANNO, record.getDataInizioProgetto().getYear()+"");
|
||||
centroidsRow.put(DBConstants.Concessioni.NOME, record.getNome());
|
||||
centroidsRow.put(DBConstants.Concessioni.REGIONE, ""); //TODO
|
||||
|
||||
|
||||
|
||||
if(record.getCentroidLat()==null||record.getCentroidLat()==0)
|
||||
try {
|
||||
log.debug("Evaluating Centroid latitude for record "+record);
|
||||
record.setCentroidLat((record.getPosizionamentoScavo().getBbox().getMaxLat()+
|
||||
record.getPosizionamentoScavo().getBbox().getMinLat())/2);
|
||||
}catch (Throwable t) {
|
||||
log.warn("Unable to evaluate centroid latitude "+t);
|
||||
}
|
||||
|
||||
if(record.getCentroidLong()==null||record.getCentroidLong()==0)
|
||||
try {
|
||||
log.debug("Evaluating Centroid Longituted for record "+record);
|
||||
record.setCentroidLong((record.getPosizionamentoScavo().getBbox().getMaxLong()+
|
||||
record.getPosizionamentoScavo().getBbox().getMinLong())/2);
|
||||
}catch (Throwable t) {
|
||||
log.warn("Unable to evaluate centroid latitude "+t);
|
||||
}
|
||||
|
||||
|
||||
centroidsRow.put(DBConstants.Defaults.XCOORD_FIELD, record.getCentroidLong()+"");
|
||||
centroidsRow.put(DBConstants.Defaults.YCOORD_FIELD, record.getCentroidLat()+"");
|
||||
|
||||
//Updated Schema
|
||||
centroidsRow.put(DBConstants.Concessioni.DESCRIZIONE,record.getIntroduzione());
|
||||
centroidsRow.put(DBConstants.Concessioni.CONTENUTO,record.getDescrizioneContenuto());
|
||||
centroidsRow.put(DBConstants.Concessioni.AUTORE,asString(record.getAuthors()));
|
||||
centroidsRow.put(DBConstants.Concessioni.CONTRIBUTORE,record.getContributore());
|
||||
centroidsRow.put(DBConstants.Concessioni.TITOLARE,asString(record.getTitolari()));
|
||||
centroidsRow.put(DBConstants.Concessioni.RESPONSABILE,record.getResponsabile());
|
||||
centroidsRow.put(DBConstants.Concessioni.EDITORE,record.getEditore());
|
||||
centroidsRow.put(DBConstants.Concessioni.FINANZIAMENTO,asString(record.getFontiFinanziamento()));
|
||||
centroidsRow.put(DBConstants.Concessioni.SOGGETTO,asString(record.getSoggetto()));
|
||||
centroidsRow.put(DBConstants.Concessioni.RISORSE,asString(record.getRisorseCorrelate()));
|
||||
centroidsRow.put(DBConstants.Concessioni.DATE_SCAVO,Serialization.FULL_FORMATTER.format(record.getDataFineProgetto()));
|
||||
centroidsRow.put(DBConstants.Concessioni.DATA_ARCHIVIAZIONE,Serialization.FULL_FORMATTER.format(record.getLastUpdateTime()));
|
||||
centroidsRow.put(DBConstants.Concessioni.VERSIONE,record.getVersion());
|
||||
centroidsRow.put(DBConstants.Concessioni.LICENZA,record.getLicenzaID());
|
||||
centroidsRow.put(DBConstants.Concessioni.TITOLARE_LICENZA,asString(record.getTitolareLicenza()));
|
||||
centroidsRow.put(DBConstants.Concessioni.ACCESSO,record.getPolicy().toString());
|
||||
centroidsRow.put(DBConstants.Concessioni.PAROLE_CHIAVE,asString(record.getParoleChiaveLibere()));
|
||||
|
||||
return centroidsRow;
|
||||
}
|
||||
|
||||
|
||||
private static String asString(Collection<?> coll) {
|
||||
if(coll==null||coll.isEmpty()) return "";
|
||||
StringBuilder builder=new StringBuilder();
|
||||
for(Object t : coll) {
|
||||
builder.append(t.toString() +",");
|
||||
}
|
||||
return builder.substring(0, builder.lastIndexOf(","));
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package org.gcube.application.geoportal.service.model.internal.faults;
|
||||
|
||||
public class InvalidStateException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8926481061304048080L;
|
||||
|
||||
public InvalidStateException() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidStateException(String message, Throwable cause, boolean enableSuppression,
|
||||
boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidStateException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidStateException(String message) {
|
||||
super(message);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidStateException(Throwable cause) {
|
||||
super(cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package org.gcube.application.geoportal.service.model.internal.faults;
|
||||
|
||||
public class SDIInteractionException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SDIInteractionException() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public SDIInteractionException(String message, Throwable cause, boolean enableSuppression,
|
||||
boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public SDIInteractionException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public SDIInteractionException(String message) {
|
||||
super(message);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public SDIInteractionException(Throwable cause) {
|
||||
super(cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,190 @@
|
||||
package org.gcube.application.geoportal.service;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione.Paths;
|
||||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport.ValidationStatus;
|
||||
import org.gcube.application.geoportal.common.rest.AddSectionToConcessioneRequest;
|
||||
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
||||
import org.gcube.application.geoportal.common.rest.TempFile;
|
||||
import org.gcube.application.geoportal.common.utils.Files;
|
||||
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
||||
import org.gcube.application.geoportal.service.legacy.TokenSetter;
|
||||
import org.gcube.application.geoportal.service.utils.Serialization;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
|
||||
|
||||
|
||||
private static final String PATH=InterfaceConstants.Methods.MONGO_CONCESSIONI;
|
||||
|
||||
private static final String PUBLISH_PATH=InterfaceConstants.Methods.PUBLISH_PATH;
|
||||
private static final String FILES_PATH=InterfaceConstants.Methods.REGISTER_FILES_PATH;
|
||||
|
||||
|
||||
@Before
|
||||
public void setContext() {
|
||||
TokenSetter.set("/gcube/devsec/devVRE");
|
||||
}
|
||||
|
||||
|
||||
private static Concessione upload(WebTarget target,String id, String path, String ...files) throws Exception {
|
||||
ArrayList<TempFile> array=new ArrayList<TempFile>();
|
||||
for(String file:files)
|
||||
array.add(new StorageUtils().putOntoStorage(new FileInputStream(
|
||||
Files.getFileFromResources("concessioni/"+file)), file));
|
||||
|
||||
|
||||
AddSectionToConcessioneRequest request=new AddSectionToConcessioneRequest();
|
||||
request.setDestinationPath(path);
|
||||
|
||||
request.setStreams(array);
|
||||
|
||||
return check(target.path(FILES_PATH).path(id).request(MediaType.APPLICATION_JSON).post(Entity.entity(Serialization.write(request), MediaType.APPLICATION_JSON)),Concessione.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static Concessione publish(WebTarget target, Concessione conc) throws Exception {
|
||||
Response resp=target.path(PUBLISH_PATH).path(conc.getMongo_id()).request(MediaType.APPLICATION_JSON).
|
||||
put(Entity.entity(Serialization.write(conc), MediaType.APPLICATION_JSON));
|
||||
return check(resp,Concessione.class);
|
||||
}
|
||||
private static Concessione register(WebTarget target, Concessione c) throws Exception {
|
||||
Response resp=target.request(MediaType.APPLICATION_JSON).post(Entity.entity(Serialization.write(c), MediaType.APPLICATION_JSON));
|
||||
return check(resp,Concessione.class);
|
||||
}
|
||||
|
||||
private static Concessione get(WebTarget target) throws Exception {
|
||||
return register(target,TestModel.prepareConcessione());
|
||||
}
|
||||
|
||||
// ********** TESTS
|
||||
|
||||
@Test
|
||||
public void list() {
|
||||
WebTarget target=target(PATH);
|
||||
System.out.println(target.request(MediaType.APPLICATION_JSON).get(List.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createNew() throws Exception {
|
||||
WebTarget target=target(PATH);
|
||||
Concessione c=register(target,TestModel.prepareConcessione());
|
||||
Assert.assertTrue(c.getMongo_id()!=null&&!c.getMongo_id().isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void delete() throws Exception {
|
||||
WebTarget target=target(PATH);
|
||||
Concessione c = get(target);
|
||||
check(target.path(c.getMongo_id()).request(MediaType.APPLICATION_JSON).delete(),null);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getById() throws Exception {
|
||||
WebTarget target=target(PATH);
|
||||
Concessione c = get(target);
|
||||
Response resp=target.path(c.getMongo_id()).request(MediaType.APPLICATION_JSON).get();
|
||||
Concessione loaded=check(resp,Concessione.class);
|
||||
Assert.assertTrue(loaded.getMongo_id()!=null&&!loaded.getMongo_id().isEmpty());
|
||||
System.out.println("Got by ID "+loaded);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void update() throws Exception {
|
||||
WebTarget target=target(PATH);
|
||||
Concessione c = get(target);
|
||||
String newTitle="Questo titolo l'ho modificato mo nel test quello proprio apposta pewr questa cosa'";
|
||||
c.setNome(newTitle);
|
||||
Response resp=target.request(MediaType.APPLICATION_JSON).put(Entity.entity(Serialization.write(c), MediaType.APPLICATION_JSON));
|
||||
Assert.assertTrue(check(resp,Concessione.class).getNome().equals(newTitle));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uploadFile() throws Exception {
|
||||
WebTarget target=target(PATH);
|
||||
Response resp=target.request(MediaType.APPLICATION_JSON).post(Entity.entity(Serialization.write(TestModel.prepareEmptyConcessione()), MediaType.APPLICATION_JSON));
|
||||
Concessione c=check(resp,Concessione.class);
|
||||
Assert.assertTrue(c.getMongo_id()!=null&&!c.getMongo_id().isEmpty());
|
||||
System.out.println("ID IS "+c.getMongo_id());
|
||||
|
||||
// Insert section
|
||||
c.setRelazioneScavo(TestModel.prepareConcessione().getRelazioneScavo());
|
||||
// c.getRelazioneScavo().setMongo_id(TestModel.rnd());
|
||||
|
||||
resp=target.request(MediaType.APPLICATION_JSON).put(Entity.entity(Serialization.write(c), MediaType.APPLICATION_JSON));
|
||||
|
||||
|
||||
|
||||
|
||||
c=upload(target,c.getMongo_id(),Paths.RELAZIONE,"relazione.pdf");
|
||||
assertNotNull(c.getRelazioneScavo().getActualContent());
|
||||
assertTrue(c.getRelazioneScavo().getActualContent().size()>0);
|
||||
|
||||
System.out.println("File is "+c.getRelazioneScavo().getActualContent().get(0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void publish() throws Exception {
|
||||
WebTarget target=target(PATH);
|
||||
Concessione c=TestModel.prepareConcessione(1,2);
|
||||
|
||||
c.setNome("Concessione : publish test");
|
||||
|
||||
|
||||
|
||||
// Register new
|
||||
c=register(target,c);
|
||||
|
||||
//Upload files
|
||||
upload(target,c.getMongo_id(),Paths.RELAZIONE,"relazione.pdf");
|
||||
upload(target,c.getMongo_id(),Paths.POSIZIONAMENTO,"pos.shp","pos.shx");
|
||||
|
||||
// Clash on workspaces
|
||||
upload(target,c.getMongo_id(),Paths.piantaByIndex(0),"pianta.shp","pianta.shx");
|
||||
upload(target,c.getMongo_id(),Paths.imgByIndex(0),"immagine.png");
|
||||
upload(target,c.getMongo_id(),Paths.imgByIndex(1),"immagine2.png");
|
||||
|
||||
|
||||
|
||||
// Immagini
|
||||
Concessione published=publish(target, c);
|
||||
System.out.println("Published : "+published);
|
||||
assertNotNull(published.getReport());
|
||||
assertEquals(published.getReport().getStatus(),ValidationStatus.PASSED);
|
||||
|
||||
assertEquals(published.getImmaginiRappresentative().size(),2);
|
||||
assertEquals(published.getPianteFineScavo().size(),1);
|
||||
assertNotNull(published.getPosizionamentoScavo().getWmsLink());
|
||||
for(LayerConcessione l : published.getPianteFineScavo())
|
||||
assertNotNull(l.getWmsLink());
|
||||
assertNotNull(published.getCentroidLat());
|
||||
assertNotNull(published.getCentroidLong());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package org.gcube.application.geoportal.service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
|
||||
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
||||
|
||||
|
||||
|
||||
public class TestModel {
|
||||
|
||||
|
||||
public static Concessione prepareEmptyConcessione() {
|
||||
Concessione concessione=new Concessione();
|
||||
|
||||
// Generic fields
|
||||
|
||||
// Concessione fields
|
||||
|
||||
concessione.setNome("MONGO Italia, forse, ma su ");
|
||||
concessione.setIntroduzione("This is my MONGO project");
|
||||
concessione.setDescrizioneContenuto("It contains this and that");
|
||||
|
||||
concessione.setAuthors(Arrays.asList(new String[] {"Some one","Some, oneelse"}));
|
||||
|
||||
concessione.setContributore("Contrib 1");
|
||||
concessione.setTitolari(Arrays.asList(new String[] {"Some one","Some, oneelse"}));
|
||||
concessione.setResponsabile("Someone");
|
||||
concessione.setEditore("Editore");
|
||||
|
||||
concessione.setFontiFinanziamento(Arrays.asList(new String[] {"Big pharma","Pentagon"}));
|
||||
|
||||
|
||||
concessione.setSoggetto(Arrays.asList(new String[] {"Research Excavation","Archeology"}));
|
||||
|
||||
|
||||
concessione.setDataInizioProgetto(LocalDateTime.now());
|
||||
concessione.setDataFineProgetto(LocalDateTime.now());
|
||||
|
||||
concessione.setLicenzaID("CC-BY");
|
||||
|
||||
concessione.setTitolareLicenza(Arrays.asList(new String[] {"Qualcun altro"}));
|
||||
concessione.setTitolareCopyright(Arrays.asList(new String[] {"Chiedilo in giro"}));
|
||||
|
||||
concessione.setParoleChiaveLibere(Arrays.asList(new String[] {"Robba","Stuff"}));
|
||||
concessione.setParoleChiaveICCD(Arrays.asList(new String[] {"vattelapesca","somthing something"}));
|
||||
|
||||
|
||||
concessione.setCentroidLat(43.0); //N-S
|
||||
concessione.setCentroidLong(9.0); //E-W
|
||||
|
||||
return concessione;
|
||||
}
|
||||
|
||||
public static final Concessione setIds(Concessione c) {
|
||||
// c.setMongo_id(rnd());
|
||||
c.getRelazioneScavo().setMongo_id(rnd());
|
||||
c.getPosizionamentoScavo().setMongo_id(rnd());
|
||||
c.getPianteFineScavo().forEach((LayerConcessione l)->{l.setMongo_id(rnd());});
|
||||
c.getImmaginiRappresentative().forEach((UploadedImage i)->{i.setMongo_id(rnd());});
|
||||
return c;
|
||||
}
|
||||
|
||||
public static final String rnd() {
|
||||
return new ObjectId().toHexString();
|
||||
}
|
||||
public static Concessione prepareConcessione() {
|
||||
return prepareConcessione(4,2);
|
||||
}
|
||||
|
||||
public static Concessione prepareConcessione(int pianteCount ,int imgsCount) {
|
||||
|
||||
Concessione concessione=prepareEmptyConcessione();
|
||||
|
||||
|
||||
|
||||
// Attachments
|
||||
|
||||
// Relazione scavo
|
||||
RelazioneScavo relScavo=new RelazioneScavo();
|
||||
|
||||
relScavo.setAbstractIta("simple abstract section");
|
||||
relScavo.setResponsabili(concessione.getAuthors());
|
||||
|
||||
concessione.setRelazioneScavo(relScavo);
|
||||
//Immagini rappresentative
|
||||
ArrayList<UploadedImage> imgs=new ArrayList<>();
|
||||
for(int i=0;i<imgsCount;i++) {
|
||||
UploadedImage img=new UploadedImage();
|
||||
img.setTitolo("My image number "+i);
|
||||
img.setDidascalia("You can see my image number "+i);
|
||||
img.setFormat("TIFF");
|
||||
img.setCreationTime(LocalDateTime.now());
|
||||
img.setResponsabili(concessione.getAuthors());
|
||||
imgs.add(img);
|
||||
}
|
||||
concessione.setImmaginiRappresentative(imgs);
|
||||
//Posizionamento
|
||||
LayerConcessione posizionamento=new LayerConcessione();
|
||||
posizionamento.setValutazioneQualita("Secondo me si");
|
||||
posizionamento.setMetodoRaccoltaDati("Fattobbene");
|
||||
posizionamento.setScalaAcquisizione("1:10000");
|
||||
posizionamento.setAuthors(concessione.getAuthors());
|
||||
concessione.setPosizionamentoScavo(posizionamento);
|
||||
|
||||
// Piante fine scavo
|
||||
ArrayList<LayerConcessione> piante=new ArrayList<LayerConcessione>();
|
||||
for(int i=0;i<pianteCount;i++) {
|
||||
LayerConcessione pianta=new LayerConcessione();
|
||||
pianta.setValutazioneQualita("Secondo me si");
|
||||
pianta.setMetodoRaccoltaDati("Fattobbene");
|
||||
pianta.setScalaAcquisizione("1:10000");
|
||||
pianta.setAuthors(concessione.getAuthors());
|
||||
pianta.setPolicy(AccessPolicy.RESTRICTED);
|
||||
piante.add(pianta);
|
||||
}
|
||||
concessione.setPianteFineScavo(piante);
|
||||
|
||||
return concessione;
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
Reference in New Issue