Compare commits
16 Commits
1.0.1-SNAP
...
master
Author | SHA1 | Date |
---|---|---|
Fabio Sinibaldi | f34d3bff2d | |
Fabio Sinibaldi | 27a326ea33 | |
Fabio Sinibaldi | 220e8f0354 | |
Fabio Sinibaldi | 93b3b9a9c0 | |
Fabio Sinibaldi | 9dc3fd4588 | |
Fabio Sinibaldi | 26b4102828 | |
Fabio Sinibaldi | 6e5c6ba6ff | |
Fabio Sinibaldi | c72decd1af | |
Fabio Sinibaldi | 030488356c | |
Fabio Sinibaldi | b4220cdcef | |
Fabio Sinibaldi | c53a4ff923 | |
Fabio Sinibaldi | 41ec0bd742 | |
Fabio Sinibaldi | 8eb6a93624 | |
Fabio Sinibaldi | 0d174e9353 | |
Fabio Sinibaldi | 31fcac2fc8 | |
Fabio Sinibaldi | 05906f2404 |
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -2,6 +2,19 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
# Changelog for org.gcube.application.geoportal-client
|
# Changelog for org.gcube.application.geoportal-client
|
||||||
|
|
||||||
|
## [v1.0.4-SNAPSHOT] - 2020-11-11
|
||||||
|
Serialization utils
|
||||||
|
Queries & Filters support
|
||||||
|
Test Reports
|
||||||
|
UseCases
|
||||||
|
Fixes #21897
|
||||||
|
|
||||||
|
## [v1.0.3] - 2020-11-11
|
||||||
|
Stateful Concessioni Manager client over mongo
|
||||||
|
|
||||||
|
## [v1.0.2] - 2020-11-11
|
||||||
|
Fixed dulicate dependency declaration
|
||||||
|
|
||||||
## [v1.0.1] - 2020-11-11
|
## [v1.0.1] - 2020-11-11
|
||||||
Excluded common-calls 1.2.0
|
Excluded common-calls 1.2.0
|
||||||
|
|
||||||
|
|
48
pom.xml
48
pom.xml
|
@ -4,7 +4,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.application</groupId>
|
<groupId>org.gcube.application</groupId>
|
||||||
<artifactId>geoportal-client</artifactId>
|
<artifactId>geoportal-client</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>1.0.4-SNAPSHOT</version>
|
||||||
<name>Geoportal Client</name>
|
<name>Geoportal Client</name>
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,21 +36,22 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>gcube-bom</artifactId>
|
<artifactId>gcube-bom</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.1</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.distribution</groupId>
|
||||||
|
<artifactId>gcube-smartgears-bom</artifactId>
|
||||||
|
<version>2.1.0</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- REMOVE FROM GCUBE 5 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.core</groupId>
|
|
||||||
<artifactId>common-gcube-calls</artifactId>
|
|
||||||
<version>[1.0.0,1.2.0)</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
@ -74,12 +75,10 @@
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-generic-clients</artifactId>
|
<artifactId>common-generic-clients</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.core</groupId>
|
|
||||||
<artifactId>common-gcube-calls</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
<artifactId>common-jaxrs-client</artifactId>
|
<artifactId>common-jaxrs-client</artifactId>
|
||||||
|
@ -94,6 +93,13 @@
|
||||||
<version>4.11</version>
|
<version>4.11</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Storage HUB -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>storagehub-client-library</artifactId>
|
||||||
|
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Client for legacy -->
|
<!-- Client for legacy -->
|
||||||
<!-- jackson java time -->
|
<!-- jackson java time -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -113,6 +119,20 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.opencsv</groupId>
|
||||||
|
<artifactId>opencsv</artifactId>
|
||||||
|
<version>3.9</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.cliftonlabs</groupId>
|
||||||
|
<artifactId>json-simple</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,218 @@
|
||||||
|
package org.gcube.application.geoportal.client;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.Configuration;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
|
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
||||||
|
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
|
import org.gcube.common.clients.Call;
|
||||||
|
import org.gcube.common.clients.delegates.ProxyDelegate;
|
||||||
|
|
||||||
|
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 java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.rmi.RemoteException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class DefaultMongoConcessioni implements MongoConcessioni{
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private final ProxyDelegate<WebTarget> delegate;
|
||||||
|
|
||||||
|
private final ObjectMapper mapper=Serialization.mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione createNew(Concessione c) throws Exception {
|
||||||
|
log.debug("Serializing {} ",c);
|
||||||
|
final String serialized=mapper.writeValueAsString(c);
|
||||||
|
Call<WebTarget,Concessione> call= endpoint -> {
|
||||||
|
Response resp= endpoint.request(MediaType.APPLICATION_JSON).post(Entity.entity(serialized, MediaType.APPLICATION_JSON));
|
||||||
|
return check(resp,Concessione.class);
|
||||||
|
};
|
||||||
|
Concessione toReturn = delegate.make(call);
|
||||||
|
log.info("Registered {}",toReturn);
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteById(String id) throws Exception {
|
||||||
|
deleteById(id,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteById(String id,Boolean force) throws Exception {
|
||||||
|
log.debug("Deleting by id {}",id);
|
||||||
|
delegate.make((Call<WebTarget, String>) endpoint -> {
|
||||||
|
check(endpoint.path(id).queryParam(InterfaceConstants.Parameters.FORCE,force).request(MediaType.APPLICATION_JSON).delete(),null);
|
||||||
|
log.info("Deleted by id {}",id);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione getById(String id) throws Exception {
|
||||||
|
log.debug("Loading by id {}",id);
|
||||||
|
Call<WebTarget,Concessione> call= endpoint -> {
|
||||||
|
Response resp= endpoint.path(id).request(MediaType.APPLICATION_JSON).get();
|
||||||
|
return check(resp,Concessione.class);
|
||||||
|
};
|
||||||
|
Concessione toReturn = delegate.make(call);
|
||||||
|
log.debug("Loaded {}",toReturn);
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<Concessione> getList() throws Exception {
|
||||||
|
log.debug("Getting list");
|
||||||
|
Call<WebTarget,Iterator<Concessione>> call= endpoint -> mapper.readerFor(Concessione.class).readValues(
|
||||||
|
endpoint.request(MediaType.APPLICATION_JSON).get(InputStream.class));
|
||||||
|
return delegate.make(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione publish(String id) throws Exception {
|
||||||
|
log.info("Publishing {} ",id);
|
||||||
|
Call<WebTarget,Concessione> call= endpoint -> {
|
||||||
|
Response resp= endpoint.path(InterfaceConstants.Methods.PUBLISH_PATH).
|
||||||
|
path(id).request(MediaType.APPLICATION_JSON).put(Entity.entity(id, MediaType.APPLICATION_JSON));
|
||||||
|
return check(resp,Concessione.class);
|
||||||
|
};
|
||||||
|
Concessione toReturn = delegate.make(call);
|
||||||
|
log.debug("Published {} ",toReturn);
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unPublish(String id) throws Exception {
|
||||||
|
log.info("Publishing {} ",id);
|
||||||
|
|
||||||
|
Call<WebTarget,Concessione> call= endpoint -> {
|
||||||
|
Response resp= endpoint.path(InterfaceConstants.Methods.PUBLISH_PATH).
|
||||||
|
path(id).request(MediaType.APPLICATION_JSON).delete();
|
||||||
|
check(resp,null);
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
delegate.make(call);
|
||||||
|
log.debug("UnPublished {} ",id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Configuration getCurrentConfiguration() throws Exception {
|
||||||
|
return delegate.make(webTarget -> check(webTarget.path(InterfaceConstants.Methods.CONFIGURATION_PATH).
|
||||||
|
request(MediaType.APPLICATION_JSON).get(),Configuration.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<Concessione> search(String s) throws Exception {
|
||||||
|
log.debug("Searching for {}",s);
|
||||||
|
Call<WebTarget,Iterator<Concessione>> call= endpoint -> {
|
||||||
|
Response resp =endpoint.path(InterfaceConstants.Methods.SEARCH_PATH).request(MediaType.APPLICATION_JSON).
|
||||||
|
post(Entity.entity(s,MediaType.APPLICATION_JSON));
|
||||||
|
return checkCollection(resp,Concessione.class);
|
||||||
|
};
|
||||||
|
return delegate.make(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<Concessione> query(QueryRequest queryRequest) throws Exception {
|
||||||
|
log.debug("Querying for {}",queryRequest);
|
||||||
|
return queryForType(queryRequest,Concessione.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String queryForJSON(QueryRequest queryRequest) throws Exception {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> Iterator<T> queryForType(QueryRequest queryRequest, Class<T> aClass) throws Exception {
|
||||||
|
log.debug("Querying for {}",queryRequest);
|
||||||
|
Call<WebTarget, Iterator<T>> call= endpoint -> {
|
||||||
|
Response resp =endpoint.path(InterfaceConstants.Methods.QUERY_PATH).request(MediaType.APPLICATION_JSON).
|
||||||
|
post(Entity.entity(queryRequest,MediaType.APPLICATION_JSON));
|
||||||
|
return checkCollection(resp,aClass);
|
||||||
|
};
|
||||||
|
return delegate.make(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione registerFileSet(String id, AddSectionToConcessioneRequest request) throws Exception {
|
||||||
|
log.info("Registering {} in {}",request,id);
|
||||||
|
Call<WebTarget,Concessione> call= endpoint -> {
|
||||||
|
Response resp= endpoint.path(InterfaceConstants.Methods.REGISTER_FILES_PATH).
|
||||||
|
path(id).request(MediaType.APPLICATION_JSON).post(Entity.entity(mapper.writeValueAsString(request),
|
||||||
|
MediaType.APPLICATION_JSON));
|
||||||
|
return check(resp,Concessione.class);
|
||||||
|
};
|
||||||
|
Concessione toReturn = delegate.make(call);
|
||||||
|
log.debug("Registered Fileset {} result is {} ",request,toReturn);
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione cleanFileSet(String id, String path)throws Exception{
|
||||||
|
log.info("Cleaning Fileset at {} in {}",path,id);
|
||||||
|
Call<WebTarget,Concessione> call= endpoint -> {
|
||||||
|
Response resp= endpoint.path(InterfaceConstants.Methods.DELETE_FILES_PATH).
|
||||||
|
path(id).request(MediaType.APPLICATION_JSON).post(Entity.entity(path,
|
||||||
|
MediaType.APPLICATION_JSON));
|
||||||
|
return check(resp,Concessione.class);
|
||||||
|
};
|
||||||
|
Concessione toReturn = delegate.make(call);
|
||||||
|
log.debug("Cleaned path {} result {} ",path,toReturn);
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione update(String id, String jsonUpdate) throws Exception {
|
||||||
|
throw new Exception("To implement");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione replace(Concessione replacement) throws Exception {
|
||||||
|
log.info("Replacing {}",replacement);
|
||||||
|
Call<WebTarget,Concessione> call= endpoint -> {
|
||||||
|
Response resp= endpoint.
|
||||||
|
request(MediaType.APPLICATION_JSON).
|
||||||
|
put(Entity.entity(mapper.writeValueAsString(replacement),
|
||||||
|
MediaType.APPLICATION_JSON));
|
||||||
|
return check(resp,Concessione.class);
|
||||||
|
};
|
||||||
|
Concessione toReturn = delegate.make(call);
|
||||||
|
log.debug("Reloaded {} ",toReturn);
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected static<T> T check(Response resp, Class<T> clazz) throws IOException {
|
||||||
|
String resString=resp.readEntity(String.class);
|
||||||
|
if(resp.getStatus()<200||resp.getStatus()>=300)
|
||||||
|
throw new RemoteException("RESP STATUS IS "+resp.getStatus()+". Message : "+resString);
|
||||||
|
System.out.println("Resp String is "+resString);
|
||||||
|
if(clazz!=null)
|
||||||
|
return Serialization.read(resString, clazz);
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static<T> Iterator<T> checkCollection(Response resp, Class<T> clazz) throws IOException {
|
||||||
|
if(resp.getStatus()<200||resp.getStatus()>=300)
|
||||||
|
throw new RemoteException("RESP STATUS IS "+resp.getStatus()+". Message : "+resp.readEntity(String.class));
|
||||||
|
if(clazz!=null)
|
||||||
|
return Serialization.readCollection((InputStream) resp.getEntity(), clazz);
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package org.gcube.application.geoportal.client;
|
||||||
|
|
||||||
|
import java.rmi.RemoteException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import javax.ws.rs.client.WebTarget;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.common.model.project.Project;
|
||||||
|
import org.gcube.application.geoportal.common.rest.ProjectsI;
|
||||||
|
import org.gcube.common.clients.Call;
|
||||||
|
import org.gcube.common.clients.delegates.ProxyDelegate;
|
||||||
|
|
||||||
|
import lombok.NonNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DefaultProjects implements ProjectsI{
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private final ProxyDelegate<WebTarget> delegate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteById(String profileId, String projectId) throws RemoteException {
|
||||||
|
deleteById(profileId,projectId,false);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void deleteById(String profileId, String projectId,Boolean force) throws RemoteException {
|
||||||
|
// Call<WebTarget,String> call= new Call<WebTarget, String>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public String call(WebTarget endpoint) throws Exception {
|
||||||
|
// endpoint.path(profileId).path(projectId).request(MediaType.APPLICATION_JSON).delete();
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// try{
|
||||||
|
// delegate.make(call);
|
||||||
|
// }catch(Exception e) {
|
||||||
|
//// throw new RemoteException(e);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<Project> getAll() throws RemoteException {
|
||||||
|
Call<WebTarget,Iterator<Project>> call=new Call<WebTarget,Iterator<Project>>(){
|
||||||
|
@Override
|
||||||
|
public Iterator<Project> call(WebTarget endpoint) throws Exception {
|
||||||
|
throw new Exception("Client method not ready");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
try{
|
||||||
|
return delegate.make(call);
|
||||||
|
}catch(Exception e) {
|
||||||
|
throw new RemoteException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<Project> getByFilter(String filter) throws RemoteException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<Project> getByFilter(String filter, String profileId) throws RemoteException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Project getById(String profileId, String id) throws RemoteException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<Project> getByProfile(String profileId) throws RemoteException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Project registrNew(String profileId, String jsonDocument) throws RemoteException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Project update(String profileId, String projectId, String jsonDocument) throws RemoteException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,12 +2,18 @@ package org.gcube.application.geoportal.client;
|
||||||
|
|
||||||
import javax.ws.rs.client.WebTarget;
|
import javax.ws.rs.client.WebTarget;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||||
import org.gcube.application.geoportal.client.legacy.ConcessioniPlugin;
|
import org.gcube.application.geoportal.client.legacy.ConcessioniPlugin;
|
||||||
|
import org.gcube.application.geoportal.client.legacy.MongoConcessioniPlugin;
|
||||||
|
import org.gcube.application.geoportal.client.legacy.StatefulMongoConcessioni;
|
||||||
|
import org.gcube.application.geoportal.client.legacy.StatefulMongoConcessioniPlugin;
|
||||||
import org.gcube.application.geoportal.common.rest.ConcessioniI;
|
import org.gcube.application.geoportal.common.rest.ConcessioniI;
|
||||||
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
||||||
|
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
import org.gcube.common.clients.Plugin;
|
import org.gcube.common.clients.Plugin;
|
||||||
import org.gcube.common.clients.ProxyBuilder;
|
import org.gcube.common.clients.ProxyBuilder;
|
||||||
import org.gcube.common.clients.ProxyBuilderImpl;
|
import org.gcube.common.clients.ProxyBuilderImpl;
|
||||||
|
import org.gcube.common.clients.config.ProxyConfig;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
@ -15,19 +21,35 @@ import lombok.AllArgsConstructor;
|
||||||
public abstract class GeoportalAbstractPlugin <S, P> implements Plugin<S, P>{
|
public abstract class GeoportalAbstractPlugin <S, P> implements Plugin<S, P>{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static ConcessioniPlugin concessioni_plugin=new ConcessioniPlugin();
|
private static ConcessioniPlugin concessioni_plugin=new ConcessioniPlugin();
|
||||||
|
|
||||||
|
private static MongoConcessioniPlugin mongo_concessioni_plugin=new MongoConcessioniPlugin();
|
||||||
|
|
||||||
|
private static StatefulMongoConcessioniPlugin stateful_mongo_concessioni_plugin=new StatefulMongoConcessioniPlugin();
|
||||||
|
|
||||||
public static ProxyBuilder<ConcessioniI> concessioni() {
|
public static ProxyBuilder<ConcessioniI> concessioni() {
|
||||||
return new ProxyBuilderImpl<WebTarget,ConcessioniI>(concessioni_plugin);
|
return new ProxyBuilderImpl<WebTarget,ConcessioniI>(concessioni_plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
|
public static ProxyBuilder<MongoConcessioni> mongoConcessioni(){
|
||||||
|
return new ProxyBuilderImpl<WebTarget, MongoConcessioni>(mongo_concessioni_plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ProxyBuilder<ConcessioniManagerI> statefulMongoConcessioni(){
|
||||||
|
return new ProxyBuilderImpl<WebTarget, ConcessioniManagerI>(stateful_mongo_concessioni_plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Exception convert(Exception fault, ProxyConfig<?, ?> config) {
|
||||||
|
return fault;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
return this.name;
|
return InterfaceConstants.APPLICATION_BASE_PATH+InterfaceConstants.APPLICATION_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.gcube.application.geoportal.client;
|
||||||
|
|
||||||
|
import javax.ws.rs.client.WebTarget;
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
import javax.xml.transform.dom.DOMResult;
|
||||||
|
import javax.xml.ws.EndpointReference;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
||||||
|
import org.gcube.application.geoportal.common.rest.ProjectsI;
|
||||||
|
import org.gcube.common.calls.jaxrs.GcubeService;
|
||||||
|
import org.gcube.common.calls.jaxrs.TargetFactory;
|
||||||
|
import org.gcube.common.clients.config.ProxyConfig;
|
||||||
|
import org.gcube.common.clients.delegates.ProxyDelegate;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
public class ProjectsPlugin extends GeoportalAbstractPlugin<WebTarget, ProjectsI>{
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Exception convert(Exception fault, ProxyConfig<?, ?> config) {
|
||||||
|
return fault;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProjectsI newProxy(ProxyDelegate<WebTarget> delegate) {
|
||||||
|
return new DefaultProjects(delegate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WebTarget resolve(EndpointReference address, ProxyConfig<?, ?> config) throws Exception {
|
||||||
|
DOMResult result = new DOMResult();
|
||||||
|
address.writeTo(result);
|
||||||
|
Node node =result.getNode();
|
||||||
|
Node child=node.getFirstChild();
|
||||||
|
String addressString = child.getTextContent();
|
||||||
|
GcubeService service = GcubeService.service().
|
||||||
|
withName(new QName(InterfaceConstants.NAMESPACE,InterfaceConstants.Methods.PROJECTS)).
|
||||||
|
andPath(InterfaceConstants.Methods.PROJECTS);
|
||||||
|
return TargetFactory.stubFor(service).at(addressString);
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,7 +26,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ConcessioniManager {
|
public class ConcessioniManager{
|
||||||
|
|
||||||
private static ObjectMapper mapper = new ObjectMapper();
|
private static ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
|
@ -47,11 +47,19 @@ public class ConcessioniManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConcessioniI service;
|
private ConcessioniI service;
|
||||||
|
|
||||||
|
private static enum ImplementationType{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public ConcessioniManager() {
|
public ConcessioniManager() {
|
||||||
service=concessioni().build();
|
service=concessioni().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Concessione getById(String id) throws Exception {
|
public Concessione getById(String id) throws Exception {
|
||||||
log.info("Reading by ID "+id);
|
log.info("Reading by ID "+id);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package org.gcube.application.geoportal.client.legacy;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.InputStreamDescriptor;
|
||||||
|
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;
|
||||||
|
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
|
import org.gcube.application.geoportal.common.rest.TempFile;
|
||||||
|
|
||||||
|
public interface ConcessioniManagerI extends MongoConcessioni{
|
||||||
|
|
||||||
|
|
||||||
|
public Concessione addImmagineRappresentativa(UploadedImage toAdd,TempFile f) throws Exception;
|
||||||
|
public Concessione addPiantaFineScavo(LayerConcessione toAdd,TempFile...files)throws Exception;
|
||||||
|
public Concessione setPosizionamento(LayerConcessione toSet,TempFile...files)throws Exception;
|
||||||
|
public Concessione setRelazioneScavo(RelazioneScavo toSet,TempFile...files)throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Concessione addImmagineRappresentativa(UploadedImage toAdd,InputStreamDescriptor f) throws Exception;
|
||||||
|
public Concessione addPiantaFineScavo(LayerConcessione toAdd,InputStreamDescriptor...files)throws Exception;
|
||||||
|
public Concessione setPosizionamento(LayerConcessione toSet,InputStreamDescriptor...files)throws Exception;
|
||||||
|
public Concessione setRelazioneScavo(RelazioneScavo toSet,InputStreamDescriptor f)throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
public Concessione publish() throws Exception;
|
||||||
|
public void delete() throws Exception;
|
||||||
|
}
|
|
@ -16,9 +16,7 @@ import org.w3c.dom.Node;
|
||||||
|
|
||||||
public class ConcessioniPlugin extends GeoportalAbstractPlugin<WebTarget, ConcessioniI>{
|
public class ConcessioniPlugin extends GeoportalAbstractPlugin<WebTarget, ConcessioniI>{
|
||||||
|
|
||||||
public ConcessioniPlugin() {
|
|
||||||
super(InterfaceConstants.APPLICATION_BASE_PATH+InterfaceConstants.APPLICATION_PATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Exception convert(Exception fault, ProxyConfig<?, ?> config) {
|
public Exception convert(Exception fault, ProxyConfig<?, ?> config) {
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.gcube.application.geoportal.client.legacy;
|
||||||
|
|
||||||
|
import javax.ws.rs.client.WebTarget;
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
import javax.xml.transform.dom.DOMResult;
|
||||||
|
import javax.xml.ws.EndpointReference;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.DefaultMongoConcessioni;
|
||||||
|
import org.gcube.application.geoportal.client.GeoportalAbstractPlugin;
|
||||||
|
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
||||||
|
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
|
import org.gcube.common.calls.jaxrs.GcubeService;
|
||||||
|
import org.gcube.common.calls.jaxrs.TargetFactory;
|
||||||
|
import org.gcube.common.clients.config.ProxyConfig;
|
||||||
|
import org.gcube.common.clients.delegates.ProxyDelegate;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
public class MongoConcessioniPlugin extends GeoportalAbstractPlugin<WebTarget, MongoConcessioni>{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WebTarget resolve(EndpointReference address, ProxyConfig<?, ?> config) throws Exception {
|
||||||
|
DOMResult result = new DOMResult();
|
||||||
|
address.writeTo(result);
|
||||||
|
Node node =result.getNode();
|
||||||
|
Node child=node.getFirstChild();
|
||||||
|
String addressString = child.getTextContent();
|
||||||
|
GcubeService service = GcubeService.service().
|
||||||
|
withName(new QName(InterfaceConstants.NAMESPACE,InterfaceConstants.Methods.MONGO_CONCESSIONI)).
|
||||||
|
andPath(InterfaceConstants.Methods.MONGO_CONCESSIONI);
|
||||||
|
return TargetFactory.stubFor(service).at(addressString);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MongoConcessioni newProxy(ProxyDelegate<WebTarget> delegate) {
|
||||||
|
return new DefaultMongoConcessioni(delegate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,135 @@
|
||||||
|
package org.gcube.application.geoportal.client.legacy;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import javax.ws.rs.client.WebTarget;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.DefaultMongoConcessioni;
|
||||||
|
import org.gcube.application.geoportal.client.utils.FileSets;
|
||||||
|
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.InputStreamDescriptor;
|
||||||
|
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;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
|
||||||
|
import org.gcube.application.geoportal.common.rest.TempFile;
|
||||||
|
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
||||||
|
import org.gcube.common.clients.delegates.ProxyDelegate;
|
||||||
|
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||||
|
|
||||||
|
|
||||||
|
public class StatefulMongoConcessioni extends DefaultMongoConcessioni implements ConcessioniManagerI{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public StatefulMongoConcessioni(ProxyDelegate<WebTarget> delegate) {
|
||||||
|
super(delegate);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Concessione currentC=null;
|
||||||
|
private StorageUtils storage=new StorageUtils();
|
||||||
|
|
||||||
|
|
||||||
|
// Override methods to handle state
|
||||||
|
@Override
|
||||||
|
public Concessione createNew(Concessione c) throws Exception {
|
||||||
|
currentC=super.createNew(c);
|
||||||
|
return currentC;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione getById(String id) throws Exception {
|
||||||
|
currentC= super.getById(id);
|
||||||
|
return currentC;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione publish() throws Exception {
|
||||||
|
if(currentC==null) throw new Exception("Invalid operation : current Concessione is null.");
|
||||||
|
currentC=super.publish(currentC.getMongo_id());
|
||||||
|
return currentC;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete() throws Exception {
|
||||||
|
if(currentC==null) throw new Exception("Invalid operation : current Concessione is null.");
|
||||||
|
super.deleteById(currentC.getMongo_id());
|
||||||
|
currentC=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione addImmagineRappresentativa(UploadedImage toAdd, TempFile f) throws Exception {
|
||||||
|
if(currentC==null) throw new Exception("Invalid operation : current Concessione is null.");
|
||||||
|
if(currentC.getImmaginiRappresentative()==null) currentC.setImmaginiRappresentative(new ArrayList<UploadedImage>());
|
||||||
|
currentC.getImmaginiRappresentative().add(toAdd);
|
||||||
|
currentC=replace(currentC);
|
||||||
|
|
||||||
|
|
||||||
|
currentC=super.registerFileSet(currentC.getMongo_id(),
|
||||||
|
FileSets.build(Paths.imgByIndex(currentC.getImmaginiRappresentative().size()-1),f).getTheRequest());
|
||||||
|
return currentC;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione addPiantaFineScavo(LayerConcessione toAdd, TempFile... files) throws Exception {
|
||||||
|
if(currentC==null) throw new Exception("Invalid operation : current Concessione is null.");
|
||||||
|
if(currentC.getPianteFineScavo()==null) currentC.setPianteFineScavo(new ArrayList<>());
|
||||||
|
currentC.getPianteFineScavo().add(toAdd);
|
||||||
|
currentC=replace(currentC);
|
||||||
|
|
||||||
|
|
||||||
|
currentC=super.registerFileSet(currentC.getMongo_id(),
|
||||||
|
FileSets.build(Paths.piantaByIndex(currentC.getPianteFineScavo().size()-1),files).getTheRequest());
|
||||||
|
return currentC;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione setPosizionamento(LayerConcessione toSet, TempFile... files) throws Exception {
|
||||||
|
if(currentC==null) throw new Exception("Invalid operation : current Concessione is null.");
|
||||||
|
currentC.setPosizionamentoScavo(toSet);
|
||||||
|
currentC=replace(currentC);
|
||||||
|
|
||||||
|
|
||||||
|
currentC=super.registerFileSet(currentC.getMongo_id(),
|
||||||
|
FileSets.build(Paths.POSIZIONAMENTO,files).getTheRequest());
|
||||||
|
return currentC;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione setRelazioneScavo(RelazioneScavo toSet, TempFile... files) throws Exception {
|
||||||
|
if(currentC==null) throw new Exception("Invalid operation : current Concessione is null.");
|
||||||
|
currentC.setRelazioneScavo(toSet);
|
||||||
|
currentC=replace(currentC);
|
||||||
|
|
||||||
|
|
||||||
|
currentC=super.registerFileSet(currentC.getMongo_id(),
|
||||||
|
FileSets.build(Paths.RELAZIONE,files).getTheRequest());
|
||||||
|
return currentC;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione addImmagineRappresentativa(UploadedImage toAdd, InputStreamDescriptor f) throws Exception {
|
||||||
|
return addImmagineRappresentativa(toAdd,FileSets.asTemp(storage,f));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione addPiantaFineScavo(LayerConcessione toAdd, InputStreamDescriptor... files) throws Exception {
|
||||||
|
return addPiantaFineScavo(toAdd, FileSets.asTemp(storage,files));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione setPosizionamento(LayerConcessione toSet, InputStreamDescriptor... files) throws Exception {
|
||||||
|
return setPosizionamento(toSet,FileSets.asTemp(storage,files));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Concessione setRelazioneScavo(RelazioneScavo toSet, InputStreamDescriptor f) throws Exception {
|
||||||
|
return setRelazioneScavo(toSet,FileSets.asTemp(storage,f));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.gcube.application.geoportal.client.legacy;
|
||||||
|
|
||||||
|
import javax.ws.rs.client.WebTarget;
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
import javax.xml.transform.dom.DOMResult;
|
||||||
|
import javax.xml.ws.EndpointReference;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.GeoportalAbstractPlugin;
|
||||||
|
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
||||||
|
import org.gcube.common.calls.jaxrs.GcubeService;
|
||||||
|
import org.gcube.common.calls.jaxrs.TargetFactory;
|
||||||
|
import org.gcube.common.clients.config.ProxyConfig;
|
||||||
|
import org.gcube.common.clients.delegates.ProxyDelegate;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
public class StatefulMongoConcessioniPlugin extends GeoportalAbstractPlugin<WebTarget, ConcessioniManagerI>{
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WebTarget resolve(EndpointReference address, ProxyConfig<?, ?> config) throws Exception {
|
||||||
|
DOMResult result = new DOMResult();
|
||||||
|
address.writeTo(result);
|
||||||
|
Node node =result.getNode();
|
||||||
|
Node child=node.getFirstChild();
|
||||||
|
String addressString = child.getTextContent();
|
||||||
|
GcubeService service = GcubeService.service().
|
||||||
|
withName(new QName(InterfaceConstants.NAMESPACE,InterfaceConstants.Methods.MONGO_CONCESSIONI)).
|
||||||
|
andPath(InterfaceConstants.Methods.MONGO_CONCESSIONI);
|
||||||
|
return TargetFactory.stubFor(service).at(addressString);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConcessioniManagerI newProxy(ProxyDelegate<WebTarget> delegate) {
|
||||||
|
return new StatefulMongoConcessioni(delegate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package org.gcube.application.geoportal.client.utils;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.InputStreamDescriptor;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
|
||||||
|
import org.gcube.application.geoportal.common.rest.TempFile;
|
||||||
|
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
||||||
|
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
public class FileSets {
|
||||||
|
|
||||||
|
public static class RequestBuilder {
|
||||||
|
AddSectionToConcessioneRequest theRequest=new AddSectionToConcessioneRequest();
|
||||||
|
|
||||||
|
public RequestBuilder add(TempFile... f){
|
||||||
|
if(theRequest.getStreams()==null)
|
||||||
|
theRequest.setStreams(new ArrayList<TempFile>());
|
||||||
|
for(TempFile temp: f )
|
||||||
|
theRequest.getStreams().add(temp);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestBuilder add(TempFile f){
|
||||||
|
if(theRequest.getStreams()==null)
|
||||||
|
theRequest.setStreams(new ArrayList<TempFile>());
|
||||||
|
theRequest.getStreams().add(f);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestBuilder setPath(String path){
|
||||||
|
theRequest.setDestinationPath(path);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public AddSectionToConcessioneRequest getTheRequest(){return theRequest;}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static RequestBuilder build(String path) {
|
||||||
|
return new RequestBuilder().setPath(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RequestBuilder build(String path, TempFile...files) {
|
||||||
|
return new RequestBuilder().setPath(path).add(files);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TempFile asTemp(StorageUtils storage,InputStreamDescriptor descriptor) throws RemoteBackendException, FileNotFoundException {
|
||||||
|
return storage.putOntoStorage(descriptor.getStream(), descriptor.getFilename());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TempFile[] asTemp(StorageUtils storage,InputStreamDescriptor... descriptors) throws RemoteBackendException, FileNotFoundException {
|
||||||
|
ArrayList<TempFile> toReturn=new ArrayList<TempFile>();
|
||||||
|
for(InputStreamDescriptor desc:descriptors)
|
||||||
|
toReturn.add(storage.putOntoStorage(desc.getStream(), desc.getFilename()));
|
||||||
|
return toReturn.toArray(new TempFile[toReturn.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AddSectionToConcessioneRequest prepareRequestFromFolder(StorageUtils storage, String path, File directory) throws FileNotFoundException {
|
||||||
|
|
||||||
|
File[] children =directory.listFiles();
|
||||||
|
System.out.println("Found "+children+ " files to push");
|
||||||
|
InputStreamDescriptor[] iss=new InputStreamDescriptor[children.length];
|
||||||
|
return prepareRequest(storage,path,children);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AddSectionToConcessioneRequest prepareRequest(StorageUtils storage, String path, File... toUpload) throws FileNotFoundException {
|
||||||
|
|
||||||
|
FileSets.RequestBuilder builder = FileSets.build(path);
|
||||||
|
for (File f : toUpload) {
|
||||||
|
if(!f.isDirectory())
|
||||||
|
builder.add(FileSets.asTemp(storage, new InputStreamDescriptor(new FileInputStream(f), f.getName())));
|
||||||
|
}
|
||||||
|
return builder.getTheRequest();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.application.geoportal.client.utils;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.bson.Document;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
|
import org.gcube.application.geoportal.common.utils.Files;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
public class Queries {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static QueryRequest parse(String json) throws IOException {
|
||||||
|
Document queryDocument=Document.parse(json);
|
||||||
|
QueryRequest req=new QueryRequest();
|
||||||
|
if(queryDocument.containsKey("ordering"))
|
||||||
|
req.setOrdering(Serialization.read(((Document)queryDocument.get("ordering")).toJson(),QueryRequest.OrderedRequest.class));
|
||||||
|
if(queryDocument.containsKey("paging"))
|
||||||
|
req.setPaging(Serialization.read(((Document)queryDocument.get("paging")).toJson(),QueryRequest.PagedRequest.class));
|
||||||
|
req.setProjection(queryDocument.get("projection",Document.class));
|
||||||
|
req.setFilter(queryDocument.get("filter",Document.class));
|
||||||
|
|
||||||
|
return req;
|
||||||
|
};
|
||||||
|
|
||||||
|
public static QueryRequest readPath(String jsonFilePath) throws IOException{
|
||||||
|
return parse(Files.readFileAsString(jsonFilePath, Charset.defaultCharset()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static QueryRequest readFile(File jsonFile)throws IOException{
|
||||||
|
return parse(Files.readFileAsString(jsonFile.getAbsolutePath(), Charset.defaultCharset()));
|
||||||
|
}
|
||||||
|
public static QueryRequest read(InputStream is)throws IOException{
|
||||||
|
return parse(IOUtils.toString(is));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.gcube.application.geoportal.client.utils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
|
||||||
|
public class Serialization {
|
||||||
|
|
||||||
|
public static final DateTimeFormatter FULL_FORMATTER=DateTimeFormatter.ofPattern("uuuuMMdd_HH-mm-ss");
|
||||||
|
|
||||||
|
public static ObjectMapper mapper;
|
||||||
|
|
||||||
|
static {
|
||||||
|
mapper=new ObjectMapper();
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
|
||||||
|
mapper.registerModule(new JavaTimeModule());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T read(String jsonString,Class<T> clazz) throws JsonProcessingException, IOException {
|
||||||
|
return mapper.readerFor(clazz).readValue(jsonString);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String write(Object obj) throws JsonProcessingException, IOException {
|
||||||
|
return mapper.writeValueAsString(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Iterator<T> readCollection(String jsonString, Class<T> clazz) throws IOException {
|
||||||
|
return mapper.readerFor(clazz).readValues(jsonString);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Iterator<T> readCollection(InputStream is, Class<T> clazz) throws IOException {
|
||||||
|
return mapper.readerFor(clazz).readValues(is);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.gcube.application.geoportal;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.clients.TokenSetter;
|
||||||
|
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.common.storagehub.client.dsl.StorageHubClient;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
|
public class StorageTests {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws FileNotFoundException {
|
||||||
|
FileInputStream fis =new FileInputStream(Files.getFileFromResources("concessioni/relazione.pdf"));
|
||||||
|
String filename= "relazione.pdf";
|
||||||
|
|
||||||
|
String sourceContext="/d4science.research-infrastructures.eu";
|
||||||
|
String targetContext="/pred4s/preprod/preVRE";
|
||||||
|
|
||||||
|
TokenSetter.set(sourceContext);
|
||||||
|
|
||||||
|
StorageHubClient sgClient=new StorageHubClient();
|
||||||
|
|
||||||
|
TokenSetter.set(targetContext);
|
||||||
|
|
||||||
|
TempFile file= new StorageUtils().putOntoStorage(fis,filename);
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println(new StorageUtils().getUrlById(file.getId()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.gcube.application.geoportal.clients;
|
||||||
|
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
|
public class BasicVreTests {
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setScope(){
|
||||||
|
// TokenSetter.set("/gcube/devNext/NextNext");
|
||||||
|
TokenSetter.set("/gcube/devsec/devVRE");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
package org.gcube.application.geoportal.clients;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||||
|
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||||
|
import org.gcube.application.geoportal.common.model.TestModel;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.InputStreamDescriptor;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport.ValidationStatus;
|
||||||
|
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.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
public class StatefulClientTests extends BasicVreTests{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private Concessione publishNew() throws Exception {
|
||||||
|
ConcessioniManagerI manager=statefulMongoConcessioni().build();
|
||||||
|
StorageUtils storage=new StorageUtils();
|
||||||
|
|
||||||
|
|
||||||
|
Concessione toRegister= TestModel.prepareEmptyConcessione();
|
||||||
|
toRegister.setNome("Mock module");
|
||||||
|
manager.createNew(toRegister);
|
||||||
|
|
||||||
|
UploadedImage toRegisterImg=TestModel.prepareConcessione().getImmaginiRappresentative().get(0);
|
||||||
|
|
||||||
|
// TEMP Files are hosted in INFRASTRUCTURE's VOLATILE AREA
|
||||||
|
TempFile toUpload=storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("concessioni/immagine.png")), "immagine.png");
|
||||||
|
manager.addImmagineRappresentativa(toRegisterImg, toUpload);
|
||||||
|
|
||||||
|
//Alternative Method
|
||||||
|
InputStreamDescriptor isDesc=new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/immagine.png")), "immagine.png");
|
||||||
|
manager.addImmagineRappresentativa(toRegisterImg, isDesc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Relazione
|
||||||
|
manager.setRelazioneScavo(TestModel.prepareConcessione().getRelazioneScavo(),
|
||||||
|
storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("concessioni/relazione.pdf")), "relazione_it.pdf"),
|
||||||
|
storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("concessioni/relazione.pdf")), "relazione_en.pdf"));
|
||||||
|
|
||||||
|
// Posizionamento scavo
|
||||||
|
manager.setPosizionamento(TestModel.prepareConcessione().getPosizionamentoScavo(),
|
||||||
|
storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("concessioni/pos.shp")), "pos.shp"));
|
||||||
|
|
||||||
|
// Piante
|
||||||
|
manager.addPiantaFineScavo(TestModel.prepareConcessione().getPianteFineScavo().get(0),
|
||||||
|
storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("concessioni/pianta.shp")), "pianta.shp"),
|
||||||
|
storage.putOntoStorage(new FileInputStream(Files.getFileFromResources("concessioni/pianta.shx")), "pianta.shx"));
|
||||||
|
|
||||||
|
return manager.publish();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRegisterNew() throws RemoteBackendException, FileNotFoundException, Exception {
|
||||||
|
Concessione published=publishNew();
|
||||||
|
|
||||||
|
|
||||||
|
// VARIOUS CHECKS
|
||||||
|
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());
|
||||||
|
|
||||||
|
System.out.println(Serialization.write(published));
|
||||||
|
System.out.println(Serialization.write(published.getReport()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void delete() throws Exception {
|
||||||
|
ConcessioniManagerI manager=statefulMongoConcessioni().build();
|
||||||
|
StorageUtils storage=new StorageUtils();
|
||||||
|
|
||||||
|
manager.createNew(TestModel.prepareEmptyConcessione());
|
||||||
|
|
||||||
|
manager.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void replace() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getById() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void list() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,216 @@
|
||||||
|
package org.gcube.application.geoportal.clients;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||||
|
import org.gcube.application.geoportal.client.utils.Queries;
|
||||||
|
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||||
|
import org.gcube.application.geoportal.common.model.TestModel;
|
||||||
|
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.report.ValidationReport.ValidationStatus;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
|
||||||
|
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
|
import org.gcube.application.geoportal.common.utils.Files;
|
||||||
|
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class StatelessClientTests extends BasicVreTests{
|
||||||
|
|
||||||
|
|
||||||
|
private MongoConcessioni client=mongoConcessioni().build();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateNew() throws Exception {
|
||||||
|
Concessione c= client.createNew(TestModel.prepareEmptyConcessione());
|
||||||
|
assertNotNull(c);
|
||||||
|
assertNotNull(c.getMongo_id());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteById() throws Exception {
|
||||||
|
Concessione c= client.createNew(TestModel.prepareEmptyConcessione());
|
||||||
|
client.deleteById(c.getMongo_id());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testList() throws Exception {
|
||||||
|
final AtomicLong counter=new AtomicLong();
|
||||||
|
long before=System.currentTimeMillis();
|
||||||
|
client.getList().forEachRemaining((Concessione c)-> {counter.addAndGet(1);});
|
||||||
|
System.out.println("Loaded "+counter+" in "+(System.currentTimeMillis()-before)+" ms");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReplace() throws Exception {
|
||||||
|
Concessione c= client.createNew(TestModel.prepareEmptyConcessione());
|
||||||
|
|
||||||
|
String title="My new shiny Title";
|
||||||
|
c.setNome(title);
|
||||||
|
Concessione c1=client.replace(c);
|
||||||
|
assertEquals(title, c1.getNome());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUploadFileSet() throws Exception {
|
||||||
|
Concessione c= client.createNew(TestModel.prepareConcessione());
|
||||||
|
assertNotNull(c.getRelazioneScavo());
|
||||||
|
AddSectionToConcessioneRequest request=
|
||||||
|
new AddSectionToConcessioneRequest(Paths.RELAZIONE,
|
||||||
|
Collections.singletonList(new StorageUtils().putOntoStorage(
|
||||||
|
new FileInputStream(Files.getFileFromResources("concessioni/relazione.pdf")), "relazione.pdf")));
|
||||||
|
|
||||||
|
c= client.registerFileSet(c.getMongo_id(), request);
|
||||||
|
|
||||||
|
assertNotNull(c.getRelazioneScavo().getActualContent());
|
||||||
|
assertNotNull(c.getRelazioneScavo().getActualContent().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPublsh() throws Exception {
|
||||||
|
publish(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Concessione publish(Boolean verify) throws Exception {
|
||||||
|
return publish(verify,client);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static Concessione publish(Boolean verify,MongoConcessioni client) throws Exception {
|
||||||
|
Concessione c= client.createNew(TestModel.prepareConcessione());
|
||||||
|
|
||||||
|
String mongoId=c.getMongo_id();
|
||||||
|
|
||||||
|
AddSectionToConcessioneRequest request=
|
||||||
|
new AddSectionToConcessioneRequest(Paths.RELAZIONE,
|
||||||
|
Collections.singletonList(new StorageUtils().putOntoStorage(
|
||||||
|
new FileInputStream(Files.getFileFromResources("concessioni/relazione.pdf")), "relazione.pdf")));
|
||||||
|
|
||||||
|
client.registerFileSet(mongoId, request);
|
||||||
|
|
||||||
|
request=
|
||||||
|
new AddSectionToConcessioneRequest(Paths.imgByIndex(0),
|
||||||
|
Collections.singletonList(new StorageUtils().putOntoStorage(
|
||||||
|
new FileInputStream(Files.getFileFromResources("concessioni/immagine.png")), "immagine.png")));
|
||||||
|
|
||||||
|
client.registerFileSet(mongoId, request);
|
||||||
|
|
||||||
|
|
||||||
|
request=
|
||||||
|
new AddSectionToConcessioneRequest(Paths.POSIZIONAMENTO,
|
||||||
|
Collections.singletonList(new StorageUtils().putOntoStorage(
|
||||||
|
new FileInputStream(Files.getFileFromResources("concessioni/pos.shp")), "pos.shp")));
|
||||||
|
|
||||||
|
client.registerFileSet(mongoId, request);
|
||||||
|
|
||||||
|
request=
|
||||||
|
new AddSectionToConcessioneRequest(Paths.piantaByIndex(0),
|
||||||
|
Collections.singletonList(new StorageUtils().putOntoStorage(
|
||||||
|
new FileInputStream(Files.getFileFromResources("concessioni/pianta.shp")), "pianta.shp")));
|
||||||
|
|
||||||
|
client.registerFileSet(mongoId, request);
|
||||||
|
|
||||||
|
|
||||||
|
c=client.publish(mongoId);
|
||||||
|
|
||||||
|
if(verify)
|
||||||
|
assertTrue(c.getReport().getStatus().equals(ValidationStatus.PASSED));
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getConfiguration() throws Exception {
|
||||||
|
System.out.println(client.getCurrentConfiguration());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void searches() throws Exception {
|
||||||
|
for(File filterFile:new File("src/test/resources/concessioni/filters").listFiles()) {
|
||||||
|
String query=Files.readFileAsString(filterFile.getAbsolutePath(), Charset.defaultCharset());
|
||||||
|
System.out.println("Count for "+filterFile.getName()+"\t"+ count(client.search(query)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void query() throws Exception {
|
||||||
|
// No Transformation
|
||||||
|
System.out.print("First Registered \t");
|
||||||
|
Iterator<Concessione> queriedDocuments=client.query(
|
||||||
|
Queries.readPath("src/test/resources/concessioni/queries/firstRegistered.json"));
|
||||||
|
// Expected one result
|
||||||
|
assertTrue(count(queriedDocuments)==1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.print("Last Registered \t");
|
||||||
|
// Expected one result
|
||||||
|
queriedDocuments=client.query(
|
||||||
|
Queries.readPath("src/test/resources/concessioni/queries/lastRegistered.json"));
|
||||||
|
assertTrue(count(queriedDocuments)==1);
|
||||||
|
|
||||||
|
queriedDocuments.forEachRemaining((Concessione c)->{System.out.println(c.getNome());});
|
||||||
|
|
||||||
|
|
||||||
|
// Transformations
|
||||||
|
System.out.println(
|
||||||
|
client.queryForJSON(
|
||||||
|
Queries.readPath("src/test/resources/concessioni/queries/lastNameRegisteredByFabio.json")));
|
||||||
|
|
||||||
|
System.out.println(
|
||||||
|
client.queryForJSON(
|
||||||
|
Queries.readPath("src/test/resources/concessioni/queries/publicationWarningMessages.json")));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// String query=Files.readFileAsString(filterFile.getAbsolutePath(), Charset.defaultCharset());
|
||||||
|
// System.out.println("Count for "+filterFile.getName()+"\t"+ count(client.search(query)));
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCleanFileSet() throws Exception {
|
||||||
|
|
||||||
|
Concessione c=publish(false);
|
||||||
|
client.unPublish(c.getMongo_id());
|
||||||
|
|
||||||
|
//Precheck to be sure
|
||||||
|
assertFalse(c.getPosizionamentoScavo().getActualContent().isEmpty());
|
||||||
|
assertFalse(c.getPianteFineScavo().get(0).getActualContent().isEmpty());
|
||||||
|
|
||||||
|
//Clear pos
|
||||||
|
c=client.cleanFileSet(c.getMongo_id(),Paths.POSIZIONAMENTO);
|
||||||
|
assertTrue(c.getPosizionamentoScavo().getActualContent().isEmpty());
|
||||||
|
|
||||||
|
//Clear pianta [0]
|
||||||
|
c=client.cleanFileSet(c.getMongo_id(),Paths.piantaByIndex(0));
|
||||||
|
assertTrue(c.getPianteFineScavo().get(0).getActualContent().isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// UTILS
|
||||||
|
|
||||||
|
public static long count(Iterator<?> iterator){
|
||||||
|
AtomicLong l=new AtomicLong(0);
|
||||||
|
iterator.forEachRemaining(el->{l.incrementAndGet();});
|
||||||
|
return l.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.application.geoportal.common.model;
|
package org.gcube.application.geoportal.clients;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
|
@ -1,26 +1,22 @@
|
||||||
package org.gcube.application.geoportal.common.model;
|
package org.gcube.application.geoportal.clients.legacy;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
|
||||||
|
import org.gcube.application.geoportal.clients.BasicVreTests;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.GeoServerContent;
|
import org.gcube.application.geoportal.common.model.legacy.GeoServerContent;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
|
import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport.ValidationStatus;
|
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport.ValidationStatus;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class ConcessioniTests {
|
public class ConcessioniTests extends BasicVreTests {
|
||||||
|
|
||||||
static boolean STOP_ON_FAIL=true;
|
static boolean STOP_ON_FAIL=true;
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setScope(){
|
|
||||||
// TokenSetter.set("/gcube/devNext/NextNext");
|
|
||||||
TokenSetter.set("/gcube/devsec/devVRE");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void readAll() throws Exception {
|
public void readAll() throws Exception {
|
||||||
|
@ -81,9 +77,5 @@ public class ConcessioniTests {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @Test
|
|
||||||
// public void readOne() throws Exception {
|
|
||||||
// ConcessioniManager manager=new ConcessioniManager();
|
|
||||||
// System.out.println(manager.getById(67+""));
|
|
||||||
// }
|
|
||||||
}
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.gcube.application.geoportal.common.model;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
public class Serializations {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void readOne(){}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void readMulti() throws IOException {
|
||||||
|
|
||||||
|
Iterator it=Serialization.readCollection(
|
||||||
|
new FileInputStream(new File("src/test/resources/concessioni/ConcessioniList.json")),
|
||||||
|
Concessione.class);
|
||||||
|
AtomicLong l=new AtomicLong(0);
|
||||||
|
it.forEachRemaining(element->{l.incrementAndGet();});
|
||||||
|
|
||||||
|
|
||||||
|
Assert.assertTrue(l.get()==4);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,130 @@
|
||||||
|
package org.gcube.application.geoportal.common.model;
|
||||||
|
|
||||||
|
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.setAbstractEng("simple abstract section");
|
||||||
|
relScavo.setAbstractIta("semplice sezione abstract");
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package org.gcube.application.geoportal.usecases;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||||
|
import org.gcube.application.geoportal.clients.TokenSetter;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||||
|
|
||||||
|
public class ClearConcessioni {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
TokenSetter.set("/gcube/devsec/devVRE");
|
||||||
|
|
||||||
|
ConcessioniManagerI manager=statefulMongoConcessioni().build();
|
||||||
|
|
||||||
|
|
||||||
|
ArrayList<String> toSkipIds=new ArrayList<>();
|
||||||
|
// toSkipIds.add("6102c8dd02ad3d05b5f81df4");
|
||||||
|
// toSkipIds.add("610415af02ad3d05b5f81ee3");
|
||||||
|
|
||||||
|
AtomicLong count=new AtomicLong(0);
|
||||||
|
AtomicLong nullCount=new AtomicLong(0);
|
||||||
|
AtomicLong errCount=new AtomicLong(0);
|
||||||
|
|
||||||
|
|
||||||
|
Iterator<Concessione> it=null;
|
||||||
|
// it=manager.getList();
|
||||||
|
it=manager.search("{\"centroidLat\" : 0}");
|
||||||
|
|
||||||
|
it.forEachRemaining((Concessione c)->{
|
||||||
|
try{
|
||||||
|
String currentId=c.getMongo_id();
|
||||||
|
if(currentId==null) {
|
||||||
|
System.out.println("ID IS NULL " + c);
|
||||||
|
nullCount.incrementAndGet();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(toSkipIds.contains(currentId))
|
||||||
|
System.out.println("Skipping "+currentId);
|
||||||
|
else {
|
||||||
|
System.out.println("Deleting " + c.getMongo_id());
|
||||||
|
manager.deleteById(c.getMongo_id(),true);
|
||||||
|
}
|
||||||
|
}catch(Throwable throwable){
|
||||||
|
System.err.println(throwable);
|
||||||
|
errCount.incrementAndGet();
|
||||||
|
}finally {
|
||||||
|
count.incrementAndGet();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
System.out.println("Done "+count.get()+" [null : "+nullCount.get()+", err : "+errCount.get()+"]");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package org.gcube.application.geoportal.usecases;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.utils.FileSets;
|
||||||
|
import org.gcube.application.geoportal.clients.TokenSetter;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.AssociatedContent;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.InputStreamDescriptor;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
|
||||||
|
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
|
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
|
||||||
|
|
||||||
|
public class EditFileSet {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
// params
|
||||||
|
String context="/gcube/devsec/devVRE";
|
||||||
|
String publishOption="true";
|
||||||
|
|
||||||
|
String toUpdateId="6131f42502ad3d2580412da7";
|
||||||
|
String toEditPath= Concessione.Paths.piantaByIndex(0);
|
||||||
|
String folderPath="/Users/fabioisti/Documents/GNA_Ferrandina_2020_inserimento/New Folder With Items/topografia/Piante";
|
||||||
|
|
||||||
|
//Check params
|
||||||
|
Boolean publish = Boolean.parseBoolean(publishOption);
|
||||||
|
File sourceFolder=new File(folderPath);
|
||||||
|
if(!sourceFolder.canRead()) throw new Exception("Cannot read from "+folderPath);
|
||||||
|
|
||||||
|
System.out.println("!!!!!!! SETTING CONTEXT "+context);
|
||||||
|
TokenSetter.set(context);
|
||||||
|
|
||||||
|
|
||||||
|
//Prepare Fileset
|
||||||
|
System.out.println("Preparing request..");
|
||||||
|
StorageUtils storage=new StorageUtils();
|
||||||
|
AddSectionToConcessioneRequest request= FileSets.prepareRequestFromFolder(storage,toEditPath,sourceFolder);
|
||||||
|
|
||||||
|
MongoConcessioni client=mongoConcessioni().build();
|
||||||
|
|
||||||
|
// Unpublish
|
||||||
|
System.out.println("Unpublishing "+toUpdateId);
|
||||||
|
client.unPublish(toUpdateId);
|
||||||
|
|
||||||
|
// update Fileset
|
||||||
|
System.out.println("Removing old fileset.. ");
|
||||||
|
client.cleanFileSet(toUpdateId,toEditPath);
|
||||||
|
|
||||||
|
System.out.println("Sending new Fileset ..");
|
||||||
|
Concessione result= client.registerFileSet(toUpdateId,request);
|
||||||
|
|
||||||
|
if(publish)
|
||||||
|
result = client.publish(toUpdateId);
|
||||||
|
|
||||||
|
System.out.println("Done ");
|
||||||
|
System.out.println("Result : "+result);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,159 @@
|
||||||
|
package org.gcube.application.geoportal.usecases;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||||
|
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||||
|
import org.gcube.application.geoportal.clients.TokenSetter;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.*;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
|
||||||
|
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 java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
/*
|
||||||
|
Pushes concessioni JSON from folder to geoportal-service
|
||||||
|
*/
|
||||||
|
public class Export {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
File dir= new File("/Users/fabioisti/git/geoportal-client/import1628178107083");
|
||||||
|
// String targetContext="/pred4s/preprod/preVRE";
|
||||||
|
String targetContext="/gcube/devsec/devVRE";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ArrayList<Concessione> found=new ArrayList<>();
|
||||||
|
for(File elementFolder:dir.listFiles())
|
||||||
|
for(File jsonFile:elementFolder.listFiles((dir1, name) -> {return name.endsWith(".json");}))
|
||||||
|
try {
|
||||||
|
log.info("Reading "+jsonFile.getAbsolutePath());
|
||||||
|
String json= Files.readFileAsString(jsonFile.getAbsolutePath(), Charset.defaultCharset());
|
||||||
|
found.add(Serialization.read(json,Concessione.class));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Loaded "+found.size()+" elements from "+dir.getAbsolutePath());
|
||||||
|
|
||||||
|
TokenSetter.set(targetContext);
|
||||||
|
ConcessioniManagerI targetManager = statefulMongoConcessioni().build();
|
||||||
|
StorageUtils storage = new StorageUtils();
|
||||||
|
|
||||||
|
AtomicLong count = new AtomicLong(0);
|
||||||
|
AtomicLong warnCount = new AtomicLong(0);
|
||||||
|
AtomicLong errCount = new AtomicLong(0);
|
||||||
|
|
||||||
|
for (Concessione c : found) {
|
||||||
|
try {
|
||||||
|
log.info("Using {} {}",c.getNome(),c.getMongo_id());
|
||||||
|
Concessione result = push(c, targetManager, new File(dir.getAbsolutePath(),
|
||||||
|
c.getId() + ""), storage);
|
||||||
|
if (!result.getReport().getStatus().equals(ValidationReport.ValidationStatus.PASSED))
|
||||||
|
warnCount.incrementAndGet();
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
System.err.println(throwable);
|
||||||
|
errCount.incrementAndGet();
|
||||||
|
} finally {
|
||||||
|
count.incrementAndGet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Done "+count.get()+" [warn : "+warnCount.get()+", err : "+errCount.get()+"]");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Concessione push(Concessione c, ConcessioniManagerI manager, File dir, StorageUtils storage) throws Exception {
|
||||||
|
// remove GIS references
|
||||||
|
LayerConcessione posizionamento= c.getPosizionamentoScavo();
|
||||||
|
c.setPosizionamentoScavo(null);
|
||||||
|
|
||||||
|
List<LayerConcessione> piante=c.getPianteFineScavo();
|
||||||
|
c.setPianteFineScavo(new ArrayList<LayerConcessione>());
|
||||||
|
|
||||||
|
List<UploadedImage> imgs=c.getImmaginiRappresentative();
|
||||||
|
c.setImmaginiRappresentative(new ArrayList<UploadedImage>());
|
||||||
|
|
||||||
|
List<OtherContent> other=c.getGenericContent();
|
||||||
|
c.setGenericContent(new ArrayList<OtherContent>());
|
||||||
|
|
||||||
|
RelazioneScavo rel=c.getRelazioneScavo();
|
||||||
|
c.setRelazioneScavo(null);
|
||||||
|
|
||||||
|
|
||||||
|
// remove source folder id
|
||||||
|
c.setFolderId(null);
|
||||||
|
c.setMongo_id(null);
|
||||||
|
|
||||||
|
// PUSH PROJECT
|
||||||
|
manager.createNew(c);
|
||||||
|
|
||||||
|
|
||||||
|
// UPLOAD WOrKSPaCE content
|
||||||
|
// Relazione
|
||||||
|
removeContent(rel);
|
||||||
|
manager.setRelazioneScavo(rel, fromPath(dir.toPath().toAbsolutePath()+File.separator+"rel",storage)[0]);
|
||||||
|
|
||||||
|
// Posizionamento
|
||||||
|
removeContent(posizionamento);
|
||||||
|
manager.setPosizionamento(posizionamento,
|
||||||
|
fromPath(dir.toPath().toAbsolutePath()+File.separator+"pos", storage));
|
||||||
|
|
||||||
|
|
||||||
|
//Piante
|
||||||
|
for(int i=0; i<piante.size();i++) {
|
||||||
|
LayerConcessione l=piante.get(i);
|
||||||
|
removeContent(l);
|
||||||
|
manager.addPiantaFineScavo(l,
|
||||||
|
fromPath(dir.toPath().toAbsolutePath()+File.separator+"pianta_"+i, storage));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Immagini Rappresentative
|
||||||
|
for(int i=0; i<imgs.size();i++) {
|
||||||
|
UploadedImage img=imgs.get(i);
|
||||||
|
removeContent(img);
|
||||||
|
manager.addImmagineRappresentativa(img,
|
||||||
|
fromPath(dir.toPath().toAbsolutePath()+File.separator+"imgs_"+i, storage)[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Other content
|
||||||
|
// for(int i=0; i<other.size();i++) {
|
||||||
|
// OtherContent otherContent=other.get(i);
|
||||||
|
// removeContent(otherContent);
|
||||||
|
// manager.a(otherContent,
|
||||||
|
// fromPath(dir.toPath().toAbsolutePath()+File.separator+"imgs_"+i));
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// publish
|
||||||
|
return manager.publish();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TempFile[] fromPath(String path, StorageUtils storage) throws FileNotFoundException {
|
||||||
|
Path baseDir= Paths.get(path);
|
||||||
|
ArrayList<TempFile> toReturn=new ArrayList<>();
|
||||||
|
for(File f : baseDir.toFile().listFiles()){
|
||||||
|
toReturn.add(storage.putOntoStorage(new FileInputStream(f),f.getName()));
|
||||||
|
}
|
||||||
|
log.info("Loaded {} files from {} ",toReturn.size(),path);
|
||||||
|
return toReturn.toArray(new TempFile[toReturn.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void removeContent(AssociatedContent c){ c.setActualContent(new ArrayList<>());}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package org.gcube.application.geoportal.usecases;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
|
||||||
|
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||||
|
import org.gcube.application.geoportal.clients.TokenSetter;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.*;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||||
|
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
/*
|
||||||
|
Imports Json concessioni into import<TIME-MILLIS>
|
||||||
|
*/
|
||||||
|
public class Import {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
|
// Path dir=Files.createTempDirectory(System.currentTimeMillis()+"");
|
||||||
|
|
||||||
|
File dir=new File("import"+System.currentTimeMillis());
|
||||||
|
dir.mkdirs();
|
||||||
|
String sourceContext="/d4science.research-infrastructures.eu/D4OS/GeoNA-Prototype";
|
||||||
|
// String sourceContext="/pred4s/preprod/preVRE";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// GET FOM SOURCE
|
||||||
|
TokenSetter.set(sourceContext);
|
||||||
|
|
||||||
|
StorageHubClient sgClient=new StorageHubClient();
|
||||||
|
|
||||||
|
|
||||||
|
// ConcessioniManagerI manager= statefulMongoConcessioni().build();
|
||||||
|
|
||||||
|
ConcessioniManager sourceManager = new ConcessioniManager();
|
||||||
|
ArrayList<Concessione> found=new ArrayList<>();
|
||||||
|
sourceManager.getList().forEach((Concessione c)->{
|
||||||
|
try {
|
||||||
|
File currentFolder=new File (dir.toString(),c.getId()+"");
|
||||||
|
currentFolder.mkdirs();
|
||||||
|
|
||||||
|
//Load locally
|
||||||
|
// POSIZIONAMENTO
|
||||||
|
loadFiles(c.getPosizionamentoScavo(),new File(currentFolder,"pos"),sgClient);
|
||||||
|
// RELAZIONE
|
||||||
|
loadFiles(c.getRelazioneScavo(),new File(currentFolder,"rel"),sgClient);
|
||||||
|
// IMGs
|
||||||
|
for(int i=0;i<c.getImmaginiRappresentative().size();i++)
|
||||||
|
loadFiles(c.getImmaginiRappresentative().get(i), new File(currentFolder,"imgs_"+i),sgClient);
|
||||||
|
|
||||||
|
// Piante
|
||||||
|
for(int i=0;i<c.getPianteFineScavo().size();i++)
|
||||||
|
loadFiles(c.getPianteFineScavo().get(i), new File(currentFolder,"pianta_"+i),sgClient);
|
||||||
|
|
||||||
|
found.add(c);
|
||||||
|
|
||||||
|
|
||||||
|
PrintWriter w=new PrintWriter(new File(currentFolder,c.getId()+".json"));
|
||||||
|
w.append(Serialization.write(c));
|
||||||
|
w.flush();
|
||||||
|
w.close();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("Unable to load {}",c.getId(),e);
|
||||||
|
} catch (StorageHubException e) {
|
||||||
|
log.error("Unable to load {}",c.getId(),e);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
System.out.println("Imported "+found.size()+" elements into "+dir.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// NB baseDIR/conc_id/pos | pianta_i | imgs_i | other_i /
|
||||||
|
|
||||||
|
private static int loadFiles(AssociatedContent c, File directory, StorageHubClient sgHub) throws IOException, StorageHubException {
|
||||||
|
int count=0;
|
||||||
|
if (c == null) {
|
||||||
|
log.warn("Content is null for path {}",directory.getAbsolutePath());
|
||||||
|
} else if (c.getActualContent() == null) {
|
||||||
|
log.warn("Content {} is empty for path {}",c.getId(),directory.getAbsolutePath());
|
||||||
|
}else {
|
||||||
|
for (PersistedContent content : c.getActualContent()) {
|
||||||
|
if (content instanceof WorkspaceContent) {
|
||||||
|
FileContainer item = sgHub.open(((WorkspaceContent) content).getStorageID()).asFile();
|
||||||
|
WorkspaceContent wc = (WorkspaceContent) content;
|
||||||
|
File dest = new File(directory, item.get().getName());
|
||||||
|
dest.getParentFile().mkdirs();
|
||||||
|
dest.createNewFile();
|
||||||
|
IOUtils.copy(item.getPublicLink().openStream(), new FileOutputStream(dest));
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("Put {} files into {} ", count, directory.getAbsolutePath());
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package org.gcube.application.geoportal.usecases;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||||
|
import org.gcube.application.geoportal.clients.TokenSetter;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||||
|
|
||||||
|
public class RepublishAll {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
TokenSetter.set("/gcube/devsec/devVRE");
|
||||||
|
|
||||||
|
ConcessioniManagerI manager=statefulMongoConcessioni().build();
|
||||||
|
|
||||||
|
|
||||||
|
ArrayList<String> toSkipIds=new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
AtomicLong count=new AtomicLong(0);
|
||||||
|
AtomicLong nullCount=new AtomicLong(0);
|
||||||
|
AtomicLong errCount=new AtomicLong(0);
|
||||||
|
manager.getList().forEachRemaining((Concessione c)->{
|
||||||
|
try{
|
||||||
|
String currentId=c.getMongo_id();
|
||||||
|
if(currentId==null) {
|
||||||
|
System.out.println("ID IS NULL " + c);
|
||||||
|
nullCount.incrementAndGet();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(toSkipIds.contains(currentId))
|
||||||
|
System.out.println("Skipping "+currentId);
|
||||||
|
else {
|
||||||
|
System.out.println("Upublishing " + c.getMongo_id());
|
||||||
|
manager.unPublish(c.getMongo_id());
|
||||||
|
|
||||||
|
System.out.println("Republishing" + c.getMongo_id());
|
||||||
|
manager.publish(c.getMongo_id());
|
||||||
|
}
|
||||||
|
}catch(Throwable throwable){
|
||||||
|
System.err.println(throwable);
|
||||||
|
errCount.incrementAndGet();
|
||||||
|
}finally {
|
||||||
|
count.incrementAndGet();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
System.out.println("Done "+count.get()+" [null : "+nullCount.get()+", err : "+errCount.get()+"]");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.gcube.application.geoportal.usecases;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||||
|
import org.gcube.application.geoportal.clients.TokenSetter;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||||
|
|
||||||
|
public class UnpublishSingle {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
TokenSetter.set("/gcube/devsec/devVRE");
|
||||||
|
|
||||||
|
ConcessioniManagerI manager=statefulMongoConcessioni().build();
|
||||||
|
|
||||||
|
manager.publish("610415af02ad3d05b5f81ee3");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
package org.gcube.application.geoportal.usecases.mocks;
|
||||||
|
|
||||||
|
import com.opencsv.CSVReader;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||||
|
import org.gcube.application.geoportal.client.utils.FileSets;
|
||||||
|
import org.gcube.application.geoportal.clients.StatelessClientTests;
|
||||||
|
import org.gcube.application.geoportal.clients.TokenSetter;
|
||||||
|
import org.gcube.application.geoportal.common.model.TestModel;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.InputStreamDescriptor;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
|
||||||
|
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
|
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.contentmanagement.blobstorage.service.IClient;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.lang.reflect.Array;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class MockFromFolder {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
//PARAMS
|
||||||
|
String context="/gcube/devsec/devVRE";
|
||||||
|
|
||||||
|
//Concessioni 04-03
|
||||||
|
//String packageBaseDir="/Users/fabioisti/Documents/Concessioni 04-03/";
|
||||||
|
//String csvDescriptor="src/test/resources/concessioni/concessioni04-03.csv";
|
||||||
|
|
||||||
|
//DATASET_GNA_01
|
||||||
|
// String packageBaseDir="/Users/fabioisti/Documents/DATASET_GNA_01";
|
||||||
|
// String csvDescriptor="src/test/resources/concessioni/DATASET_GNA_01.csv";
|
||||||
|
|
||||||
|
//DATASET_GNA_02
|
||||||
|
//String packageBaseDir="/Users/fabioisti/Documents/DATASET_GNA_02";
|
||||||
|
//String csvDescriptor="src/test/resources/concessioni/DATASET_GNA_02.csv";
|
||||||
|
|
||||||
|
|
||||||
|
// invio_08_02
|
||||||
|
// String packageBaseDir="/Users/fabioisti/Documents/invio_08_05";
|
||||||
|
// String csvDescriptor="src/test/resources/concessioni/invio_08_05.csv";
|
||||||
|
|
||||||
|
// concessioni 23_04
|
||||||
|
String packageBaseDir="/Users/fabioisti/Documents/Concessioni_23_04";
|
||||||
|
String csvDescriptor="src/test/resources/concessioni/concessioni_23_04.csv";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TokenSetter.set(context);
|
||||||
|
|
||||||
|
MongoConcessioni client=mongoConcessioni().build();
|
||||||
|
StorageUtils storage=new StorageUtils();
|
||||||
|
|
||||||
|
|
||||||
|
long publishedCount=0l;
|
||||||
|
long successcount=0l;
|
||||||
|
long entrycount=0l;
|
||||||
|
|
||||||
|
//Parse CSV descriptor
|
||||||
|
File baseDir=new File(packageBaseDir);
|
||||||
|
ArrayList<Concessione> pushed=new ArrayList<>();
|
||||||
|
|
||||||
|
CSVReader reader = new CSVReader(new FileReader(csvDescriptor));
|
||||||
|
String [] nextLine;
|
||||||
|
//reads one line at a time
|
||||||
|
while ((nextLine = reader.readNext()) != null)
|
||||||
|
{
|
||||||
|
entrycount++;
|
||||||
|
//Create new
|
||||||
|
String projectName = nextLine[0];
|
||||||
|
String positionPath = nextLine[1];
|
||||||
|
String piantePath = nextLine[2];
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
//NB raggruppa per file
|
||||||
|
Map.Entry<String,List<File>> posSets = clusterizeFiles(positionPath, baseDir).entrySet().stream().findFirst().get();
|
||||||
|
Map<String, List<File>> pianteSets = clusterizeFiles(piantePath, baseDir);
|
||||||
|
|
||||||
|
// Sometimes they are the same
|
||||||
|
if(positionPath.equals(piantePath))
|
||||||
|
pianteSets.remove(posSets.getKey());
|
||||||
|
|
||||||
|
log.debug("Entry {} pos Size {} piante {} ",projectName,posSets.getValue().size(),pianteSets.size());
|
||||||
|
|
||||||
|
Concessione c = createMock(projectName, pianteSets, posSets.getValue(), client, storage);
|
||||||
|
|
||||||
|
publishedCount++;
|
||||||
|
if (c.getReport().getStatus().equals(ValidationReport.ValidationStatus.PASSED))
|
||||||
|
successcount++;
|
||||||
|
pushed.add(c);
|
||||||
|
}catch(Throwable t){
|
||||||
|
System.err.println("Problematic entry "+projectName);
|
||||||
|
t.printStackTrace(System.err);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Done "+publishedCount+" [SUCCESS : "+successcount+"] \t OUT OF :"+entrycount+" entries");
|
||||||
|
|
||||||
|
pushed.forEach(c -> {
|
||||||
|
try{
|
||||||
|
System.out.println(c.getNome()+"\t"+c.getMongo_id()+"\t"+c.getReport().getStatus());
|
||||||
|
}catch(Throwable t){
|
||||||
|
System.out.println(c.getNome()+"\t"+c.getMongo_id()+"\t PROBLEMATIC, NO REPORT");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static Map<String,List<File>> clusterizeFiles(String basePath,File packageFolder) throws IOException {
|
||||||
|
log.debug("Clusterizing "+basePath);
|
||||||
|
|
||||||
|
HashMap<String,List<File>> toReturn = new HashMap<>();
|
||||||
|
File baseDir=new File(packageFolder,basePath);
|
||||||
|
for(File shp:baseDir.listFiles((dir,name)->{return name.endsWith(".shp");})) {
|
||||||
|
String basename=shp.getName().substring(0,shp.getName().lastIndexOf("."));
|
||||||
|
List<File> fileset=new ArrayList<>();
|
||||||
|
for (File shpSet : baseDir.listFiles((dir, name) -> {return name.startsWith(basename);}))
|
||||||
|
fileset.add(shpSet);
|
||||||
|
log.debug("SHP {} Set size {} ",basename,fileset.size());
|
||||||
|
toReturn.put(basename,fileset);
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Concessione createMock(String baseName,Map<String,List<File>> piante, List<File> pos,
|
||||||
|
MongoConcessioni client, StorageUtils storage) throws Exception {
|
||||||
|
|
||||||
|
Concessione c=TestModel.prepareConcessione(piante.size(), 2);
|
||||||
|
c.setNome("Mock for "+baseName);
|
||||||
|
c= client.createNew(c);
|
||||||
|
String mongoId=c.getMongo_id();
|
||||||
|
|
||||||
|
// TEST DATA, DO NOT CARE
|
||||||
|
client.registerFileSet(mongoId, FileSets.prepareRequest(storage,
|
||||||
|
Concessione.Paths.RELAZIONE,new File ("src/test/resources/concessioni/relazione.pdf")));
|
||||||
|
|
||||||
|
client.registerFileSet(mongoId, FileSets.prepareRequest(storage,
|
||||||
|
Concessione.Paths.imgByIndex(0),new File("src/test/resources/concessioni/immagine.png")));
|
||||||
|
|
||||||
|
// POSIZIONAMENTO
|
||||||
|
|
||||||
|
client.registerFileSet(mongoId, FileSets.prepareRequest(storage,
|
||||||
|
Concessione.Paths.POSIZIONAMENTO,pos.toArray(new File[pos.size()])));
|
||||||
|
|
||||||
|
Map.Entry<String,List<File>>[] entries= piante.entrySet().toArray(new Map.Entry[0]);
|
||||||
|
for( int i= 0; i< piante.size();i++)
|
||||||
|
client.registerFileSet(mongoId, FileSets.prepareRequest(storage,
|
||||||
|
Concessione.Paths.piantaByIndex(i),entries[i].getValue().toArray(new File[0])));
|
||||||
|
|
||||||
|
c=client.publish(mongoId);
|
||||||
|
|
||||||
|
System.out.println("@@@ Concessione "+c.getNome()+"\t STATUS : "+ c.getReport().getStatus());
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,6 @@
|
||||||
|
"GNA_Aquileia Casa Bestie Ferite_2019_rev_CdL","GNA_Aquileia Casa Bestie Ferite_2019_rev_CdL/GNA_topografia_Aquileia Casa Bestie Ferite","GNA_Aquileia Casa Bestie Ferite_2019_rev_CdL/GNA_topografia_Aquileia Casa Bestie Ferite"
|
||||||
|
"GNA_Castelseprio castrum-borgo_2019_rev_CdL","GNA_Castelseprio castrum-borgo_2019_rev_CdL/GNA_topografia_Castelseprio castrum-borgo","GNA_Castelseprio castrum-borgo_2019_rev_CdL/GNA_topografia_Castelseprio castrum-borgo"
|
||||||
|
"GNA_Monte Postale_2019_rev_CdL_FPDC","GNA_Monte Postale_2019_rev_CdL_FPDC/GNA_topografia_Monte Postale","GNA_Monte Postale_2019_rev_CdL_FPDC/GNA_topografia_Monte Postale"
|
||||||
|
"GNA_Castelseprio castrum-borgo_2019_rev_CdL","GNA_Castelseprio castrum-borgo_2019_rev_CdL/GNA_topografia_Castelseprio castrum-borgo","GNA_Castelseprio castrum-borgo_2019_rev_CdL/GNA_topografia_Castelseprio castrum-borgo"
|
||||||
|
"GNA_Aquileia Casa Bestie Ferite_2019_rev_CdL","GNA_Aquileia Casa Bestie Ferite_2019_rev_CdL/GNA_topografia_Aquileia Casa Bestie Ferite","GNA_Aquileia Casa Bestie Ferite_2019_rev_CdL/GNA_topografia_Aquileia Casa Bestie Ferite"
|
||||||
|
"GNA_Appia Antica V miglio_2019_rev_CdL","GNA_Appia Antica V miglio_2019_rev_CdL/GNA_topografia_Appia Antica V miglio","GNA_Appia Antica V miglio_2019_rev_CdL/GNA_topografia_Appia Antica V miglio"
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
"GNA_Bostel di Rotzo_Rev_FPDC","GNA_Bostel di Rotzo_Rev_FPDC/GNA_topografia_Bostel di Rotzo","GNA_Bostel di Rotzo_Rev_FPDC/GNA_topografia_Bostel di Rotzo"
|
||||||
|
"GNA_Braida Murada_Rev_FPDC","GNA_Braida Murada_Rev_FPDC/GNA_topografia_Braida Murada","GNA_Braida Murada_Rev_FPDC/GNA_topografia_Braida Murada"
|
||||||
|
"GNA_Egnazia_Rev_FPDC","GNA_Bostel di Rotzo_Rev_FPDC/GNA_topografia_Bostel di Rotzo","GNA_Bostel di Rotzo_Rev_FPDC/GNA_topografia_Bostel di Rotzo"
|
||||||
|
"GNA_Ferrandina_Rev_FPDC","GNA_Ferrandina_Rev_FPDC/GNA_topografia_Ferrandina","GNA_Ferrandina_Rev_FPDC/GNA_topografia_Ferrandina"
|
||||||
|
"GNA_Timpone della Motta_Rev_FPDC","GNA_Timpone della Motta_Rev_FPDC/GNA_topografia_Timpone della Motta","GNA_Timpone della Motta_Rev_FPDC/GNA_topografia_Timpone della Motta"
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
"Acquacadda_Nuxis_2019_def","Acquacadda_Nuxis_2019_def/D_posizionamento saggi_NUXIS 2019","Acquacadda_Nuxis_2019_def/E_piante fine scavo vettoriali_NUXIS 2019"
|
||||||
|
"Ariano nel Polisine (Ro) - Loc. San Basilio ( Unvi. di Padova)","Ariano nel Polisine (Ro) - Loc. San Basilio ( Unvi. di Padova)/GNA_SAN BASILIO_2019/GNA_topografia_San Basilio/POSIZIONAMENTO SAGGI E AREE DELLE INDAGINI","Ariano nel Polisine (Ro) - Loc. San Basilio ( Unvi. di Padova)/GNA_SAN BASILIO_2019/GNA_topografia_San Basilio/PLANIMETRIE SAGGI AREE DELLE INDAGINI"
|
||||||
|
"Ariano Polesine (Ro) - Loc. San Basilio (Uni. di Venezia)","Ariano Polesine (Ro) - Loc. San Basilio (Uni. di Venezia)/S.Basilio-UniVe_GNA/D.GNA_Posizionamento_San Basilio","Ariano Polesine (Ro) - Loc. San Basilio (Uni. di Venezia)/S.Basilio-UniVe_GNA/E-F.GNA_Pianta fine scavo_San Basilio/GNA_Pianta di fine scavo_San Basilio"
|
||||||
|
"C_F_GNA_Oscurusciuto_2020","C_F_GNA_Oscurusciuto_2020/D-E-F_GNA_topografia_Oscurusciuto/Posizionamento_limiti_saggi_indagati_Oscurusciuto_vettoriale","C_F_GNA_Oscurusciuto_2020/D-E-F_GNA_topografia_Oscurusciuto/Pianta_fine_scavo_Oscurusciuto_2019_vettoriale"
|
||||||
|
"Cerchiara-Damale_rev","Cerchiara-Damale_rev/D. Posizionamento saggio","Cerchiara-Damale_rev/D. Posizionamento saggio/E. Pianta fine scavo_vettoriale"
|
||||||
|
"Cerveteri (RM)_loc. Monte Abatone_documentazione fine scavo 2019 (paragr. IVa)","Cerveteri (RM)_loc. Monte Abatone_documentazione fine scavo 2019 (paragr. IVa)/IVa_E_Tav.1_Shape Posizionamento area scavo","Cerveteri (RM)_loc. Monte Abatone_documentazione fine scavo 2019 (paragr. IVa)/IVa_E_Tav.1_Shape Posizionamento area scavo"
|
||||||
|
"Cervia Vecchia_rev","Cervia Vecchia_rev/D_GNA_topografia_Cervia","Cervia Vecchia_rev/D_GNA_topografia_Cervia"
|
||||||
|
"Civitavecchia (RM)_loc. Ficoncella_Aquae Tauri_docum. IVa_2019","Civitavecchia (RM)_loc. Ficoncella_Aquae Tauri_docum. IVa_2019/Civitavecchia (RM)_Ficoncella_documentazione fine scavo 2019_IVa/IVa_D_E_F_topografia_Aquae_Tauri/Posizionamento saggi 2019","Civitavecchia (RM)_loc. Ficoncella_Aquae Tauri_docum. IVa_2019/Civitavecchia (RM)_Ficoncella_documentazione fine scavo 2019_IVa/IVa_D_E_F_topografia_Aquae_Tauri/Pianta di fine scavo 2019"
|
||||||
|
"Frascineto Timpone delle Fave_rev","Frascineto Timpone delle Fave_rev/D. Posizionamento dell'area","Frascineto Timpone delle Fave_rev/D. Posizionamento dell'area"
|
||||||
|
"GNA_AQUILEIAcomellimoro_2019_rev","GNA_AQUILEIAcomellimoro_2019_rev/GNA_topografia_AQUILEIAcomellimoro_2019/D.Posizionamento_AQU19COM","GNA_AQUILEIAcomellimoro_2019_rev/GNA_topografia_AQUILEIAcomellimoro_2019/E.Planimetria generale_AQU19COM"
|
||||||
|
"GNA_Poggio Pimperiale_Poggibonsi","GNA_Poggio Pimperiale_Poggibonsi/5591449/GNA_topografia_PoggioImperiale/POSIZIONAMENTO","GNA_Poggio Pimperiale_Poggibonsi/5591449/GNA_topografia_PoggioImperiale/PLANIMETRIE SAGGI/SHAPE A22"
|
||||||
|
"Jesolo (Ve) - Loc. San Mauro e Torre del Caligo","Jesolo (Ve) - Loc. San Mauro e Torre del Caligo/GNA_topografia_Jesolo/GIS_shp","Jesolo (Ve) - Loc. San Mauro e Torre del Caligo/GNA_topografia_Jesolo/GIS_shp"
|
||||||
|
"Monterotondo (RM)_loc. Tor Mancina_documentazione fine scavo 2019 (paragr. IVa)","Monterotondo (RM)_loc. Tor Mancina_documentazione fine scavo 2019 (paragr. IVa)/IVa_D_E_F_GNA_topografia_Via Nomentum-Eretum","Monterotondo (RM)_loc. Tor Mancina_documentazione fine scavo 2019 (paragr. IVa)/IVa_D_E_F_GNA_topografia_Via Nomentum-Eretum"
|
||||||
|
"Quarto d'Altino -Loc. Fornace","Quarto d'Altino -Loc. Fornace/Cupitò/GNA_Altino_posizionamento_shp","Quarto d'Altino -Loc. Fornace/Cupitò/GNA_Altino_posizionamento_shp"
|
||||||
|
"Tolfa (RM)_Bufalareccia_documentazione IVa 2019","Tolfa (RM)_Bufalareccia_documentazione IVa 2019/IVa_D_GNA_posizionamento dei limiti in formato vectoriale_Bufalareccia 2019","Tolfa (RM)_Bufalareccia_documentazione IVa 2019/IVa_E_GNA_pianta di fine scavo multipolygon_Bufalareccia 2019"
|
||||||
|
"UNIME_ LAINO_REV","UNIME_ LAINO_REV/D. Limiti saggi/laino 2019 limiti saggi","UNIME_ LAINO_REV/D. Limiti saggi/laino 2019 limiti saggi"
|
||||||
|
"UNIME_TORTORA_rev","UNIME_TORTORA_rev/tortora 2019 limiti saggi","UNIME_TORTORA_rev/tortora 2019 pianta fine scavo"
|
||||||
|
"UsiniTomestighes","UsiniTomestighes/GNA_TOMESTIGHES_2019/GNA_Topografia_Tomestighes/D_GNA_Posizionamento_limiti_aree_indagate","UsiniTomestighes/GNA_TOMESTIGHES_2019/GNA_Topografia_Tomestighes/E_GNA_Piante_fine_scavo_Tomestighes/Area A_est"
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
"Acquacadda_Nuxis_2019_def","Acquacadda_Nuxis_2019_def/D_posizionamento saggi_NUXIS 2019","Acquacadda_Nuxis_2019_def/E_piante fine scavo vettoriali_NUXIS 2019"
|
||||||
|
"Ariano nel Polisine (Ro) - Loc. San Basilio ( Unvi. di Padova)","Ariano nel Polisine (Ro) - Loc. San Basilio ( Unvi. di Padova)/GNA_SAN BASILIO_2019/GNA_topografia_San Basilio/POSIZIONAMENTO SAGGI E AREE DELLE INDAGINI","Ariano nel Polisine (Ro) - Loc. San Basilio ( Unvi. di Padova)/GNA_SAN BASILIO_2019/GNA_topografia_San Basilio/PLANIMETRIE SAGGI AREE DELLE INDAGINI"
|
||||||
|
"Ariano Polesine (Ro) - Loc. San Basilio (Uni. di Venezia)","Ariano Polesine (Ro) - Loc. San Basilio (Uni. di Venezia)/S.Basilio-UniVe_GNA/D.GNA_Posizionamento_San Basilio","Ariano Polesine (Ro) - Loc. San Basilio (Uni. di Venezia)/S.Basilio-UniVe_GNA/E-F.GNA_Pianta fine scavo_San Basilio/GNA_Pianta di fine scavo_San Basilio"
|
||||||
|
"C_F_GNA_Oscurusciuto_2020","C_F_GNA_Oscurusciuto_2020/D-E-F_GNA_topografia_Oscurusciuto/Posizionamento_limiti_saggi_indagati_Oscurusciuto_vettoriale","C_F_GNA_Oscurusciuto_2020/D-E-F_GNA_topografia_Oscurusciuto/Pianta_fine_scavo_Oscurusciuto_2019_vettoriale"
|
||||||
|
"Cerchiara-Damale_rev","Cerchiara-Damale_rev/D. Posizionamento saggio","Cerchiara-Damale_rev/D. Posizionamento saggio/E. Pianta fine scavo_vettoriale"
|
||||||
|
"Cerveteri (RM)_loc. Monte Abatone_documentazione fine scavo 2019 (paragr. IVa)","Cerveteri (RM)_loc. Monte Abatone_documentazione fine scavo 2019 (paragr. IVa)/IVa_E_Tav.1_Shape Posizionamento area scavo","Cerveteri (RM)_loc. Monte Abatone_documentazione fine scavo 2019 (paragr. IVa)/IVa_E_Tav.1_Shape Posizionamento area scavo"
|
||||||
|
"Cervia Vecchia_rev","Cervia Vecchia_rev/D_GNA_topografia_Cervia","Cervia Vecchia_rev/D_GNA_topografia_Cervia"
|
||||||
|
"Civitavecchia (RM)_loc. Ficoncella_Aquae Tauri_docum. IVa_2019","Civitavecchia (RM)_loc. Ficoncella_Aquae Tauri_docum. IVa_2019/Civitavecchia (RM)_Ficoncella_documentazione fine scavo 2019_IVa/IVa_D_E_F_topografia_Aquae_Tauri/Posizionamento saggi 2019","Civitavecchia (RM)_loc. Ficoncella_Aquae Tauri_docum. IVa_2019/Civitavecchia (RM)_Ficoncella_documentazione fine scavo 2019_IVa/IVa_D_E_F_topografia_Aquae_Tauri/Pianta di fine scavo 2019"
|
||||||
|
"Frascineto Timpone delle Fave_rev","Frascineto Timpone delle Fave_rev/D. Posizionamento dell'area","Frascineto Timpone delle Fave_rev/D. Posizionamento dell'area"
|
||||||
|
"GNA_AQUILEIAcomellimoro_2019_rev","GNA_AQUILEIAcomellimoro_2019_rev/GNA_topografia_AQUILEIAcomellimoro_2019/D.Posizionamento_AQU19COM","GNA_AQUILEIAcomellimoro_2019_rev/GNA_topografia_AQUILEIAcomellimoro_2019/E.Planimetria generale_AQU19COM"
|
||||||
|
"GNA_Poggio Pimperiale_Poggibonsi","GNA_Poggio Pimperiale_Poggibonsi/5591449/GNA_topografia_PoggioImperiale/POSIZIONAMENTO","GNA_Poggio Pimperiale_Poggibonsi/5591449/GNA_topografia_PoggioImperiale/PLANIMETRIE SAGGI/SHAPE A22"
|
||||||
|
"Jesolo (Ve) - Loc. San Mauro e Torre del Caligo","Jesolo (Ve) - Loc. San Mauro e Torre del Caligo/GNA_topografia_Jesolo/GIS_shp","Jesolo (Ve) - Loc. San Mauro e Torre del Caligo/GNA_topografia_Jesolo/GIS_shp"
|
||||||
|
"Monterotondo (RM)_loc. Tor Mancina_documentazione fine scavo 2019 (paragr. IVa)","Monterotondo (RM)_loc. Tor Mancina_documentazione fine scavo 2019 (paragr. IVa)/IVa_D_E_F_GNA_topografia_Via Nomentum-Eretum","Monterotondo (RM)_loc. Tor Mancina_documentazione fine scavo 2019 (paragr. IVa)/IVa_D_E_F_GNA_topografia_Via Nomentum-Eretum"
|
||||||
|
"Quarto d'Altino -Loc. Fornace","Quarto d'Altino -Loc. Fornace/Cupitò/GNA_Altino_posizionamento_shp","Quarto d'Altino -Loc. Fornace/Cupitò/GNA_Altino_posizionamento_shp"
|
||||||
|
"Tolfa (RM)_Bufalareccia_documentazione IVa 2019","Tolfa (RM)_Bufalareccia_documentazione IVa 2019/IVa_D_GNA_posizionamento dei limiti in formato vectoriale_Bufalareccia 2019","Tolfa (RM)_Bufalareccia_documentazione IVa 2019/IVa_E_GNA_pianta di fine scavo multipolygon_Bufalareccia 2019"
|
||||||
|
"UNIME_ LAINO_REV","UNIME_ LAINO_REV/D. Limiti saggi/laino 2019 limiti saggi","UNIME_ LAINO_REV/D. Limiti saggi/laino 2019 limiti saggi"
|
||||||
|
"UNIME_TORTORA_rev","UNIME_TORTORA_rev/tortora 2019 limiti saggi","UNIME_TORTORA_rev/tortora 2019 pianta fine scavo"
|
||||||
|
"UsiniTomestighes","UsiniTomestighes/GNA_TOMESTIGHES_2019/GNA_Topografia_Tomestighes/D_GNA_Posizionamento_limiti_aree_indagate","UsiniTomestighes/GNA_TOMESTIGHES_2019/GNA_Topografia_Tomestighes/E_GNA_Piante_fine_scavo_Tomestighes/Area A_est"
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
"GNA_Incoronata_2019_Rennes","/GNA_Incoronata_2019_Rennes/GNA_topografia_Incoronata/D","/GNA_Incoronata_2019_Rennes/GNA_topografia_Incoronata/E/SHP"
|
||||||
|
"MONTE MANNU_2019","/MONTE MANNU_2019/GNA_topografia_Monte_Mannu/D_Limiti dei saggi","/MONTE MANNU_2019/GNA_topografia_Monte_Mannu/E_Pianta di fine scavo"
|
||||||
|
"Santa Rosa Poviglio_2019","/Santa Rosa Poviglio_2019/GNA_Topografia_Poviglio/Posizionamento","/Santa Rosa Poviglio_2019/GNA_Topografia_Poviglio/Planimetrie"
|
||||||
|
"Usini Tomestighes_integrata","/Usini Tomestighes_integrata/GNA_TOMESTIGHES_2019/GNA_Topografia_Tomestighes/GNA_Tomestighes_2019/D_GNA_Posizionamento_limiti_aree_indagate","/Usini Tomestighes_integrata/GNA_TOMESTIGHES_2019/GNA_Topografia_Tomestighes/GNA_Tomestighes_2019/E_GNA_Piante_fine_scavo_Tomestighes/Area A est"
|
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"id" : {$gt : 0}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"centroidLat" : 0
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"creationUser" : {$ne : "fabio.sinibaldi"}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"report.status": {$eq : "PASSED"}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
"Farnese (VT)_Sorgenti della Nova_documentazione fine scavo 2019","Farnese (VT)_Sorgenti della Nova_documentazione fine scavo 2019/Gis Sorgenti della Nova","Farnese (VT)_Sorgenti della Nova_documentazione fine scavo 2019/Gis Sorgenti della Nova/Piante di fase"
|
||||||
|
"GNA_Aquileia_ExPasqualis_ok","GNA_Aquileia_ExPasqualis_ok/GNA_topografia_Aquileia ex Pasqualis_2019","GNA_Aquileia_ExPasqualis_ok/GNA_topografia_Aquileia ex Pasqualis_2019"
|
||||||
|
"Jesolo (Ve) - Loc. San Mauro e Torre del Caligo","Jesolo (Ve) - Loc. San Mauro e Torre del Caligo/topografia_modificata","Jesolo (Ve) - Loc. San Mauro e Torre del Caligo/topografia_modificata"
|
||||||
|
"Montalto di Castro (VT)_Vulci_Indagini non invasive_Doc. paragr._Va","Montalto di Castro (VT)_Vulci_Indagini non invasive_Doc. paragr._Va/CONSEGNA_WGS84","Montalto di Castro (VT)_Vulci_Indagini non invasive_Doc. paragr._Va/CONSEGNA_WGS84"
|
||||||
|
"Montecompatri_Tenuta_Castiglione_doc_IVa_2019","Montecompatri_Tenuta_Castiglione_doc_IVa_2019/GNA_topografia_Gabii_Louvre/POSIZIONAMENTO","Montecompatri_Tenuta_Castiglione_doc_IVa_2019/GNA_topografia_Gabii_Louvre/PIANTA FINE SCAVO"
|
||||||
|
"SAN_CASCIANO_BAGNI","SAN_CASCIANO_BAGNI/POSIZIONAMENTO_EPSG_4326","SAN_CASCIANO_BAGNI"
|
||||||
|
"Tarquinia_Civita_GNA_2019","Tarquinia_Civita_GNA_2019/Va_D__Topografia_Tarquinia/Posizionamento","Tarquinia_Civita_GNA_2019/Va_D__Topografia_Tarquinia/Posizionamento"
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
|
|
@ -0,0 +1 @@
|
||||||
|
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"paging" : {
|
||||||
|
"offset" : 0,
|
||||||
|
"limit" : 1
|
||||||
|
},
|
||||||
|
"ordering" : {
|
||||||
|
"direction" : "ASCENDING",
|
||||||
|
"fields" : ["creationTime","nome"]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"paging" : {
|
||||||
|
"offset" : 0,
|
||||||
|
"limit" : 1
|
||||||
|
},
|
||||||
|
"ordering" : {
|
||||||
|
"direction" : "DESCENDING",
|
||||||
|
"fields" : ["creationTime","nome"]
|
||||||
|
},
|
||||||
|
"filter" : {
|
||||||
|
"creationUser" : {$eq : "fabio.sinibaldi"}
|
||||||
|
},
|
||||||
|
"projection" : {
|
||||||
|
"nome" : 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"paging" : {
|
||||||
|
"offset" : 0,
|
||||||
|
"limit" : 1
|
||||||
|
},
|
||||||
|
"ordering" : {
|
||||||
|
"direction" : "DESCENDING",
|
||||||
|
"fields" : ["creationTime","nome"]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"ordering" : {
|
||||||
|
"direction" : "DESCENDING",
|
||||||
|
"fields" : ["nome"]
|
||||||
|
},
|
||||||
|
|
||||||
|
"filter" : {"report.status" : {"$eq" : "WARNING"}},
|
||||||
|
"projection" : {"report.warningMessages" : 1}
|
||||||
|
|
||||||
|
}
|
Binary file not shown.
Reference in New Issue