1.0.3 #3
|
@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
# Changelog for org.gcube.application.geoportal-client
|
||||
|
||||
## [v1.0.3] - 2020-11-11
|
||||
Stateful Concessioni Manager client over mongo
|
||||
|
||||
## [v1.0.2] - 2020-11-11
|
||||
Fixed dulicate dependency declaration
|
||||
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-client</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.3</version>
|
||||
<name>Geoportal Client</name>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
package org.gcube.application.geoportal.client;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.rest.AddSectionToConcessioneRequest;
|
||||
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 com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DefaultMongoConcessioni implements MongoConcessioni{
|
||||
|
||||
@NonNull
|
||||
private final ProxyDelegate<WebTarget> delegate;
|
||||
|
||||
private 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= new Call<WebTarget,Concessione>(){
|
||||
@Override
|
||||
public Concessione call(WebTarget endpoint) throws Exception {
|
||||
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 {
|
||||
log.debug("Deleting by id {}",id);
|
||||
delegate.make(new Call<WebTarget,String>(){
|
||||
@Override
|
||||
public String call(WebTarget endpoint) throws Exception {
|
||||
check(endpoint.path(id).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= new Call<WebTarget,Concessione>(){
|
||||
@Override
|
||||
public Concessione call(WebTarget endpoint) throws Exception {
|
||||
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 Iterable<Concessione> getList() throws Exception {
|
||||
log.debug("Getting list");
|
||||
Call<WebTarget,Iterable<Concessione>> call=new Call<WebTarget,Iterable<Concessione>>(){
|
||||
@Override
|
||||
public Iterable<Concessione> call(WebTarget endpoint) throws Exception {
|
||||
Iterable<Concessione> toReturn=new ArrayList<Concessione>();
|
||||
return (Iterable<Concessione>) 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= new Call<WebTarget,Concessione>(){
|
||||
@Override
|
||||
public Concessione call(WebTarget endpoint) throws Exception {
|
||||
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 Concessione registerFile(String id, AddSectionToConcessioneRequest request) throws Exception {
|
||||
log.info("Registering {} in {}",request,id);
|
||||
Call<WebTarget,Concessione> call= new Call<WebTarget,Concessione>(){
|
||||
@Override
|
||||
public Concessione call(WebTarget endpoint) throws Exception {
|
||||
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("Published {} ",toReturn);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione update(String id, String jsonUpdate) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione replace(Concessione replacement) throws Exception {
|
||||
log.info("Replacing {}",replacement);
|
||||
Call<WebTarget,Concessione> call= new Call<WebTarget,Concessione>(){
|
||||
@Override
|
||||
public Concessione call(WebTarget endpoint) throws Exception {
|
||||
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 Exception {
|
||||
String resString=resp.readEntity(String.class);
|
||||
if(resp.getStatus()<200||resp.getStatus()>=300)
|
||||
throw new Exception("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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package org.gcube.application.geoportal.client;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
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 {
|
||||
// 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 Iterable<Project> getAll() throws RemoteException {
|
||||
Call<WebTarget,Iterable<Project>> call=new Call<WebTarget,Iterable<Project>>(){
|
||||
@Override
|
||||
public Iterable<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 Iterable<Project> getByFilter(String filter) throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<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 Iterable<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 org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||
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.InterfaceConstants;
|
||||
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||
import org.gcube.common.clients.Plugin;
|
||||
import org.gcube.common.clients.ProxyBuilder;
|
||||
import org.gcube.common.clients.ProxyBuilderImpl;
|
||||
import org.gcube.common.clients.config.ProxyConfig;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
|
@ -15,19 +21,35 @@ import lombok.AllArgsConstructor;
|
|||
public abstract class GeoportalAbstractPlugin <S, P> implements Plugin<S, P>{
|
||||
|
||||
|
||||
|
||||
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() {
|
||||
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
|
||||
public String name() {
|
||||
return this.name;
|
||||
return InterfaceConstants.APPLICATION_BASE_PATH+InterfaceConstants.APPLICATION_PATH;
|
||||
}
|
||||
|
||||
@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;
|
||||
|
||||
@Slf4j
|
||||
public class ConcessioniManager {
|
||||
public class ConcessioniManager{
|
||||
|
||||
private static ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
|
@ -47,11 +47,19 @@ public class ConcessioniManager {
|
|||
}
|
||||
|
||||
private ConcessioniI service;
|
||||
|
||||
private static enum ImplementationType{
|
||||
|
||||
}
|
||||
|
||||
public ConcessioniManager() {
|
||||
service=concessioni().build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Concessione getById(String id) throws Exception {
|
||||
log.info("Reading by ID "+id);
|
||||
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 f)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 ConcessioniPlugin() {
|
||||
super(InterfaceConstants.APPLICATION_BASE_PATH+InterfaceConstants.APPLICATION_PATH);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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,157 @@
|
|||
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.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.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.registerFile(currentC.getMongo_id(),
|
||||
request(Paths.imgByIndex(currentC.getImmaginiRappresentative().size()-1),f));
|
||||
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.registerFile(currentC.getMongo_id(),
|
||||
request(Paths.piantaByIndex(currentC.getPianteFineScavo().size()-1),files));
|
||||
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.registerFile(currentC.getMongo_id(),
|
||||
request(Paths.POSIZIONAMENTO,files));
|
||||
return currentC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione setRelazioneScavo(RelazioneScavo toSet, TempFile f) throws Exception {
|
||||
if(currentC==null) throw new Exception("Invalid operation : current Concessione is null.");
|
||||
currentC.setRelazioneScavo(toSet);
|
||||
currentC=replace(currentC);
|
||||
|
||||
|
||||
currentC=super.registerFile(currentC.getMongo_id(),
|
||||
request(Paths.RELAZIONE,f));
|
||||
return currentC;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Concessione addImmagineRappresentativa(UploadedImage toAdd, InputStreamDescriptor f) throws Exception {
|
||||
return addImmagineRappresentativa(toAdd,asTemp(f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione addPiantaFineScavo(LayerConcessione toAdd, InputStreamDescriptor... files) throws Exception {
|
||||
return addPiantaFineScavo(toAdd, asTemp(files));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione setPosizionamento(LayerConcessione toSet, InputStreamDescriptor... files) throws Exception {
|
||||
return setPosizionamento(toSet,asTemp(files));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione setRelazioneScavo(RelazioneScavo toSet, InputStreamDescriptor f) throws Exception {
|
||||
return setRelazioneScavo(toSet,asTemp(f));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected static AddSectionToConcessioneRequest request(String path,TempFile...files) {
|
||||
AddSectionToConcessioneRequest req=new AddSectionToConcessioneRequest();
|
||||
req.setDestinationPath(path);
|
||||
req.setStreams(new ArrayList<TempFile>());
|
||||
for(TempFile f:files)
|
||||
req.getStreams().add(f);
|
||||
return req;
|
||||
}
|
||||
|
||||
protected TempFile asTemp(InputStreamDescriptor descriptor) throws RemoteBackendException, FileNotFoundException {
|
||||
return storage.putOntoStorage(descriptor.getStream(), descriptor.getFilename());
|
||||
}
|
||||
|
||||
protected TempFile[] asTemp(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()]);
|
||||
}
|
||||
}
|
|
@ -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,27 @@
|
|||
package org.gcube.application.geoportal.client.utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package org.gcube.application.geoportal.common.model;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
public class BasicVreTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void setScope(){
|
||||
// TokenSetter.set("/gcube/devNext/NextNext");
|
||||
TokenSetter.set("/gcube/devsec/devVRE");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -12,15 +12,11 @@ import org.gcube.application.geoportal.common.model.legacy.report.ValidationRepo
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ConcessioniTests {
|
||||
public class ConcessioniTests extends BasicVreTests{
|
||||
|
||||
static boolean STOP_ON_FAIL=true;
|
||||
|
||||
@Before
|
||||
public void setScope(){
|
||||
// TokenSetter.set("/gcube/devNext/NextNext");
|
||||
TokenSetter.set("/gcube/devsec/devVRE");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void readAll() throws Exception {
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
package org.gcube.application.geoportal.common.model;
|
||||
|
||||
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||
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.Before;
|
||||
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();
|
||||
|
||||
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.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());
|
||||
}
|
||||
|
||||
@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,112 @@
|
|||
package org.gcube.application.geoportal.common.model;
|
||||
|
||||
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
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.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().forEach((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.registerFile(c.getMongo_id(), request);
|
||||
|
||||
assertNotNull(c.getRelazioneScavo().getActualContent());
|
||||
assertNotNull(c.getRelazioneScavo().getActualContent().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void publish() 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.registerFile(mongoId, request);
|
||||
|
||||
request=
|
||||
new AddSectionToConcessioneRequest(Paths.imgByIndex(0),
|
||||
Collections.singletonList(new StorageUtils().putOntoStorage(
|
||||
new FileInputStream(Files.getFileFromResources("concessioni/immagine.png")), "immagine.png")));
|
||||
|
||||
client.registerFile(mongoId, request);
|
||||
|
||||
|
||||
request=
|
||||
new AddSectionToConcessioneRequest(Paths.POSIZIONAMENTO,
|
||||
Collections.singletonList(new StorageUtils().putOntoStorage(
|
||||
new FileInputStream(Files.getFileFromResources("concessioni/pos.shp")), "pos.shp")));
|
||||
|
||||
client.registerFile(mongoId, request);
|
||||
|
||||
request=
|
||||
new AddSectionToConcessioneRequest(Paths.piantaByIndex(0),
|
||||
Collections.singletonList(new StorageUtils().putOntoStorage(
|
||||
new FileInputStream(Files.getFileFromResources("concessioni/pianta.shp")), "pianta.shp")));
|
||||
|
||||
client.registerFile(mongoId, request);
|
||||
|
||||
|
||||
c=client.publish(mongoId);
|
||||
|
||||
assertTrue(c.getReport().getStatus().equals(ValidationStatus.PASSED));
|
||||
}
|
||||
}
|
|
@ -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.setAbstractEng("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;
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
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.
Binary file not shown.
Reference in New Issue