Merged repositories
parent
2a1c5adb16
commit
a7de8e61c3
@ -0,0 +1,6 @@
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
# Changelog for org.gcube.spatial.data.gcube-sdi-suite
|
||||
|
||||
## [v1.0.0-SNAPSHOT] - 2021-2-11
|
||||
First release
|
@ -0,0 +1,26 @@
|
||||
# Acknowledgments
|
||||
|
||||
The projects leading to this software have received funding from a series of European Union programmes including:
|
||||
|
||||
- the Sixth Framework Programme for Research and Technological Development
|
||||
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
|
||||
- the Seventh Framework Programme for research, technological development and demonstration
|
||||
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
|
||||
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
|
||||
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
|
||||
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
|
||||
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
|
||||
- the H2020 research and innovation programme
|
||||
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
|
||||
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
|
||||
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
|
||||
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
|
||||
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
|
||||
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
|
||||
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
|
||||
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
|
||||
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
|
||||
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
|
||||
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
|
||||
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
|
||||
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);
|
@ -1,2 +1,52 @@
|
||||
# gcube-cms-suite
|
||||
gCube CMS Suite
|
||||
--------------------------------------------------
|
||||
|
||||
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
|
||||
|
||||
## Built with
|
||||
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
|
||||
* [OpenJDK](https://openjdk.java.net/) - The JDK used
|
||||
* [JAX-RS](https://github.com/eclipse-ee4j/jaxrs-api) - Java™ API for RESTful Web Services
|
||||
* [Jersey](https://jersey.github.io/) - JAX-RS runtime
|
||||
* [Maven](https://maven.apache.org/) - Dependency Management
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
|
||||
|
||||
## Change log
|
||||
|
||||
See [CHANGELOG.md](CHANGELOG.md).
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
|
||||
|
||||
## About the gCube Framework
|
||||
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
|
||||
open-source software toolkit used for building and operating Hybrid Data
|
||||
Infrastructures enabling the dynamic deployment of Virtual Research Environments
|
||||
by favouring the realisation of reuse oriented policies.
|
||||
|
||||
The projects leading to this software have received funding from a series of European Union programmes including:
|
||||
|
||||
- the Sixth Framework Programme for Research and Technological Development
|
||||
- DILIGENT (grant no. 004260).
|
||||
- the Seventh Framework Programme for research, technological development and demonstration
|
||||
- D4Science (grant no. 212488);
|
||||
- D4Science-II (grant no.239019);
|
||||
- ENVRI (grant no. 283465);
|
||||
- iMarine(grant no. 283644);
|
||||
- EUBrazilOpenBio (grant no. 288754).
|
||||
- the H2020 research and innovation programme
|
||||
- SoBigData (grant no. 654024);
|
||||
- PARTHENOS (grant no. 654119);
|
||||
- EGIEngage (grant no. 654142);
|
||||
- ENVRIplus (grant no. 654182);
|
||||
- BlueBRIDGE (grant no. 675680);
|
||||
- PerformFish (grant no. 727610);
|
||||
- AGINFRAplus (grant no. 731001);
|
||||
- DESIRA (grant no. 818194);
|
||||
- ARIADNEplus (grant no. 823914);
|
||||
- RISIS2 (grant no. 824091);
|
||||
|
||||
|
@ -0,0 +1,27 @@
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
# Changelog for org.gcube.application.geoportal-client
|
||||
|
||||
## [v1.0.5-SNAPSHOT] - 2021-09-20
|
||||
Refactored repositories
|
||||
|
||||
## [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
|
||||
Excluded common-calls 1.2.0
|
||||
|
||||
|
||||
## [v1.0.0] - 2020-11-11
|
||||
|
||||
First release
|
@ -0,0 +1,26 @@
|
||||
# Acknowledgments
|
||||
|
||||
The projects leading to this software have received funding from a series of European Union programmes including:
|
||||
|
||||
- the Sixth Framework Programme for Research and Technological Development
|
||||
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
|
||||
- the Seventh Framework Programme for research, technological development and demonstration
|
||||
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
|
||||
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
|
||||
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
|
||||
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
|
||||
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
|
||||
- the H2020 research and innovation programme
|
||||
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
|
||||
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
|
||||
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
|
||||
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
|
||||
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
|
||||
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
|
||||
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
|
||||
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
|
||||
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
|
||||
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
|
||||
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
|
||||
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
|
||||
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);
|
@ -0,0 +1,50 @@
|
||||
GeoPortal - Client
|
||||
--------------------------------------------------
|
||||
|
||||
GeoPortal - Client is the java library wrapping Geoportal REST Service
|
||||
|
||||
## Built with
|
||||
* [Maven](https://maven.apache.org/) - Dependency Management
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal).
|
||||
|
||||
## Change log
|
||||
|
||||
See [CHANGELOG.md](CHANGELOG.md).
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
|
||||
|
||||
## About the gCube Framework
|
||||
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
|
||||
open-source software toolkit used for building and operating Hybrid Data
|
||||
Infrastructures enabling the dynamic deployment of Virtual Research Environments
|
||||
by favouring the realisation of reuse oriented policies.
|
||||
|
||||
The projects leading to this software have received funding from a series of European Union programmes including:
|
||||
|
||||
- the Sixth Framework Programme for Research and Technological Development
|
||||
- DILIGENT (grant no. 004260).
|
||||
- the Seventh Framework Programme for research, technological development and demonstration
|
||||
- D4Science (grant no. 212488);
|
||||
- D4Science-II (grant no.239019);
|
||||
- ENVRI (grant no. 283465);
|
||||
- iMarine(grant no. 283644);
|
||||
- EUBrazilOpenBio (grant no. 288754).
|
||||
- the H2020 research and innovation programme
|
||||
- SoBigData (grant no. 654024);
|
||||
- PARTHENOS (grant no. 654119);
|
||||
- EGIEngage (grant no. 654142);
|
||||
- ENVRIplus (grant no. 654182);
|
||||
- BlueBRIDGE (grant no. 675680);
|
||||
- PerformFish (grant no. 727610);
|
||||
- AGINFRAplus (grant no. 731001);
|
||||
- DESIRA (grant no. 818194);
|
||||
- ARIADNEplus (grant no. 823914);
|
||||
- RISIS2 (grant no. 824091);
|
||||
|
||||
|
||||
|
@ -0,0 +1,139 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-client</artifactId>
|
||||
<version>1.0.5-SNAPSHOT</version>
|
||||
<name>Geoportal Client</name>
|
||||
|
||||
|
||||
<parent>
|
||||
<groupId>org.gcube.application.cms</groupId>
|
||||
<artifactId>gcube-cms-suite</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<properties>
|
||||
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
|
||||
<sis.version>1.0</sis.version>
|
||||
|
||||
</properties>
|
||||
|
||||
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:${gitBaseUrl}/${project.artifactId}.git</connection>
|
||||
<developerConnection>scm:git:${gitBaseUrl}/${project.artifactId}.git</developerConnection>
|
||||
<url>${gitBaseUrl}/${project.artifactId}.git</url>
|
||||
</scm>
|
||||
|
||||
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-bom</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</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>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.14.8</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-common</artifactId>
|
||||
<version>[1.0.0,2.0.0)</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-fw-clients</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-generic-clients</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>common-jaxrs-client</artifactId>
|
||||
<version>[1.0.0,2.0.0)</version>
|
||||
</dependency>
|
||||
|
||||
<!-- TEST -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>4.11</version>
|
||||
</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 -->
|
||||
<!-- jackson java time -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>2.8.8</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<scope>test</scope>
|
||||
</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>
|
||||
|
||||
</project>
|
@ -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;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package org.gcube.application.geoportal.client;
|
||||
|
||||
public class GeoPortalClient {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
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;
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
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 InterfaceConstants.APPLICATION_BASE_PATH+InterfaceConstants.APPLICATION_PATH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String namespace() {
|
||||
return InterfaceConstants.NAMESPACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serviceClass() {
|
||||
return InterfaceConstants.SERVICE_CLASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serviceName() {
|
||||
return InterfaceConstants.SERVICE_NAME;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package org.gcube.application.geoportal.client.legacy;
|
||||
|
||||
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.concessioni;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
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.model.legacy.report.PublicationReport;
|
||||
import org.gcube.application.geoportal.common.rest.ConcessioniI;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.MappingIterator;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectReader;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class ConcessioniManager{
|
||||
|
||||
private static ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
private static ObjectReader concessioniReader=null;
|
||||
private static ObjectReader collectionReader=null;
|
||||
|
||||
static {
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
|
||||
mapper.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false);
|
||||
mapper.setSerializationInclusion(Include.NON_NULL);
|
||||
// mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
|
||||
mapper.registerModule(new JavaTimeModule());
|
||||
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
|
||||
|
||||
concessioniReader=mapper.readerFor(Concessione.class);
|
||||
collectionReader=mapper.readerFor(Collection.class);
|
||||
}
|
||||
|
||||
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 {
|
||||
String result=service.readById(id);
|
||||
log.debug("Reading json object : "+result);
|
||||
return concessioniReader.readValue(result);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public static String toJson(Object obj) throws JsonProcessingException {
|
||||
return mapper.writeValueAsString(obj);
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<Concessione> getList() throws Exception{
|
||||
log.info("Getting list");
|
||||
try {
|
||||
String result=service.getAll();
|
||||
log.debug("Reading json object : "+result);
|
||||
|
||||
|
||||
Collection<String> coll=collectionReader.readValue(result);
|
||||
// JsonArray array=Json.createReader(new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8))).readArray();
|
||||
ArrayList<Concessione> toReturn=new ArrayList<Concessione>();
|
||||
|
||||
// MappingIterator<Concessione> it=concessioniReader.readValues(result);
|
||||
// while(it.hasNext())
|
||||
// toReturn.add(it.next());
|
||||
|
||||
for(String s: coll) {
|
||||
toReturn.add(concessioniReader.readValue(s));
|
||||
}
|
||||
|
||||
|
||||
// for(int i=0;i<array.size();i++)
|
||||
// for()
|
||||
// toReturn.add(concessioniReader.readValue(array.get(i).toString()));
|
||||
return toReturn;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// Register session
|
||||
private Concessione lastRegistered;
|
||||
|
||||
public Concessione registerNew(Concessione c) throws Exception {
|
||||
try {
|
||||
String response=service.create(mapper.writeValueAsString(c));
|
||||
lastRegistered=concessioniReader.readValue(response);
|
||||
return lastRegistered;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
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.ConcessioniI;
|
||||
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 ConcessioniPlugin extends GeoportalAbstractPlugin<WebTarget, ConcessioniI>{
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Exception convert(Exception fault, ProxyConfig<?, ?> config) {
|
||||
return fault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConcessioniI newProxy(ProxyDelegate<WebTarget> delegate) {
|
||||
return new DefaultConcessioni(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.CONCESSIONI)).
|
||||
andPath(InterfaceConstants.Methods.CONCESSIONI);
|
||||
return TargetFactory.stubFor(service).at(addressString);
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package org.gcube.application.geoportal.client.legacy;
|
||||
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.gcube.application.geoportal.common.rest.ConcessioniI;
|
||||
import org.gcube.common.clients.Call;
|
||||
import org.gcube.common.clients.delegates.ProxyDelegate;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class DefaultConcessioni implements ConcessioniI{
|
||||
|
||||
@NonNull
|
||||
private final ProxyDelegate<WebTarget> delegate;
|
||||
|
||||
@Override
|
||||
public String create(final String toCreate) throws Exception {
|
||||
Call<WebTarget,String> call= new Call<WebTarget,String>(){
|
||||
@Override
|
||||
public String call(WebTarget endpoint) throws Exception {
|
||||
return endpoint.request(MediaType.APPLICATION_JSON).put(Entity.entity(toCreate, MediaType.APPLICATION_JSON)).readEntity(String.class);
|
||||
}
|
||||
};
|
||||
return delegate.make(call);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String readById(final String readById) throws Exception {
|
||||
Call<WebTarget,String> call= new Call<WebTarget,String>(){
|
||||
@Override
|
||||
public String call(WebTarget endpoint) throws Exception {
|
||||
return endpoint.path(readById).request(MediaType.APPLICATION_JSON).get().readEntity(String.class);
|
||||
}
|
||||
};
|
||||
return delegate.make(call);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAll() throws Exception {
|
||||
Call<WebTarget,String> call= new Call<WebTarget,String>(){
|
||||
@Override
|
||||
public String call(WebTarget endpoint) throws Exception {
|
||||
return endpoint.request(MediaType.APPLICATION_JSON).get().readEntity(String.class);
|
||||
}
|
||||
};
|
||||
return delegate.make(call);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String update(final String id, final String updated) throws Exception {
|
||||
// Call<WebTarget,String> call= new Call<WebTarget,String>(){
|
||||
// @Override
|
||||
// public String call(WebTarget endpoint) throws Exception {
|
||||
// return endpoint.path(id).request(MediaType.APPLICATION_JSON).put(Entity.entity(updated, MediaType.APPLICATION_JSON)).readEntity(String.class);
|
||||
// }
|
||||
// };
|
||||
// return delegate.make(call);
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public String addSection(String arg0, String arg1) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
@ -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,36 @@
|
||||
package org.gcube.application.geoportal.client.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CommunicationException extends Exception {
|
||||
|
||||
private String remoteMessage;
|
||||
private Integer responseHTTPCode;
|
||||
|
||||
public CommunicationException() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public CommunicationException(String message) {
|
||||
super(message);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public CommunicationException(Throwable cause) {
|
||||
super(cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public CommunicationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public CommunicationException(String message, Throwable cause, boolean enableSuppression,
|
||||
boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package org.gcube.application.geoportal.clients;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
|
||||
public class TokenSetter {
|
||||
|
||||
|
||||
|
||||
private static Properties props=new Properties();
|
||||
|
||||
static{
|
||||
try {
|
||||
props.load(TokenSetter.class.getResourceAsStream("/tokens.properties"));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("YOU NEED TO SET TOKEN FILE IN CONFIGURATION");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void set(String scope){
|
||||
try{
|
||||
if(!props.containsKey(scope)) throw new RuntimeException("No token found for scope : "+scope);
|
||||
SecurityTokenProvider.instance.set(props.getProperty(scope));
|
||||
}catch(Exception e){
|
||||
e.printStackTrace(System.err);
|
||||
throw e;
|
||||
}
|
||||
ScopeProvider.instance.set(scope);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package org.gcube.application.geoportal.clients.legacy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
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.GeoServerContent;
|
||||
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.report.ValidationReport.ValidationStatus;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ConcessioniTests extends BasicVreTests {
|
||||
|
||||
static boolean STOP_ON_FAIL=true;
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void readAll() throws Exception {
|
||||
ConcessioniManager manager=new ConcessioniManager();
|
||||
ArrayList<Concessione> found=manager.getList();
|
||||
System.out.println("Found "+found.size()+" elements.");
|
||||
final AtomicLong byId=new AtomicLong(0);
|
||||
|
||||
final ArrayList<Long> validIDs=new ArrayList<>();
|
||||
|
||||
final ArrayList<Long> imgs=new ArrayList<Long>();
|
||||
final AtomicLong error=new AtomicLong(0);
|
||||
|
||||
final ArrayList<Long> piante=new ArrayList<Long>();
|
||||
final ArrayList<Long> pos=new ArrayList<Long>();
|
||||
final ArrayList<Long> wmsLink=new ArrayList<Long>();
|
||||
|
||||
found.forEach((Concessione c )->{
|
||||
try {
|
||||
manager.getById(c.getId()+"");
|
||||
byId.incrementAndGet();
|
||||
if(c.validate().getStatus().equals(ValidationStatus.PASSED))
|
||||
validIDs.add(c.getId());
|
||||
if(c.getImmaginiRappresentative()!=null&&c.getImmaginiRappresentative().size()>0)
|
||||
imgs.add(c.getId());
|
||||
if(c.getPianteFineScavo()!=null)
|
||||
c.getPianteFineScavo().forEach((LayerConcessione l)->{
|
||||
if(l.getActualContent()!=null)
|
||||
l.getActualContent().forEach((PersistedContent p)->{
|
||||
if(p instanceof GeoServerContent) piante.add(c.getId());
|
||||
});
|
||||
if(l.getWmsLink()!=null) wmsLink.add(c.getId());
|
||||
});
|
||||
|
||||
if(c.getPosizionamentoScavo()!=null) {
|
||||
LayerConcessione l=c.getPosizionamentoScavo();
|
||||
l.getActualContent().forEach((PersistedContent p)->{
|
||||
if(p instanceof GeoServerContent) pos.add(c.getId());
|
||||
});
|
||||
if(l.getWmsLink()!=null) wmsLink.add(c.getId());
|
||||
}
|
||||
}catch(Throwable t) {
|
||||
error.incrementAndGet();
|
||||
if(STOP_ON_FAIL) {
|
||||
throw new RuntimeException(t);
|
||||
}else t.printStackTrace(System.err);
|
||||
}
|
||||
});
|
||||
System.out.println("Valid count "+validIDs.size()+ "Load BY ID : "+byId.get()+" Error : "+error.get()+" OUT OF "+found.size());
|
||||
System.out.println("Valid IDS "+validIDs);
|
||||
System.out.println("With imgs : "+imgs);
|
||||
System.out.println("With piante : "+piante);
|
||||
System.out.println("With pos : "+pos);
|
||||
System.out.println("With wmsLink : "+wmsLink);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -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.
@ -0,0 +1,41 @@
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
# Changelog for org.gcube.application.geoportal-common
|
||||
|
||||
# [v1.0.7-SNAPSHOT] - 2021-09-20
|
||||
Refactored repositories
|
||||
|
||||
# [v1.0.6-SNAPSHOT] - 2021-08-3
|
||||
Forced Deletion
|
||||
Search & query
|
||||
Clean Fileset
|
||||
Interfaces return iterator instead of iterable
|
||||
Name in WorkspaceContent (https://support.d4science.org/issues/22032)
|
||||
Section AbstractRelazione (https://support.d4science.org/issues/22031)
|
||||
|
||||
# [v1.0.5] - 2020-12-9
|
||||
Mongo Id in record
|
||||
Mongo Concessioni interface
|
||||
Added Files.fixFileNAme
|
||||
ValidationReport as field
|
||||
Updated Model (#20357)
|
||||
|
||||
|
||||
# [v1.0.4-SNAPSHOT] - 2020-12-9
|
||||
Projects Rest Interface
|
||||
TempFile support
|
||||
|
||||
# [v1.0.3] - 2020-12-4
|
||||
Project model update
|
||||
|
||||
|
||||
# [v1.0.2-SNAPSHOT] - 2020-12-4
|
||||
Model update
|
||||
|
||||
## [v1.0.1] - 2020-11-11
|
||||
|
||||
Model update
|
||||
|
||||
## [v1.0.0] - 2020-11-11
|
||||
|
||||
First release
|
@ -0,0 +1,26 @@
|
||||
# Acknowledgments
|
||||
|
||||
The projects leading to this software have received funding from a series of European Union programmes including:
|
||||
|
||||
- the Sixth Framework Programme for Research and Technological Development
|
||||
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
|
||||
- the Seventh Framework Programme for research, technological development and demonstration
|
||||
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
|
||||
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
|
||||
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
|
||||
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
|
||||
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
|
||||
- the H2020 research and innovation programme
|
||||
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
|
||||
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
|
||||
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
|
||||
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
|
||||
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
|
||||
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
|
||||
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
|
||||
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
|
||||
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
|
||||
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
|
||||
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
|
||||
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
|
||||
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);
|
@ -0,0 +1,50 @@
|
||||
GeoPortal - Common
|
||||
--------------------------------------------------
|
||||
|
||||
GeoPortal - Common is the java library containing basic classes (e.g. models) of gCube GeoPortal.
|
||||
|
||||
## Built with
|
||||
* [Maven](https://maven.apache.org/) - Dependency Management
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal).
|
||||
|
||||
## Change log
|
||||
|
||||
See [CHANGELOG.md](CHANGELOG.md).
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
|
||||
|
||||
## About the gCube Framework
|
||||
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
|
||||
open-source software toolkit used for building and operating Hybrid Data
|
||||
Infrastructures enabling the dynamic deployment of Virtual Research Environments
|
||||
by favouring the realisation of reuse oriented policies.
|
||||
|
||||
The projects leading to this software have received funding from a series of European Union programmes including:
|
||||
|
||||
- the Sixth Framework Programme for Research and Technological Development
|
||||
- DILIGENT (grant no. 004260).
|
||||
- the Seventh Framework Programme for research, technological development and demonstration
|
||||
- D4Science (grant no. 212488);
|
||||
- D4Science-II (grant no.239019);
|
||||
- ENVRI (grant no. 283465);
|
||||
- iMarine(grant no. 283644);
|
||||
- EUBrazilOpenBio (grant no. 288754).
|
||||
- the H2020 research and innovation programme
|
||||
- SoBigData (grant no. 654024);
|
||||
- PARTHENOS (grant no. 654119);
|
||||
- EGIEngage (grant no. 654142);
|
||||
- ENVRIplus (grant no. 654182);
|
||||
- BlueBRIDGE (grant no. 675680);
|
||||
- PerformFish (grant no. 727610);
|
||||
- AGINFRAplus (grant no. 731001);
|
||||
- DESIRA (grant no. 818194);
|
||||
- ARIADNEplus (grant no. 823914);
|
||||
- RISIS2 (grant no. 824091);
|
||||
|
||||
|
||||
|
@ -0,0 +1,103 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-common</artifactId>
|
||||
<version>1.0.7-SNAPSHOT</version>
|
||||
<name>Geoportal Common</name>
|
||||
|
||||
|
||||
<parent>
|
||||
<groupId>org.gcube.application.cms</groupId>
|
||||
<artifactId>gcube-cms-suite</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
|
||||
<sis.version>1.0</sis.version>
|
||||
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-bom</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:${gitBaseUrl}/${project.artifactId}.git</connection>
|
||||
<developerConnection>scm:git:${gitBaseUrl}/${project.artifactId}.git</developerConnection>
|
||||
<url>${gitBaseUrl}/${project.artifactId}.git</url>
|
||||
</scm>
|
||||
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.14.8</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- TEST -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- read JSON -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-json-jackson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- jackson java time -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>2.8.8</version>
|
||||
</dependency>
|
||||
|
||||
<!-- STORAGE -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-core</artifactId>
|
||||
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-wrapper</artifactId>
|
||||
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,37 @@
|
||||
package org.gcube.application.geoportal.common.faults;
|
||||
|
||||
public class JsonParseException extends Exception{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JsonParseException() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public JsonParseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public JsonParseException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public JsonParseException(String message) {
|
||||
super(message);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public JsonParseException(Throwable cause) {
|
||||
super(cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package org.gcube.application.geoportal.common.model;
|
||||
|
||||
public class BasicJSONObject {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper=true)
|
||||
public class AbstractRelazione extends AssociatedContent{
|
||||
|
||||
private String abstractIta;
|
||||
private String abstractEng;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
public enum AccessPolicy {
|
||||
|
||||
OPEN,RESTRICTED,EMBARGOED;
|
||||
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElements;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
|
||||
import org.gcube.application.geoportal.common.utils.CollectionsUtils;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
public abstract class AssociatedContent {
|
||||
|
||||
private String mongo_id;
|
||||
private long id;
|
||||
|
||||
private AccessPolicy policy;
|
||||
private String licenseID;
|
||||
private String titolo;
|
||||
private LocalDateTime creationTime;
|
||||
|
||||
|
||||
public ValidationReport validateForInsertion() {
|
||||
ValidationReport toReturn=new ValidationReport("Associated Content");
|
||||
toReturn.checkMandatory(policy, "Politica di accesso");
|
||||
toReturn.checkMandatory(licenseID, "Licenza");
|
||||
toReturn.checkMandatory(titolo,"Titolo");
|
||||
toReturn.checkMandatory(creationTime, "Creation time");
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@XmlElements({
|
||||
@XmlElement(type=GeoServerContent.class),
|
||||
@XmlElement(type=WorkspaceContent.class),
|
||||
})
|
||||
|
||||
private List<PersistedContent> actualContent=new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
// result = prime * result + ((actualContent == null) ? 0 : actualContent.hashCode());
|
||||
result = prime * result + CollectionsUtils.hashCode(actualContent);
|
||||
|
||||
result = prime * result + ((creationTime == null) ? 0 : creationTime.hashCode());
|
||||
result = prime * result + (int) (id ^ (id >>> 32));
|
||||
result = prime * result + ((licenseID == null) ? 0 : licenseID.hashCode());
|
||||
result = prime * result + ((policy == null) ? 0 : policy.hashCode());
|
||||
result = prime * result + ((titolo == null) ? 0 : titolo.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
AssociatedContent other = (AssociatedContent) obj;
|
||||
// if (actualContent == null) {
|
||||
// if (other.actualContent != null)
|
||||
// return false;
|
||||
// } else if (!actualContent.equals(other.actualContent))
|
||||
// return false;
|
||||
if(!CollectionsUtils.equalsCollections(actualContent, other.actualContent)) return false;
|
||||
|
||||
if (creationTime == null) {
|
||||
if (other.creationTime != null)
|
||||
return false;
|
||||
} else if (!creationTime.equals(other.creationTime))
|
||||
return false;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (licenseID == null) {
|
||||
if (other.licenseID != null)
|
||||
return false;
|
||||
} else if (!licenseID.equals(other.licenseID))
|
||||
return false;
|
||||
if (policy != other.policy)
|
||||
return false;
|
||||
if (titolo == null) {
|
||||
if (other.titolo != null)
|
||||
return false;
|
||||
} else if (!titolo.equals(other.titolo))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("AssociatedContent [id=");
|
||||
builder.append(id);
|
||||
builder.append(", policy=");
|
||||
builder.append(policy);
|
||||
builder.append(", licenseID=");
|
||||
builder.append(licenseID);
|
||||
builder.append(", titolo=");
|
||||
builder.append(titolo);
|
||||
builder.append(", creationTime=");
|
||||
builder.append(creationTime);
|
||||
|
||||
builder.append(", actualContent=");
|
||||
builder.append(actualContent);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
public class BBOX implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -159414992596542946L;
|
||||
|
||||
public static BBOX WORLD_EXTENT=new BBOX(90d,180d,-90d,-180d);
|
||||
|
||||
@NonNull
|
||||
private Double maxLat;
|
||||
@NonNull
|
||||
private Double maxLong;
|
||||
@NonNull
|
||||
private Double minLat;
|
||||
@NonNull
|
||||
private Double minLong;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper=true)
|
||||
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
public class GeoServerContent extends PersistedContent{
|
||||
|
||||
//GeoServer Details
|
||||
private String geoserverHostName;
|
||||
private String geoserverPath;
|
||||
|
||||
private List<String> fileNames=new ArrayList<String>();
|
||||
|
||||
|
||||
private String workspace;
|
||||
private String store;
|
||||
private String featureType;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
public class InputStreamDescriptor{
|
||||
|
||||
@NonNull
|
||||
private InputStream stream;
|
||||
@NonNull
|
||||
private String filename;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
|
||||
import org.gcube.application.geoportal.common.utils.CollectionsUtils;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
public class LayerConcessione extends SDILayerDescriptor{
|
||||
|
||||
|
||||
//meta
|
||||
private String layerUUID;
|
||||
private Long layerID;
|
||||
|
||||
//layer
|
||||
private String layerName;
|
||||
private String wmsLink;
|
||||
private String workspace;
|
||||
|
||||
|
||||
//1.Identificazione
|
||||
private String abstractSection;
|
||||
|
||||
//2.Classificazione
|
||||
private String topicCategory;
|
||||
|
||||
//3.Keyword
|
||||
private String subTopic;
|
||||
|
||||
//4. Delimitazione geographica
|
||||
private BBOX bbox;
|
||||
|
||||
//5. Temporal
|
||||
|
||||
private List<String> paroleChiaveLibere;
|
||||
|
||||
private List<String> paroleChiaveICCD;
|
||||
|
||||
//6. Quality
|
||||
private String valutazioneQualita;
|
||||
|
||||
private String metodoRaccoltaDati;
|
||||
|
||||
private String scalaAcquisizione;
|
||||
|
||||
//8. Responsabili
|
||||
private List<String> authors;
|
||||
|
||||
private String responsabile;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ValidationReport validateForInsertion() {
|
||||
ValidationReport toReturn=super.validateForInsertion();
|
||||
toReturn.setObjectName("Layer Concessione");
|
||||
toReturn.checkMandatory(abstractSection, "Abstract");
|
||||
toReturn.checkMandatory(subTopic, "Categoria (Topic)");
|
||||
//TODO
|
||||
// toReturn.checkMandatory(bbox, "Bounding Box");
|
||||
|
||||
toReturn.checkMandatory(valutazioneQualita, "Valutazione della qualita");
|
||||
toReturn.checkMandatory(metodoRaccoltaDati, "Metodo raccolta dati");
|
||||
toReturn.checkMandatory(scalaAcquisizione, "Scala acquisizione");
|
||||
toReturn.checkMandatory(authors, "Autori");
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((abstractSection == null) ? 0 : abstractSection.hashCode());
|
||||
// result = prime * result + ((authors == null) ? 0 : authors.hashCode());
|
||||
result = prime * result + CollectionsUtils.hashCode(authors);
|
||||
|
||||
|
||||
result = prime * result + ((bbox == null) ? 0 : bbox.hashCode());
|
||||
result = prime * result + ((metodoRaccoltaDati == null) ? 0 : metodoRaccoltaDati.hashCode());
|
||||
result = prime * result + ((scalaAcquisizione == null) ? 0 : scalaAcquisizione.hashCode());
|
||||
result = prime * result + ((subTopic == null) ? 0 : subTopic.hashCode());
|
||||
result = prime * result + ((topicCategory == null) ? 0 : topicCategory.hashCode());
|
||||
result = prime * result + ((valutazioneQualita == null) ? 0 : valutazioneQualita.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
LayerConcessione other = (LayerConcessione) obj;
|
||||
if (abstractSection == null) {
|
||||
if (other.abstractSection != null)
|
||||
return false;
|
||||
} else if (!abstractSection.equals(other.abstractSection))
|
||||
return false;
|
||||
// if (authors == null) {
|
||||
// if (other.authors != null)
|
||||
// return false;
|
||||
// } else if (!authors.equals(other.authors))
|
||||
// return false;
|
||||
if(!CollectionsUtils.equalsCollections(authors, other.authors)) return false;
|
||||
|
||||
|
||||
if (bbox == null) {
|
||||
if (other.bbox != null)
|
||||
return false;
|
||||
} else if (!bbox.equals(other.bbox))
|
||||
return false;
|
||||
if (metodoRaccoltaDati == null) {
|
||||
if (other.metodoRaccoltaDati != null)
|
||||
return false;
|
||||
} else if (!metodoRaccoltaDati.equals(other.metodoRaccoltaDati))
|
||||
return false;
|
||||
if (scalaAcquisizione == null) {
|
||||
if (other.scalaAcquisizione != null)
|
||||
return false;
|
||||
} else if (!scalaAcquisizione.equals(other.scalaAcquisizione))
|
||||
return false;
|
||||
if (subTopic == null) {
|
||||
if (other.subTopic != null)
|
||||
return false;
|
||||
} else if (!subTopic.equals(other.subTopic))
|
||||
return false;
|
||||
if (topicCategory == null) {
|
||||
if (other.topicCategory != null)
|
||||
return false;
|
||||
} else if (!topicCategory.equals(other.topicCategory))
|
||||
return false;
|
||||
if (valutazioneQualita == null) {
|
||||
if (other.valutazioneQualita != null)
|
||||
return false;
|
||||
} else if (!valutazioneQualita.equals(other.valutazioneQualita))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper=true)
|
||||
|
||||
public class OtherContent extends AssociatedContent {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
|
||||
@JsonSubTypes({
|
||||
@Type(value = GeoServerContent.class),
|
||||
@Type(value = WorkspaceContent.class),
|
||||
})
|
||||
public abstract class PersistedContent {
|
||||
|
||||
//Generic Info
|
||||
private long id;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("PersistedContent [id=");
|
||||
builder.append(id);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.report.ConstraintCheck;
|
||||
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
|
||||
public abstract class Record {
|
||||
|
||||
private String mongo_id;
|
||||
|
||||
//Generic Info
|
||||
private long id;
|
||||
|
||||
private RecordType recordType;
|
||||
private String version;
|
||||
private String licenzaID;
|
||||
|
||||
private AccessPolicy policy;
|
||||
//Nome del progetto
|
||||
private String nome;
|
||||
|
||||
|
||||
//Storage Info
|
||||
private String folderId;
|
||||
|
||||
//Accounting
|
||||
private LocalDateTime lastUpdateTime;
|
||||
private String lastUpdateUser;
|
||||
private LocalDateTime creationTime;
|
||||
private String creationUser;
|
||||
|
||||
|
||||
|
||||
private ValidationReport report;
|
||||
|
||||
public ValidationReport validate() {
|
||||
|
||||
setDefaults();
|
||||
ValidationReport validator=new ValidationReport("Core metadata");
|
||||
validator.checkMandatory(getRecordType(), "Record Type");
|
||||
|
||||
validator.checkMandatory(getNome(), "Nome");
|
||||
setReport(validator);
|
||||
|
||||
return getReport();
|
||||
}
|
||||
|
||||
public void setDefaults() {
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
|
||||
setVersion(ConstraintCheck.defaultFor(getVersion(),"1.0.0").evaluate());
|
||||
setPolicy(ConstraintCheck.defaultFor(getPolicy(), AccessPolicy.OPEN).evaluate());
|
||||
|
||||
setLastUpdateTime(ConstraintCheck.defaultFor(getLastUpdateTime(),now).evaluate());
|
||||
setCreationTime(ConstraintCheck.defaultFor(getCreationTime(),now).evaluate());
|
||||
setLicenzaID(ConstraintCheck.defaultFor(getLicenzaID(),"CC-BY").evaluate());
|
||||
}
|
||||
|
||||
|
||||
public abstract AssociatedContent getContentByPath(String path);
|
||||
public abstract void setAtPath(AssociatedContent toSet,String path);
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
public enum RecordType {
|
||||
|
||||
CONCESSIONE,MOSI,MOPR
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
|
||||
import org.gcube.application.geoportal.common.utils.CollectionsUtils;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper=true)
|
||||
public class RelazioneScavo extends AssociatedContent {
|
||||
|
||||
|
||||
|
||||
|
||||
private List<String> responsabili;
|
||||
private List<String> soggetto;
|
||||
|
||||
|
||||
@Override
|
||||
public ValidationReport validateForInsertion() {
|
||||
|
||||
ValidationReport toReturn=super.validateForInsertion();
|
||||
toReturn.setObjectName("Relazione Scavo");
|
||||
toReturn.checkMandatory(responsabili, "Responsabili");
|
||||
toReturn.checkMandatory(soggetto, "Soggetto");
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + CollectionsUtils.hashCode(responsabili);
|
||||
result = prime * result + CollectionsUtils.hashCode(soggetto);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
RelazioneScavo other = (RelazioneScavo) obj;
|
||||
|
||||
if(!CollectionsUtils.equalsCollections(responsabili, other.responsabili)) return false;
|
||||
|
||||
if(!CollectionsUtils.equalsCollections(soggetto, other.soggetto)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public abstract class SDILayerDescriptor extends AssociatedContent{
|
||||
|
||||
|
||||
public abstract Long getLayerID();
|
||||
public abstract void setLayerID(Long layerID);
|
||||
public abstract String getLayerUUID();
|
||||
public abstract void setLayerUUID(String layerUUID);
|
||||
public abstract String getLayerName();
|
||||
public abstract void setLayerName(String layerName);
|
||||
public abstract String getWmsLink();
|
||||
public abstract void setWmsLink(String wmsLink);
|
||||
|
||||
public abstract void setWorkspace(String workspace);
|
||||
public abstract String getWorkspace();
|
||||
public abstract BBOX getBbox();
|
||||
public abstract void setBbox(BBOX toSet);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportal.common.utils.CollectionsUtils;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper=true)
|
||||
|
||||
public class UploadedImage extends AssociatedContent {
|
||||
|
||||
|
||||
private String didascalia;
|
||||
private String format;
|
||||
|
||||
private List<String> responsabili;
|
||||
private List<String> soggetto;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((didascalia == null) ? 0 : didascalia.hashCode());
|
||||
result = prime * result + ((format == null) ? 0 : format.hashCode());
|
||||
// result = prime * result + ((responsabili == null) ? 0 : responsabili.hashCode());
|
||||
result = prime * result + CollectionsUtils.hashCode(responsabili);
|
||||
// result = prime * result + ((soggetto == null) ? 0 : soggetto.hashCode());
|
||||
result = prime * result + CollectionsUtils.hashCode(soggetto);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
UploadedImage other = (UploadedImage) obj;
|
||||
if (didascalia == null) {
|
||||
if (other.didascalia != null)
|
||||
return false;
|
||||
} else if (!didascalia.equals(other.didascalia))
|
||||
return false;
|
||||
if (format == null) {
|
||||
if (other.format != null)
|
||||
return false;
|
||||
} else if (!format.equals(other.format))
|
||||
return false;
|
||||
// if (responsabili == null) {
|
||||
// if (other.responsabili != null)
|
||||
// return false;
|
||||
// } else if (!responsabili.equals(other.responsabili))
|
||||
// return false;
|
||||
if(!CollectionsUtils.equalsCollections(responsabili, other.responsabili)) return false;
|
||||
|
||||
// if (soggetto == null) {
|
||||
// if (other.soggetto != null)
|
||||
// return false;
|
||||
// } else if (!soggetto.equals(other.soggetto))
|
||||
// return false;
|
||||
if(!CollectionsUtils.equalsCollections(soggetto, other.soggetto)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper=true)
|
||||
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
public class WorkspaceContent extends PersistedContent{
|
||||
|
||||
private String mimetype;
|
||||
private String storageID;
|
||||
private String link;
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy.report;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface Check{
|
||||
|
||||
public static Check collectionSizeMax(final int upperBound) {
|
||||
return new Check() {
|
||||
int size=0;
|
||||
@Override
|
||||
public boolean isOk(Object toCheck) {
|
||||
int size=((Collection)toCheck).size();
|
||||
return size<=upperBound;
|
||||
}
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "Numero elementi : "+size+" [max : "+upperBound+"]";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Check collectionSizeMin(final int lowerBound) {
|
||||
return new Check() {
|
||||
int size=0;
|
||||
@Override
|
||||
public boolean isOk(Object toCheck) {
|
||||
int size=((Collection)toCheck).size();
|
||||
return size>=lowerBound;
|
||||
}
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "Numero elementi : "+size+" [min : "+lowerBound+"]";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Check collectionSize(final int lowerBound, final int upperBound) {
|
||||
return new Check() {
|
||||
int size=0;
|
||||
|
||||
@Override
|
||||
public boolean isOk(Object toCheck) {
|
||||
size=((Collection)toCheck).size();
|
||||
return size<=upperBound&&size>=lowerBound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "Numero elementi : "+size+" [min : "+lowerBound+" max : "+upperBound+"]";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public boolean isOk(Object toCheck);
|
||||
public String getMessage();
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy.report;
|
||||
|
||||
public class Checks {
|
||||
|
||||
// public static final Check
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy.report;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ConstraintCheck<T> {
|
||||
|
||||
public static <T> ConstraintCheck<T> defaultFor(T toCheck,T defaultValue){
|
||||
return new ConstraintCheck<T>(toCheck).withDefault(defaultValue);
|
||||
}
|
||||
|
||||
|
||||
private T theObject;
|
||||
private String fieldLabel;
|
||||
private String message;
|
||||
private boolean error=false;
|
||||
private boolean mandatory;
|
||||
private T theDefault;
|
||||
|
||||
private List<Check> additionalChecks=new ArrayList<Check>();
|
||||
|
||||
public ConstraintCheck(T theObject,Check...checks){
|
||||
this.theObject=theObject;
|
||||
for(Check c:checks)
|
||||
additionalChecks.add(c);
|
||||
check();
|
||||
|
||||
}
|
||||
public ConstraintCheck<T> withDefault(T theDefault){
|
||||
this.theDefault=theDefault;
|
||||
return this;
|
||||
}
|
||||
public ConstraintCheck<T> addChecks(Check...checks){
|
||||
for(Check c:checks)
|
||||
additionalChecks.add(c);
|
||||
return this;
|
||||
}
|
||||
public ConstraintCheck(T theObject,String fieldLabel,Check...checks){
|
||||
this.theObject=theObject;
|
||||
this.fieldLabel=fieldLabel;
|
||||
for(Check c:checks)
|
||||
additionalChecks.add(c);
|
||||
check();
|
||||
}
|
||||
|
||||
public T evaluate() {
|
||||
check();
|
||||
T result=theObject;
|
||||
if(isError()) {
|
||||
result=theDefault;
|
||||
if(theDefault!=null && theDefault instanceof Collection) {
|
||||
Collection defaultCollection=(Collection) theDefault;
|
||||
ArrayList target=new ArrayList(defaultCollection);
|
||||
result=(T) target;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private void check() {
|
||||
if(theObject==null) {
|
||||
this.setMessage(fieldLabel+" è un campo obbligatorio.");
|
||||
this.setError(true);
|
||||
}else
|
||||
if((theObject instanceof String) && ((String) theObject).isEmpty()) {
|
||||
this.setMessage(fieldLabel+" non può essere vuoto.");
|
||||
this.setError(true);
|
||||
}else
|
||||
if((theObject instanceof Collection)) {
|
||||
Collection toCheckCollection=(Collection) theObject;
|
||||
if(toCheckCollection.isEmpty()) {
|
||||
this.setMessage("La lista "+fieldLabel+" non può essere vuota.");
|
||||
this.setError(true);
|
||||
}
|
||||
|
||||
|
||||
Boolean containsError=false;
|
||||
Object[] array=toCheckCollection.toArray(new Object[toCheckCollection.size()]);
|
||||
for(int i=0;i<array.length;i++) {
|
||||
containsError=new ConstraintCheck(array[i],fieldLabel+" [elemento N° "+i+"]").isError();
|
||||
}
|
||||
|
||||
this.setError(containsError);
|
||||
|
||||
}else {
|
||||
|
||||
for(Check check:additionalChecks) {
|
||||
if(!check.isOk(theObject)) {
|
||||
this.setError(true);
|
||||
this.setMessage(check.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy.report;
|
||||
|
||||
public class DeletionReport {
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy.report;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.Record;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class PublicationReport extends ValidationReport implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1422004928222440165L;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private Record theRecord;
|
||||
|
||||
public PublicationReport(String objectName) {
|
||||
super(objectName);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package org.gcube.application.geoportal.common.model.legacy.report;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ValidationReport implements Serializable{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3629142756787381094L;
|
||||
|
||||
|
||||
public static enum ValidationStatus{
|
||||
PASSED, ERROR, WARNING
|
||||
}
|
||||
|
||||
|
||||
private String objectName;
|
||||
|
||||
|
||||
private List<String> errorMessages=new ArrayList<String>();
|
||||
private List<String> warningMessages=new ArrayList<String>();
|
||||
private List<ValidationReport> children=new ArrayList<ValidationReport>();
|
||||
|
||||
|
||||
public ValidationStatus getStatus() {
|
||||
if(!errorMessages.isEmpty()) return ValidationStatus.ERROR;
|
||||
|
||||
boolean isWarning=(!warningMessages.isEmpty());
|
||||
for(ValidationReport obj : children) {
|
||||
ValidationStatus status=obj.getStatus();
|
||||
if(status.equals(ValidationStatus.ERROR)) return ValidationStatus.ERROR;
|
||||
if(status.equals(ValidationStatus.WARNING)) isWarning=true;
|
||||
}
|
||||
if(isWarning) return ValidationStatus.WARNING;
|
||||
return ValidationStatus.PASSED;
|
||||
}
|
||||
|
||||
public void addChild(ValidationReport obj) {
|
||||
children.add(obj);
|
||||
}
|
||||
|
||||
public void addMessage(ValidationStatus status,String message) {
|
||||
switch (status) {
|
||||
case ERROR:
|
||||
errorMessages.add(message);
|
||||
break;
|
||||
case WARNING :
|
||||
warningMessages.add(message);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public <T> boolean checkMandatory(T toCheck,String name,Check...checks) {
|
||||
ConstraintCheck<T> check=new ConstraintCheck<T>(toCheck,name,checks);
|
||||
if(check.isError())
|
||||
this.addMessage(ValidationStatus.ERROR, check.getMessage());
|
||||
return !check.isError();
|
||||
}
|
||||
|
||||
|
||||
public ValidationReport(String objectName) {
|
||||
super();
|
||||
this.objectName = objectName;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
public class DefaultCompiler {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class Field {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
public class FieldMapping {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
public class IndexDefinition {
|
||||
|
||||
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue