Merge pull request 'suite_1.0.4' (#9) from suite_1.0.4 into master

Reviewed-on: #9
This commit is contained in:
Fabio Sinibaldi 2023-01-13 17:42:23 +01:00
commit 7bc7caa0de
74 changed files with 491 additions and 1206 deletions

View File

@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.spatial.data.gcube-sdi-suite
## [v1.0.4] - 2023-01-10
- Updated plugin framework
## [v1.0.3] - 2022-12-07
- Updated plugin framework
- Introduced module default-lc-managers

View File

@ -1,11 +1,13 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.ckan-plugin
This library contains gcube-cms plugins for ckan materializations
## [v1.0.2] - 2023-01-10
- Pom updates
## [v1.0.1] - 2022-12-07
- Pom updates
## [v1.0.0] - 2022-02-24
- First release
- This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,7 +1,7 @@
gCube CMS Suite
gCube CMS Suite : CKAN Plugins
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
This library is expected to contains gcube-cms plugins for ckan materializations.
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
@ -11,15 +11,12 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
## 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

View File

@ -5,14 +5,14 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>ckan-plugins</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<name>gCube CMS - CKAN Plugins</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<properties>

View File

@ -1,7 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms-plugin-framework
## [v1.0.3] - 2023-01-10
- UserUtils in framework
## [v1.0.2] 2022-01-17
- Fixes #2435
- Introduced module default-lc-managers
@ -10,4 +11,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Serialization Features
## [v1.0.0] 2021-09-20
- First release
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,8 +1,11 @@
CMS - Plugin Framework
--------------------------------------------------
CMS Plugin Framework is a library containing the definition of Java interfaces that plugins should implement
This module contains the definition of interfaces that server plugins are expected to implement.
Basic and abstract implementations are provided in different module default-lc-manager.
Basic providers (e.g. WSProvider, ISProvider) used both in test and by the service are implemented here for simplicity.
## Built with
* [gCube SDI] (https://gcube.wiki.gcube-system.org/gcube/) - The gCube SDI
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
@ -12,8 +15,8 @@ CMS Plugin Framework is a library containing the definition of Java interfaces t
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal).
## Change log

View File

@ -4,12 +4,12 @@
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>
<artifactId>cms-plugin-framework</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
@ -67,6 +67,12 @@
<dependencies>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-utils</artifactId>
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>geoportal-common</artifactId>

View File

@ -2,6 +2,7 @@ package org.gcube.application.cms.caches;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.implementations.utils.UserUtils;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.utils.ContextUtils;
@ -18,7 +19,10 @@ public abstract class AbstractScopedMap<T> extends TimedMap<String,T> implements
@Override
public T getObject() throws ConfigurationException {
return get(ContextUtils.getCurrentScope());
UserUtils.AuthenticatedUser user = UserUtils.getCurrent();
String context = user.getContext();
log.debug(" {} : Accessing object under context {} ",name,context);
return get(context);
}

View File

@ -1,4 +1,4 @@
package org.gcube.application.geoportal.service.utils;
package org.gcube.application.cms.implementations.utils;
import lombok.AllArgsConstructor;
import lombok.Getter;

View File

@ -1,7 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.cms-test-commons
## [v1.0.4] - 2023-01-10
- Pom updates
## [v1.0.3] - 2022-12-07
- Pom updates
@ -12,4 +13,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Introduced profiled documents
## [v1.0.0] - 2021-09-11
- First release
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,14 +1,19 @@
gCube CMS - test-commons
--------------------------------------------------
Common logic used by test cases
Common utilities for testing such as :
- access to test-resources Maps
- Test Credentials management
- Basic plugin Test Case implementations
## Built with
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal).
## Change log

View File

@ -5,14 +5,14 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>cms-test-commons</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<name>CMS Test Commons</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

View File

@ -10,7 +10,7 @@ import java.nio.charset.Charset;
import java.util.HashMap;
public class TestDocuments {
public static File BASE_FOLDER =new File("test-data/profiledDocuments");
public static File BASE_FOLDER =new File("../test-data/profiledDocuments");
public static final HashMap<String, Project> documentMap =new HashMap<>();
static{

View File

@ -16,6 +16,19 @@ import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Properties;
/**
* This class is used in order to set gCube Credentials for tests that needs a gCube Infrastructure.
*
* The method TokenSetter.set(String context) is used in order to specify the context to test.
*
* The library expects a Properties file /tokens.properties in the classpath like the following example :
*
* /root/vo/vre1 = GCUBE-TOKEN
* ...
* /devRoot/vo = JWT-TOKEN
* ...
*
*/
@Slf4j
public class TokenSetter {

View File

@ -1,8 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.concessioni-lifecycle
This library contains custom extensions for the support of GNA "concessioni" use case
## [v1.0.3] - 2023-01-10
- Pom updates
- Fixes default access
## [v1.0.2] - 2022-12-07
- Pom updates
@ -13,3 +13,5 @@ This library contains custom extensions for the support of GNA "concessioni" use
## [v1.0.0] - 2021-12-15
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,8 +1,14 @@
gCube CMS Suite
gCube CMS Suite : Concessioni Lifecycle
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
This library contains custom extensions for the support of GNA "concessioni" use case custom requirements.
It contains a Lifecycle Manager built on top of default 3-PHASE, extending :
- Default values setting / evaluation
- Indexing parameters :
- Relationship management : relationship chains on "follows" and "precedes" are evaluated in order to show only last published project in centroids map
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
* [OpenJDK](https://openjdk.java.net/) - The JDK used
@ -11,8 +17,8 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log

View File

@ -4,14 +4,14 @@
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>
<artifactId>concessioni-lifecycle</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
<name>GNA Concessioni Lifecycle</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<properties>

View File

@ -82,12 +82,6 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
log.debug("Concessione {}, managing relazione {}",document.getId(),rel);
rel.putIfAbsent(ProfiledConcessione.Sections.TITOLO,doc.getString(ProfiledConcessione.NOME)+" relazione di scavo");
rel.putIfAbsent(ProfiledConcessione.SOGGETTO,doc.get(ProfiledConcessione.SOGGETTO));
rel.putIfAbsent(RegisteredFileSet.CREATION_INFO,c.getInfo().getCreationInfo());
rel.putIfAbsent(RegisteredFileSet.ACCESS,c.getInfo().getAccess());
Access relAccess=Serialization.convert(rel.get(RegisteredFileSet.ACCESS),Access.class);
relAccess.setLicense(ConstraintCheck.defaultFor(relAccess.getLicense(),"CC-BY-4.0").evaluate());
relAccess.setPolicy(ConstraintCheck.defaultFor(relAccess.getPolicy(), AccessPolicy.OPEN).evaluate());
rel.put(RegisteredFileSet.ACCESS,relAccess);
doc.put(ProfiledConcessione.RELAZIONE_SCAVO,rel);
@ -96,12 +90,6 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
Serialization.convert(doc.get(ProfiledConcessione.ABSTRACT_RELAZIONE), Document.class):new Document();
log.debug("Concessione {}, managing abstract relazione {}",document.getId(),abs);
abs.putIfAbsent(ProfiledConcessione.Sections.TITOLO,doc.getString(ProfiledConcessione.NOME)+" abstract relazione di scavo");
abs.putIfAbsent(RegisteredFileSet.CREATION_INFO,c.getInfo().getCreationInfo());
abs.putIfAbsent(RegisteredFileSet.ACCESS,c.getInfo().getAccess());
Access absAccess=Serialization.convert(abs.get(RegisteredFileSet.ACCESS),Access.class);
absAccess.setLicense(ConstraintCheck.defaultFor(absAccess.getLicense(),"CC-BY-4.0").evaluate());
absAccess.setPolicy(ConstraintCheck.defaultFor(absAccess.getPolicy(), AccessPolicy.OPEN).evaluate());
abs.put(RegisteredFileSet.ACCESS,absAccess);
doc.put(ProfiledConcessione.ABSTRACT_RELAZIONE,abs);
@ -120,13 +108,6 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
// BBOX in registered filesets
pos.put(ProfiledConcessione.RESPONSABILE,doc.get(ProfiledConcessione.RESPONSABILE));
pos.putIfAbsent(RegisteredFileSet.CREATION_INFO,c.getInfo().getCreationInfo());
pos.putIfAbsent(RegisteredFileSet.ACCESS,c.getInfo().getAccess());
Access posAccess=Serialization.convert(rel.get(RegisteredFileSet.ACCESS),Access.class);
posAccess.setLicense(ConstraintCheck.defaultFor(posAccess.getLicense(),"CC-BY-4.0").evaluate());
posAccess.setPolicy(ConstraintCheck.defaultFor(posAccess.getPolicy(), AccessPolicy.OPEN).evaluate());
pos.put(RegisteredFileSet.ACCESS,posAccess);
doc.put(ProfiledConcessione.POSIZIONAMENTO_SCAVO,pos);
}
@ -139,12 +120,7 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
for (int i = 0; i <imgs.size() ; i++) {
Document imgDoc=Serialization.asDocument(imgs.get(i));
imgDoc.putIfAbsent(ProfiledConcessione.SOGGETTO,doc.get(ProfiledConcessione.SOGGETTO));
imgDoc.putIfAbsent(RegisteredFileSet.CREATION_INFO,c.getInfo().getCreationInfo());
imgDoc.putIfAbsent(RegisteredFileSet.ACCESS,c.getInfo().getAccess());
Access imgAccess=Serialization.convert(imgDoc.get(RegisteredFileSet.ACCESS),Access.class);
imgAccess.setLicense(ConstraintCheck.defaultFor(imgAccess.getLicense(),"CC-BY-4.0").evaluate());
imgAccess.setPolicy(ConstraintCheck.defaultFor(imgAccess.getPolicy(), AccessPolicy.OPEN).evaluate());
imgDoc.put(RegisteredFileSet.ACCESS,imgAccess);
wrapper.setElement("$."+ProfiledConcessione.IMMAGINI_RAPPRESENTATIVE+"["+i+"]",imgDoc);
}
}
@ -168,12 +144,6 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements
piantaDoc.put(ProfiledConcessione.RESPONSABILE,doc.get(ProfiledConcessione.RESPONSABILE));
piantaDoc.putIfAbsent(RegisteredFileSet.CREATION_INFO,c.getInfo().getCreationInfo());
piantaDoc.putIfAbsent(RegisteredFileSet.ACCESS,c.getInfo().getAccess());
Access posAccess=Serialization.convert(rel.get(RegisteredFileSet.ACCESS),Access.class);
posAccess.setLicense(ConstraintCheck.defaultFor(posAccess.getLicense(),"CC-BY-4.0").evaluate());
posAccess.setPolicy(ConstraintCheck.defaultFor(posAccess.getPolicy(), AccessPolicy.OPEN).evaluate());
piantaDoc.put(RegisteredFileSet.ACCESS,posAccess);
wrapper.setElement("$."+ProfiledConcessione.PIANTE_FINE_SCAVO+"["+i+"]",piantaDoc);
}
}

View File

@ -53,13 +53,13 @@ public class ConcessioniPluginTests extends BasicPluginTest {
Document rel = Serialization.convert(c.getTheDocument().get(ProfiledConcessione.RELAZIONE_SCAVO), Document.class);
assertNotNull(rel.get(ProfiledConcessione.Sections.TITOLO));
assertNotNull(rel.get(ProfiledConcessione.SOGGETTO));
assertNotNull(rel.get(RegisteredFileSet.CREATION_INFO));
assertNotNull(rel.get(RegisteredFileSet.ACCESS));
assertNull(rel.get(RegisteredFileSet.CREATION_INFO));
assertNull(rel.get(RegisteredFileSet.ACCESS));
Document abs = Serialization.convert(c.getTheDocument().get(ProfiledConcessione.ABSTRACT_RELAZIONE), Document.class);
assertNotNull(abs.get(ProfiledConcessione.Sections.TITOLO));
assertNotNull(abs.get(RegisteredFileSet.CREATION_INFO));
assertNotNull(abs.get(RegisteredFileSet.ACCESS));
assertNull(abs.get(RegisteredFileSet.CREATION_INFO));
assertNull(abs.get(RegisteredFileSet.ACCESS));
Document pos = Serialization.convert(c.getTheDocument().get(ProfiledConcessione.POSIZIONAMENTO_SCAVO), Document.class);
@ -67,8 +67,8 @@ public class ConcessioniPluginTests extends BasicPluginTest {
assertNotNull(pos.get(ProfiledConcessione.Sections.ABSTRACT));
assertNotNull(pos.get(ProfiledConcessione.Layers.TOPIC));
assertNotNull(pos.get(ProfiledConcessione.Layers.SUB_TOPIC));
assertNotNull(pos.get(RegisteredFileSet.CREATION_INFO));
assertNotNull(pos.get(RegisteredFileSet.ACCESS));
assertNull(pos.get(RegisteredFileSet.CREATION_INFO));
assertNull(pos.get(RegisteredFileSet.ACCESS));
JSONPathWrapper wrapper = new JSONPathWrapper(c.getTheDocument().toJson());
@ -77,8 +77,8 @@ public class ConcessioniPluginTests extends BasicPluginTest {
try{
Document img = Serialization.asDocument(o);
assertNotNull(img.get(ProfiledConcessione.SOGGETTO));
assertNotNull(img.get(RegisteredFileSet.CREATION_INFO));
assertNotNull(img.get(RegisteredFileSet.ACCESS));
assertNull(img.get(RegisteredFileSet.CREATION_INFO));
assertNull(img.get(RegisteredFileSet.ACCESS));
}catch (Throwable t){
System.out.println("Unable to read IMG "+o);
t.printStackTrace();
@ -94,8 +94,8 @@ public class ConcessioniPluginTests extends BasicPluginTest {
assertNotNull(pianta.get(ProfiledConcessione.Sections.ABSTRACT));
assertNotNull(pianta.get(ProfiledConcessione.Layers.TOPIC));
assertNotNull(pianta.get(ProfiledConcessione.Layers.SUB_TOPIC));
assertNotNull(pianta.get(RegisteredFileSet.CREATION_INFO));
assertNotNull(pianta.get(RegisteredFileSet.ACCESS));
assertNull(pianta.get(RegisteredFileSet.CREATION_INFO));
assertNull(pianta.get(RegisteredFileSet.ACCESS));
}catch (Throwable t){
System.out.println("Unable to read pianta "+o);
t.printStackTrace();

View File

@ -1,8 +1,7 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.concessioni-model
This library contains custom BEANS for the support of GNA "concessioni" use case
## [v1.0.3] - 2023-01-10
- Pom updates
## [v1.0.2] - 2022-12-07
- Pom updates
@ -13,3 +12,5 @@ This library contains custom BEANS for the support of GNA "concessioni" use case
## [v1.0.0] - 2021-12-15
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,7 +1,9 @@
gCube CMS Suite
gCube CMS Suite : Concessioni Model
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
This library contains custom class for GNA "concessioni" use case model.
It contains the class ProfiledConcessione extending Project, in order to facilitate custom logic integration.
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
@ -11,8 +13,8 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log

View File

@ -6,14 +6,14 @@
<groupId>org.gcube.application.cms</groupId>
<artifactId>concessioni-model</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
<name>GNA Concessioni Model</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<properties>

View File

@ -1,11 +1,12 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.dataminer-plugins
This library contains gcube-cms plugins for processing via gCube Dataminer
## [v1.0.2] - 2023-01-10
- Pom updates
## [v1.0.1] - 2022-12-07
- Pom updates
## [v1.0.0] - 2022-02-24
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,8 +1,8 @@
gCube CMS Suite
gCube CMS Suite : DataMiner Plugins
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
This library contains gcube-cms plugins for processing via gCube Dataminer
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
* [OpenJDK](https://openjdk.java.net/) - The JDK used
@ -11,8 +11,8 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log

View File

@ -5,14 +5,14 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>dataminer-plugins</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<name>gCube CMS - Dataminer Plugins</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<dependencyManagement>

View File

@ -1,8 +1,9 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.ckan-plugin
This library contains default Lifecycle Managers handlers
## [v1.0.1] - 2023-01-10
- Pom updates
## [v1.0.0] - 2022-02-24
- ## [v1.0.0] - 2022-02-24
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,9 +1,19 @@
gCube CMS Suite : default-lc-managers
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents called Projects defined in Use Case Descriptors.
This library contains the default Lifecycle Manager handler plugins.
This library contains default Lifecycle Managers handlers implementations :
- AbstractPlugin
- AbstractLifecycleManager
- Default3PhaseManager
- SimpleLifeCycleManager
It also contains utility like
- RoleManager : caller role evaluation utilities
- GuardedEventManager, GuardedStepExecution, GuardedExecution : simplicity class for safe implementations
Plugins SHOULD be defined extending the definitions provided in this module.
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
@ -13,8 +23,8 @@ This library contains the default Lifecycle Manager handler plugins.
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log

View File

@ -5,14 +5,14 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>default-lc-managers</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<name>gCube CMS - Default LC Managers</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<properties>

View File

@ -3,6 +3,7 @@ package org.gcube.application.cms.plugins.implementations;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.implementations.ProjectAccess;
import org.gcube.application.cms.implementations.utils.UserUtils;
import org.gcube.application.cms.plugins.LifecycleManager;
import org.gcube.application.cms.plugins.PluginManagerInterface;
import org.gcube.application.cms.plugins.faults.*;
@ -164,9 +165,10 @@ public abstract class AbstractLifeCycleManager extends AbstractPlugin implements
try{
report.setStatus(Report.Status.OK);
} catch (Throwable e) {
log.error("Unable to initialize plugins in {} ", ContextUtils.getCurrentScope(),e);
String context = UserUtils.getCurrent().getContext();
log.error("Unable to initialize plugins in {} ", context,e);
report.setStatus(Report.Status.WARNING);
report.putMessage("Unable to initialize plugins in "+ ContextUtils.getCurrentScope()+" : "+e.getMessage());
report.putMessage("Unable to initialize plugins in "+ context +" : "+e.getMessage());
}
return report;
}

View File

@ -1,7 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.geoportal-client
## [v1.1.2] - 2023-01-10
- Pom updates
## [v1.1.1] - 2022-12-07
- Pom updates
@ -39,4 +40,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
-Excluded common-calls 1.2.0
## [v1.0.0] - 2020-11-11
- First release
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,14 +1,21 @@
GeoPortal - Client
gCube CMS Suite : GeoPortal Client
--------------------------------------------------
GeoPortal - Client is the java library wrapping Geoportal REST Service
This module contains the definition of the client library for interacting with geoportal-service.
It is built on top of gCube FW stack and allows to build the following clients :
- Project<? extends Document> entities management
- UseCaseDescriptor entites management
It also provides a utility class Serialization for fast marshalling / unmarshalling.
## Built with
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal).
## Change log

View File

@ -4,14 +4,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
<name>Geoportal Client</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
@ -46,15 +46,6 @@
<artifactId>common-generic-clients</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.sun.xml.ws</groupId>-->
<!-- <artifactId>jaxws-ri</artifactId>-->
<!-- <version>2.3.2</version>-->
<!-- <type>pom</type>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api -->
<dependency>

View File

@ -52,16 +52,19 @@ public abstract class GenericUseCases extends BasicVreTests{
}
protected Project prepareWithFileSet(Project project) throws FileNotFoundException, InvalidRequestException, RemoteException {
return getClient().registerFileSet(project.getId(), prepareRequest());
}
protected RegisterFileSetRequest prepareRequest() throws FileNotFoundException {
String parentPath = "$.section";
String fieldName = "fileset";
String fieldDefinition = "$.section._children[?(@.fileset)]";
// Prepare request
RegisterFileSetRequest fsRequest = FileSets.
return FileSets.
prepareRequest(new StorageUtils(),
parentPath,fieldName,fieldDefinition, new File(Tests.FOLDER_CONCESSIONI,"pos.shp"));
return getClient().registerFileSet(project.getId(),fsRequest);
}
}

View File

@ -2,12 +2,17 @@ package org.gcube.application.geoportal.clients;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.cms.tests.TestDocuments;
import org.gcube.application.cms.tests.Tests;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.access.AccessPolicy;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
@ -25,6 +30,9 @@ import java.io.IOException;
import java.nio.charset.Charset;
import java.rmi.RemoteException;
import static org.junit.Assert.assertEquals;
@Slf4j
public class ProfiledConcessioniTest extends ProfiledDocumentsTest{
@Data
@ -78,11 +86,28 @@ public class ProfiledConcessioniTest extends ProfiledDocumentsTest{
// Set relazione
client.registerFileSet(project.getId(), FileSets.
Access toSetAccess = new Access();
toSetAccess.setPolicy(AccessPolicy.RESTRICTED);
toSetAccess.setLicense("CC0-1.0");
RegisterFileSetRequest request=FileSets.
prepareRequest(new StorageUtils(),
"$.relazioneScavo","fileset",
"$.relazioneScavo."+Field.CHILDREN+"[?(@.fileset)]",
new File(Tests.FOLDER_CONCESSIONI,"relazione.pdf")));
new File(Tests.FOLDER_CONCESSIONI,"relazione.pdf"));
request.setToSetAccess(toSetAccess);
project=client.registerFileSet(project.getId(), request);
String jsonDoc=project.getTheDocument().toJson();
log.info("Registered fileset. Result is {}", jsonDoc);
RegisteredFileSet f= Serialization.convert(new JSONPathWrapper(jsonDoc).getByPath(
request.getParentPath()).get(0),RegisteredFileSet.class);
assertEquals(Serialization.convert(f.getAccess(),Access.class).getPolicy(),toSetAccess.getPolicy());
assertEquals(Serialization.convert(f.getAccess(),Access.class).getLicense(),toSetAccess.getLicense());
// Set Abstract

View File

@ -3,22 +3,35 @@ package org.gcube.application.geoportal.clients;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.cms.tests.Tests;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.access.AccessPolicy;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject;
import org.gcube.application.geoportal.common.model.rest.CreateRelationshipRequest;
import org.gcube.application.geoportal.common.model.rest.DeleteRelationshipRequest;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.Test;
import java.io.File;
import java.io.FileNotFoundException;
import java.rmi.RemoteException;
import java.time.LocalDateTime;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicLong;
import static org.gcube.application.geoportal.client.utils.Serialization.write;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@ -33,7 +46,7 @@ public class ProfiledDocumentsTest<M extends Project,C extends Projects<M>> exte
@Test
public void registerNew() throws RemoteException, JsonProcessingException {
public void registerNew() throws RemoteException, JsonProcessingException, FileNotFoundException, InvalidRequestException {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Projects<M> client = (Projects<M>) getClient();
@ -46,6 +59,38 @@ public class ProfiledDocumentsTest<M extends Project,C extends Projects<M>> exte
Project p =client.createNew(theDoc);
log.debug("Registered project (AS JSON) : {}", write(p));
}
@Test
public void testAccess() throws FileNotFoundException, RemoteException, InvalidRequestException, JsonProcessingException {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Projects<M> client = (Projects<M>) getClient();
Document theDoc= Document.parse("{\n" +
"\"posizionamentoScavo\" :{\n" +
"\t\"titolo\" : \"mio titolo\"}}");
theDoc.put("startTime", LocalDateTime.now());
Project p =client.createNew(theDoc);
RegisterFileSetRequest fsRequest = prepareRequest();
Access access = new Access();
access.setLicense("CC0-1.0");
access.setPolicy(AccessPolicy.RESTRICTED);
fsRequest.setToSetAccess(access);
p=client.registerFileSet(p.getId(),fsRequest);
log.info("Registered fileset. Result is {}", Serialization.write(p));
RegisteredFileSet f= Serialization.convert(new JSONPathWrapper(p.getTheDocument().toJson()).getByPath(fsRequest.getParentPath()).get(0),RegisteredFileSet.class);
assertEquals(Serialization.convert(f.getAccess(),Access.class).getPolicy(),AccessPolicy.RESTRICTED);
}
@Test

View File

@ -1,7 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.geoportal-common
## [v1.0.11] - 2023-01-10
- Pom updates
## [v1.0.10] - 2022-12-07
- Pom updates
@ -50,4 +51,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Model update
## [v1.0.0] - 2020-11-11
- First release
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,14 +1,23 @@
GeoPortal - Common
gCube CMS Suite : GeoPortal Common
--------------------------------------------------
GeoPortal - Common is the java library containing basic classes (e.g. models) of gCube GeoPortal.
This module contains the definition of the interface expose by geoportal-service.
It contains both the methods, the constants, the model shared by service and clients (main classes are Project and UseCaseDescriptor).
It also provides the following utility classes :
- JSONPathWrapper : for JSON path parsing, built on top of com.jayway.jsonpath.json-path (https://github.com/json-path/JsonPath).
- FileSets : builder for FileSetRegistrationRequests
- StorageUtils : interface with gCube Storage
- ISUtils : Query to gCube IS
## Built with
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal).
## Change log

View File

@ -3,14 +3,14 @@
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>
<artifactId>geoportal-common</artifactId>
<version>1.0.10</version>
<version>1.0.11</version>
<name>Geoportal Common</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<properties>

View File

@ -8,33 +8,20 @@ import org.gcube.common.scope.api.ScopeProvider;
import static org.gcube.common.authorization.client.Constants.authorizationService;
@Slf4j
@Deprecated
public class ContextUtils {
public static String getCurrentScope(){
try{
String token=SecurityTokenProvider.instance.get();
log.trace("Token is : "+token.substring(0,2)+"..."+token.substring(token.length()-3));
if(token==null) throw new Exception("Security Token is null");
AuthorizationEntry entry = authorizationService().get(token);
return entry.getContext();
}catch(Exception e ){
log.trace("Unable to resolve token, checking scope provider..",e);
return ScopeProvider.instance.get();
}
}
public static String getCurrentCaller(){
try{
String token=SecurityTokenProvider.instance.get();
log.trace("Token is : "+token.substring(0,2)+"..."+token.substring(token.length()-3));
if(token==null) throw new Exception("Security Token is null");
log.trace("Token is : "+token.substring(0,2)+"..."+token.substring(token.length()-3));
AuthorizationEntry entry = authorizationService().get(token);
return entry.getClientInfo().getId();
}catch(Exception e ){
log.trace("Unable to resolve token, checking scope provider..",e);
return "Unidentified data-transfer user";
log.warn("Unable to resolve token using legacy utils, using default ..",e);
return "CMS_default_user";
}
}
}

View File

@ -92,12 +92,12 @@ public class Files {
if(toFix.startsWith("\\."))
toFix=toFix.replaceFirst("\\.","_");
String extension="";
if(toFix.contains(".")) {
int extensionIndex=toFix.lastIndexOf(".");
if(extensionIndex>0) {
//preserve extension
int index=toFix.indexOf(".");
extension=toFix.substring(index);
extension=toFix.substring(extensionIndex);
//only escape before extension
toFix=toFix.substring(0,toFix.indexOf("."));
toFix=toFix.substring(0,extensionIndex);
}
return toFix.toLowerCase().
replaceAll("[\\-\\*\\+\\/\\\\ \\[\\]\\(\\)\\.\\\"\\:\\;\\|\\=]","_")+extension.toLowerCase();

View File

@ -17,7 +17,7 @@ public class GCubeTest {
testContext = "/pred4s/preprod/preVRE";
// testContext = "/d4science.research-infrastructures.eu/D4OS/GNA";
testContext= "/gcube/devsec/devVRE";
// testContext= "/gcube/devsec/devVRE";
System.out.println("TEST CONTEXT = "+testContext);
return testContext;

View File

@ -6,6 +6,8 @@ import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -18,12 +20,18 @@ public class FilesTests {
@Test
public void testNames(){
for(String name : baseFolder.list()){
ArrayList<String> toTestStrings=new ArrayList<>(Arrays.asList(baseFolder.list()));
toTestStrings.add("e. gna_topografia_timponedellamotta.qmd");
for(String name : toTestStrings){
if(name.contains(".")) {
String originalExtension = name.substring(name.indexOf("."));
int extensionIndex = name.lastIndexOf(".");
String originalExtension = extensionIndex>0?name.substring(extensionIndex):null;
String obtained = Files.fixFilename(name);
log.info(name + "->" + obtained + "[" + originalExtension + "]");
assertTrue(obtained.endsWith(originalExtension));
if(originalExtension!=null)
assertTrue(obtained.endsWith(originalExtension));
}
}
}

View File

@ -1,7 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.geoportal-service
## [v1.0.12] - 2023-01-10
- Refactored UserUtils into framework plugin
## [v1.0.11] - 2022-12-07
- Pom updates
- Introduced module default-lc-managers
@ -52,4 +53,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Project interface
## [v1.0.0] 2020-11-11
- First release
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,7 +1,14 @@
GeoPortal - Service
gCube CMS Suite : GeoPortal Service
--------------------------------------------------
GeoPortal - Service is the main component operating a gCube GeoPortal. It is a SmartGears web application based on top of gCube SDI
gCube CMS Service is a gCube REST-like Application developed on top of gCube SmartGears.
It implements the core business logic of gCube CMS Suite, exposing methods for the management of Projects, Use Case Descriptors and available server plugins.
It is built on top of Jersey Framework, it uses a MongoDB Document Store for JSON archiving and Querying.
It exploits the infrastructure StorageHub for archiving FileSets and the Information System in order to discover available resources.
Its main goal is to receive client calls and orchestrate plugins implementation in order to serve them according to the UCD defined in the caller context.
## Built with
* [gCube SDI] (https://gcube.wiki.gcube-system.org/gcube/) - The gCube SDI
@ -12,8 +19,8 @@ GeoPortal - Service is the main component operating a gCube GeoPortal. It is a S
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal).
## Change log

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -1,810 +0,0 @@
.. _Anchor For ExampleRSTFile:
#################
Example .rst File
#################
NB https://sphinx-design.readthedocs.io/en/furo-theme/dropdowns.html
If you work with edX documentation source files, you might find this file
helpful as a reference. This file contains examples of .rst formatting.
Explanations and more context for each type of element are provided in
:ref:`Work with edX Documentation Source Files`.
This file covers the following topics.
.. contents::
:local:
:depth: 1
***************
Heading Levels
***************
::
#############
Heading 1
#############
*************
Heading 2
*************
===========
Heading 3
===========
Heading 4
************
Heading 5
===========
Heading 6
~~~~~~~~~~~
************************************************
Paragraph Text and Commented Text
************************************************
This is an example of regular text in paragraph form. There are no indents. As
a best practice, break lines at about 80 characters, so that each line has its
own line number for commenting in reviews.
.. warning:: Throughout text and code examples, make sure double quotation
marks and apostrophes are straight (") or ('), not curly quotatation marks
and apostrophes, which might be introduced when text is cut and pasted from
other sources or editors.
Boldface is used for labels that are visible in the user interface. The UI
text is surrounded by double asterisks. For example, **bold**.
Italics are rarely used. Text surrounded by single asterisks is rendered in
*italics*.
Monospace text is used for ``code examples``. Text surrounded by double grave
accent characters is rendered in monospace font.
``.. comments can be added in a file by starting a line with 2 periods and a space.``
In English source files, look for comments addressed to translators from writers.
``.. Translators: In this code example, do not translate such and such.``
***************************************
Ordered and Unordered Lists
***************************************
Use hash symbols for ordered lists.
::
#. Select **Advanced Settings**.
#. Find the **Course Advertised Start Date** policy key.
#. Enter the value you want to display.
.. note::
Ordered lists usually use numerals. Nested ordered lists (ordered lists inside
other ordered lists) use letters.
Use asterisks for unordered (bulleted) lists.
::
* Who is teaching the course?
* What university or college is the course affiliated with?
* What topics and concepts are covered in your course?
* Why should a learner enroll in your course?
=======================
Nested Lists or Content
=======================
You can include content including additional lists and code examples inside
lists.
Unordered List inside Ordered List
***************************************
To include an unordered list inside an ordered list, indent the unordered list
three spaces. The first bullet in the unordered list must be flush with the
text in the ordered list.
::
#. Review your entry to verify that the key is accurate and that it is
surrounded by quotation marks. If there is a list of keys, they must be
comma separated.
* In this example, the key for the Annotation Problem tool is the only
value in the list.
* In this example, the key for the Annotation Problem tool is added at
the beginning of a list of other keys.
#. Select **Save Changes**.
.. image:: /Images/Lists_UL_inside_OL.png
:width: 500
:alt: An unordered (bulleted) list inside an ordered (numbered) list.
Ordered List inside Unordered List
***************************************
To include an ordered list inside an unordered list, indent the ordered list
two spaces. The first number or letter of the ordered list must be flush with
the text in the unordered list.
::
* Review your entry to verify that the key is accurate and that it is
surrounded by quotation marks. If there is a list of keys, they must be comma
separated.
#. In this example, the key for the Annotation Problem tool is the only
value in the list.
#. In this example, the key for the Annotation Problem tool is added at the
beginning of a list of other keys.
* Select **Save Changes**.
.. There isn't a screen shot of the above example yet because these lists don't
.. render correctly locally, and searching for an example in the built docs
.. online was taking too much time.
Unordered List inside Unordered List
***************************************
To include an unordered list inside another unordered list, indent the second
unordered list two spaces. The first bullet of the second unordered list must
be flush with the text in the unordered list.
::
* Review your entry to verify that the key is accurate and that it is
surrounded by quotation marks. If there is a list of keys, they must be
comma separated.
#. In this example, the key for the Annotation Problem tool is the only
value in the list.
#. In this example, the key for the Annotation Problem tool is added at the
beginning of a list of other keys.
* Select **Save Changes**.
.. image:: /Images/Lists_UL_inside_UL.png
:width: 500
:alt: An ordered (numbered) list inside an unordered (bulleted) list.
Ordered List inside Ordered List
***************************************
To include another ordered list inside an ordered list, indent the second
ordered list three spaces. The second ordered list must be flush with the text
in the numbered list. The first ordered list uses numerals, and the second
uses letters.
::
#. Review your entry to verify that the key is accurate and that it is
surrounded by quotation marks. If there is a list of keys, they must be
comma separated.
#. In this example, the key for the Annotation Problem tool is the only
value in the list.
#. In this example, the key for the Annotation Problem tool is added at
the beginning of a list of other keys.
#. Select **Save Changes**.
.. There isn't a screen shot of the above example yet because these lists don't
.. render correctly locally, and searching for an example in the built docs
.. online was taking too much time.
Code, Images, and Other Content inside Lists
*********************************************
To include content such as code or an image inside a list, position the code or
image directive flush with the text in the list. That is, indent three spaces
for ordered lists and two spaces for unordered lists.
::
#. In the ``lms.yml`` and ``studio.yml`` files, set the value of
``CERTIFICATES_HTML_VIEW`` within the ``FEATURES`` object to ``true``.
.. code-block:: bash
"FEATURES": {
...
'CERTIFICATES_HTML_VIEW': true,
...
}
#. Save the ``lms.yml`` and ``studio.yml`` files.
***************************************
Conditional Text
***************************************
To conditionalize a single paragraph, use either the ``only:: Partners`` or
the ``only:: Open_edX`` directive, and indent the paragraph under the
directive. You can add the conditional text as regular text or as a note.
Make sure to indent the paragraph under the directive.
::
.. only:: Partners
Data about course enrollment is available from edX Insights. You can access
Insights from the instructor dashboard for your live course: after you select
**Instructor**, follow the link in the banner at the top of each page. For
more information, see `Using edX Insights`_.
.. only:: Open_edX
.. note::
If you want to require an entrance exam for your course, you also create
the exam in the course outline. Before you can create an exam, you must
set your course to require an entrance exam in Studio. For more
information, see :ref:`Require an Entrance Exam`.
To conditionalize more than a paragraph, use either the ``only:: Partners`` or
the ``only:: Open_edX`` directive, and then use an ``include::`` directive
indented under the only directive.
::
.. only:: Open_edX
.. include:: ../../../shared/building_and_running_chapters/running_course/Section_course_student.rst
*********************************
Notes and Warnings
*********************************
::
.. note::
This is note text. If note text runs over a line, make sure the lines wrap
and are indented to the same level as the note tag. If formatting is
incorrect, part of the note might not render in the HTML output.
Notes can have more than one paragraph. Successive paragraphs must indent
to the same level as the rest of the note.
.. note::
This is note text. If note text runs over a line, make sure the lines wrap
and are indented to the same level as the note tag. If formatting is
incorrect, part of the note might not render in the HTML output.
Notes can have more than one paragraph. Successive paragraphs must indent to
the same level as the rest of the note.
::
.. warning::
Warnings are formatted in the same way as notes. In the same way, lines
must be broken and indented under the warning tag.
.. warning::
Warnings are formatted in the same way as notes. In the same way, lines must
be broken and indented under the warning tag.
****************************
Cross-References
****************************
In edX documents, you can include cross-references to other locations in the
same edX document, to locations in other edX documents (such as a cross-
reference from a location in the *Building and Running an edX Course* guide to
a location in the *EdX Learner's Guide*), to JIRA stories, and to external
websites. In this section, "EdX documents" refers to the resources, including
guides and tutorials, that are listed on docs.edx.org.
For more information about creating cross-references using RST and Sphinx, see
`Cross-referencing arbitrary locations`_ in the online Sphinx documentation.
==================================================
Cross-References to Locations in the Same Document
==================================================
Cross-references to locations in the same document use anchors that are located
above the heading for each topic or section. Anchors can contain numbers,
letters, spaces, underscores, and hyphens, but cannot include punctuation.
Anchors use the following syntax.
::
.. _Anchor Text:
The following example shows an anchor for a section, followed by the heading
for that section. ``SFD SN Keyboard Shortcuts`` is the anchor text.
::
.. _SFD SN Keyboard Shortcuts:
******************************
Keyboard Shortcuts for Notes
******************************
To create cross-references to locations in the same document, you can use the
anchor only, or you can use your own text. The anchor text is never visible in
output. It is replaced by the text of the heading that follows the anchor or
the text that you specify.
Cross-References Using the Anchor Only
********************************************
To add a cross-reference to a specific location in a document and use the text
of the heading for that location as link text, use ``:ref:`Anchor Text```
syntax, as in the following example.
::
For more information about using keyboard shortcuts, see :ref:`SFD SN
Keyboard Shortcuts`.
In this example, "SFD SN Keyboard Shortcuts" is the anchor text for a section
that is titled "Keyboard Shortcuts for Notes". Readers will see the following
text, and "Keyboard Shortcuts for Notes" will be an active link.
::
For more information about using keyboard shortcuts, see Keyboard Shortcuts
for Notes.
Cross-References Using Specified Link Text
*******************************************
For internal cross-references that use text other than the heading for the
section that you're linking to, use ``:ref:`specified text<Anchor Text>```
syntax, as in the following example.
::
If you want to, you can use :ref:`keyboard shortcuts<SFD SN Keyboard
Shortcuts>` to create, edit, and view notes.
.. note::
Do not include a space between the last word of the link text and the opening
angle bracket for the anchor text.
In this example, "keyboard shortcuts" is the link text, and "SFD SN Keyboard
Shortcuts" is the anchor text for a section that is titled "Keyboard Shortcuts
for Notes". Readers will see the following text, and "keyboard shortcuts" will
be an active link.
::
If you want to, you can use keyboard shortcuts to create, edit, and view your
notes.
==========================================================
Cross-References to Locations in Different edX Documents
==========================================================
You can create cross-references between different edX documents. For example,
you can create a link in *Building and Running an edX Course* to a topic in the
*EdX Learner's Guide*. To do this, you use the intersphinx map ID of the
document that you want to link to and the anchor text for the section you want.
The cross-reference uses the following syntax.
::
:ref:`intersphinx_map_ID:Anchor Name`
For example:
::
:ref:`partnercoursestaff:Release Dates`
To find the intersphinx map ID for the document that you want, follow these
steps.
#. Open the conf.py file in the `edx-documentation/shared`_ folder, and then
locate the following line.
``intersphinx_mapping = {``
#. In the list that follows this line, find the ID for the document that you
want. The text between the single quotation marks (') at the beginning of
each line is the intersphinx map ID for the document.
The following intersphinx map IDs are the most frequently used.
.. list-table::
:widths: 25 25 50
* - Map ID
- Document
* - ``partnercoursestaff``
- *Building and Running an edX Course*
* - ``opencoursestaff``
- *Building and Running an Open edX Course*
* - ``learners``
- *EdX Learner's Guide*
* - ``openlearners``
- *Open edX Learner's Guide*
* - ``data``
- *EdX Research Guide*
* - ``insights``
- *Using edX Insights*
* - ``installation``
- *Installing, Configuring, and Running the Open edX Platform*
* - ``opendevelopers``
- *Open edX Developer's Guide*
* - ``partnerreleasenotes``
- Partner release notes
* - ``openreleasenotes``
- Open edX release notes
============================================
Cross-References to JIRA
============================================
For cross-references to JIRA tickets, use the ``:jira:`PROJECT-ticketnumber```
syntax, as in the following example.
::
For more information, see :jira:`DOC-2316`.
Note that ``jira`` replaces ``ref`` for these links.
Readers will see the following text, and "DOC-2316" will be an active link.
``For more information, see DOC-2316.``
============================================
Cross-References to External Web Pages
============================================
A cross-reference to an external web page has several elements.
* The URL of the external web page.
* The text to use for the cross-reference. This text becomes an anchor in the
file that contains the cross-reference.
* An ``include`` directive in the file that contains the cross-reference to the
links.rst file that is located in the ``edx-documentation/en_us/links/``
folder.
* An entry in the links.rst file.
To create an external cross-reference, follow these steps.
#. In the paragraph where you want the cross-reference, add the text that you
want to use for the link, formatted as follows (where "Release Pages" is the
link text). This creates an anchor out of that text.
::
The edX engineering wiki `Release Pages`_ provide access to detailed
information about every change made to the edx-platform GitHub
repository.
#. In the file that contains the cross-reference, add an ``include`` directive
for the ``edx-documentation/en_us/links/links.rst`` file if one does not
already exist. These ``include`` directives are typically at the end of the
file.
::
.. include:: ../../links/links.rst
.. note::
The path to the links.rst file depends on the location of the file where
you are creating the link. For example, the path might be
``../../../links/links.rst`` or ``../links/links.rst``.
#. In the ``edx-documentation/en_us/links/links.rst`` file, add an entry for
the anchor text and the URL of the external website, formatted as follows.
Make sure that the anchor text in this file matches the anchor text in the
file that contains the cross-reference exactly, including capitalization.
::
.. _Release Pages: https://openedx.atlassian.net/wiki/display/ENG/Release+Pages
Readers will see the following text. "Release Pages" will be an active link.
::
The edX engineering wiki Release Pages provide access to detailed
information about every change made to the edx-platform GitHub
repository.
****************************
Image References
****************************
Image references look like this.
::
.. image:: /Images/Course_Outline_LMS.png
:width: 100
:alt: A screen capture showing the elements of the course outline in the LMS.
Image links can include optional specifications such as height, width, or
scale. Alternative text for screen readers is required for each image. Provide
text that is useful to someone who might not be able to see the image.
.. _Examples of Tables:
************************************
Tables
************************************
Each example in this section shows the raw formatting for the table followed
by the table as it would render (if you are viewing this file as part of the
Style Guide).
======================================
Example of a table with an empty cell
======================================
The empty cell is the second column in the first row of this table.
::
.. list-table::
:widths: 25 25 50
* - Annotation Problem
-
- Annotation problems ask students to respond to questions about a
specific block of text. The question appears above the text when the
student hovers the mouse over the highlighted text so that students can
think about the question as they read.
* - Example Poll
- Conditional Module
- You can create a conditional module to control versions of content that
groups of students see. For example, students who answer "Yes" to a
poll question then see a different block of text from the students who
answer "No" to that question.
* - Example JavaScript Problem
- Custom JavaScript
- Custom JavaScript display and grading problems (also called *custom
JavaScript problems* or *JS input problems*) allow you to create a
custom problem or tool that uses JavaScript and then add the problem or
tool directly into Studio.
.. list-table::
:widths: 25 25 50
* - Annotation Problem
-
- Annotation problems ask students to respond to questions about a
specific block of text. The question appears above the text when the
student hovers the mouse over the highlighted text so that students can
think about the question as they read.
* - Example Poll
- Conditional Module
- You can create a conditional module to control versions of content that
groups of students see. For example, students who answer "Yes" to a
poll question then see a different block of text from the students who
answer "No" to that question.
* - Exampel JavaScript Problem
- Custom JavaScript
- Custom JavaScript display and grading problems (also called *custom
JavaScript problems* or *JS input problems*) allow you to create a
custom problem or tool that uses JavaScript and then add the problem or
tool directly into Studio.
====================================
Example of a table with a header row
====================================
::
.. list-table::
:widths: 15 15 70
:header-rows: 1
* - First Name
- Last Name
- Residence
* - Elizabeth
- Bennett
- Longbourne
* - Fitzwilliam
- Darcy
- Pemberley
.. list-table::
:widths: 15 15 70
:header-rows: 1
* - First Name
- Last Name
- Residence
* - Elizabeth
- Bennett
- Longbourne
* - Fitzwilliam
- Darcy
- Pemberley
===============================================
Example of a table with a boldface first column
===============================================
::
.. list-table::
:widths: 15 15 70
:stub-columns: 1
* - First Name
- Elizabeth
- Fitzwilliam
* - Last Name
- Bennett
- Darcy
* - Residence
- Longboure
- Pemberley
.. list-table::
:widths: 15 15 70
:stub-columns: 1
* - First Name
- Elizabeth
- Fitzwilliam
* - Last Name
- Bennett
- Darcy
* - Residence
- Longboure
- Pemberley
==============================================================
Example of a table with a cell that includes an unordered list
==============================================================
The blank lines before and after the unordered list are critical for the list
to render correctly.
::
.. list-table::
:widths: 15 15 60
:header-rows: 1
* - Field
- Type
- Details
* - ``correct_map``
- dict
- For each problem ID value listed by ``answers``, provides:
* ``correctness``: string; 'correct', 'incorrect'
* ``hint``: string; Gives optional hint. Nulls allowed.
* ``hintmode``: string; None, 'on_request', 'always'. Nulls allowed.
* ``msg``: string; Gives extra message response.
* ``npoints``: integer; Points awarded for this ``answer_id``. Nulls allowed.
* ``queuestate``: dict; None when not queued, else ``{key:'', time:''}``
where ``key`` is a secret string dump of a DateTime object in the form
'%Y%m%d%H%M%S'. Nulls allowed.
* - ``grade``
- integer
- Current grade value.
* - ``max_grade``
- integer
- Maximum possible grade value.
.. list-table::
:widths: 15 15 60
:header-rows: 1
* - Field
- Type
- Details
* - ``correct_map``
- dict
- For each problem ID value listed by ``answers``, provides:
* ``correctness``: string; 'correct', 'incorrect'
* ``hint``: string; Gives optional hint. Nulls allowed.
* ``hintmode``: string; None, 'on_request', 'always'. Nulls allowed.
* ``msg``: string; Gives extra message response.
* ``npoints``: integer; Points awarded for this ``answer_id``. Nulls allowed.
* ``queuestate``: dict; None when not queued, else ``{key:'', time:''}``
where ``key`` is a secret string dump of a DateTime object in the form
'%Y%m%d%H%M%S'. Nulls allowed.
* - ``grade``
- integer
- Current grade value.
* - ``max_grade``
- integer
- Maximum possible grade value.
*****************
Code Formatting
*****************
===========
Inline code
===========
In inline text, any text can be formatted as code (monospace font) by
enclosing the selection within a pair of double "grave accent" characters (`).
For example, ````these words```` are formatted in a monospace font when the
documentation is output as PDF or HTML.
===========
Code blocks
===========
To set text in a code block, end the previous paragaph with 2 colons, leave
one line before the intended code block, and make sure the code block is
indented beyond the first colon.
::
For example, this is the introductory paragraph
::
<p>and this is the code block following.</p>
Alternatively, use the code-block tag. Optionally, indicate the type of code
after the 2 colons in the tag, which results in the tags within the code block
being displayed in different colors.
::
.. code-block:: xml
<problem>
<annotationresponse>
<annotationinput>
<text>PLACEHOLDER: Text of annotation</text>
<comment>PLACEHOLDER: Text of question</comment>
<comment_prompt>PLACEHOLDER: Type your response below:</comment_prompt>
<tag_prompt>PLACEHOLDER: In your response to this question, which tag below
do you choose?</tag_prompt>
<options>
<option choice="incorrect">PLACEHOLDER: Incorrect answer (to make this
option a correct or partially correct answer, change choice="incorrect"
to choice="correct" or choice="partially-correct")</option>
<option choice="correct">PLACEHOLDER: Correct answer (to make this option
an incorrect or partially correct answer, change choice="correct" to
choice="incorrect" or choice="partially-correct")</option>
<option choice="partially-correct">PLACEHOLDER: Partially correct answer
(to make this option a correct or partially correct answer,
change choice="partially-correct" to choice="correct" or choice="incorrect")
</option>
</options>
</annotationinput>
</annotationresponse>
<solution>
<p>PLACEHOLDER: Detailed explanation of solution</p>
</solution>
</problem>
.. include:: ../../links/links.rst

View File

@ -19,7 +19,7 @@
<javascript-client disabled="true" />
<docs docsDir="${project.build.directory}" docsSubdir="api-docs" />
<!-- REPLACE THE ${project.artifactId} WITH YOUR APPLICATION NAME. E.g. /gcat, /uri-resolver. if the ${project.artifactId} is not matching your APPLICATION Name /> -->
<swagger basePath="/${project.artifactId}" />
<swagger basePath="/${project.artifactId}/srv" />
<docs freemarkerTemplate="${project.basedir}/src/main/resources/META-INF/enunciate/d4science_docs.fmt">
<additional-css file="css/d4science_enunciate_custom.css" />
</docs>

View File

@ -4,14 +4,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-service</artifactId>
<version>1.0.11</version>
<version>1.0.12</version>
<name>Geoportal Service</name>
<packaging>war</packaging>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<properties>
@ -68,11 +68,6 @@
<artifactId>default-lc-managers</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-utils</artifactId>
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
</dependency>
<!-- MONGO -->
<!-- https://mvnrepository.com/artifact/org.mongodb/mongo-java-driver -->

View File

@ -14,6 +14,7 @@ import org.bson.types.ObjectId;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.implementations.WorkspaceManager;
import org.gcube.application.cms.implementations.faults.*;
import org.gcube.application.cms.implementations.utils.UserUtils;
import org.gcube.application.cms.plugins.LifecycleManager;
import org.gcube.application.cms.plugins.faults.EventException;
import org.gcube.application.cms.plugins.faults.InsufficientPrivileges;
@ -47,10 +48,9 @@ import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.*;
import org.gcube.application.geoportal.common.utils.ContextUtils;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.service.engine.providers.PluginManager;
import org.gcube.application.geoportal.service.utils.UserUtils;
import org.gcube.common.storagehub.client.dsl.FolderContainer;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
@ -81,7 +81,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
return ID;
}
public ProfiledMongoManager(String profileId) throws ConfigurationException, RegistrationException {
public ProfiledMongoManager(String profileId) throws ConfigurationException, RegistrationException {
// Check UseCaseDescriptor ID
log.info("Loading useCaseDescriptor ID {} ",profileId);
if(profileId==null) throw new InvalidParameterException("UseCaseDescriptor ID cannot be null");
@ -235,7 +235,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
// TODO Set Access From UseCaseDescriptor
Access access=new Access();
access.setLicense("");
access.setLicense("CC-BY-4.0");
access.setPolicy(AccessPolicy.OPEN);
pubInfo.setAccess(access);
@ -624,6 +624,8 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
}
if(!policy.canWrite(doc,u)) throw new UnauthorizedAccess("No edit rights on project "+id);
doc.getLifecycleInformation().cleanState();
doc.getLifecycleInformation().setLastOperationStatus(LifecycleInformation.Status.OK);
@ -650,10 +652,14 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
Document parent = Serialization.asDocument(foundElementsByMatchingPaths.get(0));
Access toSetAccess = doc.getInfo().getAccess();
Access toSetAccess = new Access(doc.getInfo().getAccess().getPolicy(),doc.getInfo().getAccess().getLicense());
if(request.getToSetAccess()!=null){
//TODO validate specified Access
toSetAccess = request.getToSetAccess();
String requestedLicense = request.getToSetAccess().getLicense();
if(requestedLicense!=null)toSetAccess.setLicense(requestedLicense);
AccessPolicy requestedPolicy = request.getToSetAccess().getPolicy();
if(requestedPolicy!=null)toSetAccess.setPolicy(requestedPolicy);
}
// PREPARE REGISTERED FS
@ -821,7 +827,8 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
@Override
public Configuration getConfiguration() throws ConfigurationException{
log.debug("Asking configuration for {} in {} ", useCaseDescriptor.getId(), UserUtils.getCurrent().getContext());
String context = UserUtils.getCurrent().getContext();
log.debug("Asking configuration for {} in {} ", useCaseDescriptor.getId(), context);
Configuration toReturn= new Configuration();
List<Archive> archives = new ArrayList<>();
toReturn.setArchives(archives);
@ -829,7 +836,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
toReturn.setIndexes(indexes);
// Set Basic Info
toReturn.setProfileId(this.getUseCaseDescriptor().getId());
toReturn.setContext(ContextUtils.getCurrentScope());
toReturn.setContext(context);
toReturn.setLastUpdatedTime(LocalDateTime.now());
// Add Mongo Info
@ -953,7 +960,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
private static final RegisteredFileSet prepareRegisteredFileSet(Access toSetAccess,String docID, String profileID,
Document attributes,List<TempFile> files, StorageUtils storage,WorkspaceManager ws) throws StorageHubException, StorageException {
log.debug("Preparing Registered FileSet..");
log.debug("Preparing Registered FileSet {}");
RegisteredFileSet toReturn = new RegisteredFileSet();
if(attributes!=null) toReturn.putAll(attributes);
String uuid = UUID.randomUUID().toString();

View File

@ -7,6 +7,7 @@ import com.mongodb.client.model.ReturnDocument;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.gcube.application.cms.implementations.utils.UserUtils;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
@ -24,7 +25,10 @@ public class UCDMongoManager extends MongoManager implements UCDManagerI{
public UCDMongoManager() throws ConfigurationException {
init("UCD_"+ContextUtils.getCurrentScope().replaceAll("/","_"));
String context = UserUtils.getCurrent().getContext();
String collectionName ="UCD_"+context.replaceAll("/","_");
log.debug("Starting UCD mongo manager under {} with collection name {} ",context, collectionName);
init(collectionName);
}
public long deleteAll(){

View File

@ -4,10 +4,12 @@ import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.caches.TimedMap;
import org.gcube.application.cms.implementations.utils.UserUtils;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.engine.mongo.ProfiledMongoManager;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAmount;
@ -45,6 +47,7 @@ public class ConfigurationCache extends AbstractScopedMap<ConfigurationCache.Con
private static Configuration getForProfile(String profileID) throws ConfigurationException{
log.info("Evaluating Configuration for profile {} ",profileID);
log.debug("Caller is {} ", UserUtils.getCurrent());
try{
return new ProfiledMongoManager(profileID).getConfiguration();
} catch (ConfigurationException e) {

View File

@ -6,6 +6,7 @@ import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.caches.Engine;
import org.gcube.application.cms.caches.ObjectManager;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.implementations.utils.UserUtils;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
@ -204,7 +205,8 @@ public class UCDManager extends AbstractScopedMap<UCDManagerI> implements UCDMan
log.warn("Unable to cache UCD {}",entry.getKey(),e);
}
}
log.info("Cached {} UCDs in {} ",memCache.size(),ContextUtils.getCurrentScope());
String context = UserUtils.getCurrent().getContext();
log.info("Cached {} UCDs in {} ",memCache.size(),context);
cacheLock.writeLock().unlock();
}

View File

@ -2,6 +2,7 @@ package org.gcube.application.geoportal.service.engine.mongo;
import org.bson.Document;
import org.gcube.application.cms.implementations.faults.*;
import org.gcube.application.cms.implementations.utils.UserUtils;
import org.gcube.application.cms.plugins.faults.EventException;
import org.gcube.application.cms.plugins.faults.InsufficientPrivileges;
import org.gcube.application.cms.plugins.faults.StepException;
@ -16,7 +17,6 @@ import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.gcube.application.geoportal.service.utils.UserUtils;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import org.junit.Before;
import org.junit.BeforeClass;
@ -30,7 +30,7 @@ import static org.junit.Assume.assumeTrue;
public class LockTests extends BasicServiceTestUnit {
String profileID = "rolesTesting";
String profileID = "basic";
ProfiledMongoManager manager= null;
@BeforeClass
@ -100,7 +100,7 @@ public class LockTests extends BasicServiceTestUnit {
// register fileset
FileSets.RequestBuilder builder = FileSets.build(
"$.relazioneScavo","fileset","relazioneScavo."+ Field.CHILDREN+"[?(@.fileset)]");
"$.section","fileset","section."+ Field.CHILDREN+"[?(@.fileset)]");
StorageUtils s= new StorageUtils();
builder.add(
s.putOntoStorage(new File(Tests.FOLDER_CONCESSIONI,"pos.shp"),"pos.shp"));
@ -109,7 +109,7 @@ public class LockTests extends BasicServiceTestUnit {
checkIsLockCleaned(p.getId());
// delete fileset
p=managerInterface.deleteFileSet(p.getId(),"$.relazioneScavo.fileset",false);
p=managerInterface.deleteFileSet(p.getId(),"$.section.fileset",false);
checkIsLockCleaned(p.getId());
// perform step

View File

@ -9,6 +9,7 @@ import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.BasicTests;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
@ -23,12 +24,14 @@ import org.junit.Before;
import org.junit.Test;
import org.opengis.service.Interface;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import java.io.File;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@ -158,9 +161,12 @@ public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUni
String fieldDefinitionPath,
Document attributes,
RegisterFileSetRequest.ClashOptions clashPolicy,
String ...files) throws Exception {
Access access,
String ...files) throws Exception {
FileSets.RequestBuilder builder = FileSets.build(parentPath,fieldName,fieldDefinitionPath);
builder.setAccess(access);
builder.setClashPolicy(clashPolicy).setAttributes(attributes);
for(String file:files)
@ -169,6 +175,7 @@ public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUni
Project doc = check(baseTarget().path(InterfaceConstants.Methods.REGISTER_FILES_PATH).path(id).request(MediaType.APPLICATION_JSON).
post(Entity.entity(Serialization.write(builder.getTheRequest()),
MediaType.APPLICATION_JSON)), Project.class);
BasicTests.validate(doc);
return doc;
}

View File

@ -4,6 +4,8 @@ import org.bson.Document;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.access.AccessPolicy;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
@ -31,7 +33,7 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{
String fieldName="fileset";
String fieldDefinition="section."+Field.CHILDREN+"[?(@.fileset)]";
String filename = "sample.tif";
String filename = "concessioni/sample.tif";
@Override
@ -89,7 +91,7 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{
fieldDefinition,
new Document("customField","customFieldValue"),
RegisterFileSetRequest.ClashOptions.REPLACE_EXISTING,
filename);
new Access(),filename);
wrapper = new JSONPathWrapper(doc.getTheDocument().toJson());
assertTrue("Relazione exists",wrapper.getMatchingPaths("section").size()==1);
@ -127,8 +129,9 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{
Project doc = createNew(baseDoc);
Access access =new Access();
access.setLicense("test-license");
access.setPolicy(AccessPolicy.RESTRICTED);
// INSERT ONE, MERGE INFO (NB default values already exist)
doc = upload(
@ -138,142 +141,21 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{
fieldDefinition,
new Document("customField","customFieldValue"),
RegisterFileSetRequest.ClashOptions.REPLACE_EXISTING,
filename);
access,filename);
return doc;
}
@Test
public void testUnlock() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
// Not automatic, needs generation of locked project
assumeTrue(false);
String id = "627e87bb02ad3d1a2e0e9e18";
String ucd = "profiledConcessioni";
Project p =check(target(InterfaceConstants.Methods.PROJECTS).path(ucd).path(InterfaceConstants.Methods.FORCE_UNLOCK).path(id).request(MediaType.APPLICATION_JSON).
put(Entity.entity("", MediaType.APPLICATION_JSON)), Project.class);
assertNull(p.getLock());
}
@Test
public void testRelationships() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Project a = createNew(new Document("key","value"));
Project b = createNew(new Document("key","value"));
// set relation a -- precedes --> b
System.out.println("Setting relation..");
String relId="precedes";
a = check(baseTarget().
path(InterfaceConstants.Methods.RELATIONSHIP).
path(a.getId()).
path(relId).
queryParam(InterfaceConstants.Parameters.TARGET_UCD,b.getProfileID()).
queryParam(InterfaceConstants.Parameters.TARGET_ID,b.getId()).
request(MediaType.APPLICATION_JSON).
put(Entity.json("")), Project.class);
// check set relation in a
System.out.println("Checking relation a->b");
assertTrue(a.getRelationships()!=null && a.getRelationships().size()==1);
Relationship rel = a.getRelationships().get(0);
assertEquals(rel.getRelationshipName(),relId);
assertEquals(rel.getTargetUCD(),b.getProfileID());
assertEquals(rel.getTargetID(),b.getId());
// TODO TBD check reciprocity : expected relation b -- follows -> a
// delete relation
System.out.println("Deleting relation a->b");
a = check(baseTarget().
path(InterfaceConstants.Methods.RELATIONSHIP).
path(a.getId()).
path(relId).
queryParam(InterfaceConstants.Parameters.TARGET_UCD,b.getProfileID()).
queryParam(InterfaceConstants.Parameters.TARGET_ID,b.getId()).
request(MediaType.APPLICATION_JSON).
delete(), Project.class);
// check deleted
System.out.println("Checking deleted relation");
assertTrue(a.getRelationships()==null || a.getRelationships().isEmpty());
}
// Not automatic, needs generation of locked project
// @Test
// public void testSDI() throws Exception {
// // Create new
// Project doc = createNew(new Document("posizionamentoScavo",new Document("title","Mio pos")));
//
// // register filesets
// doc = upload(
// new StorageUtils(),
// doc.getId(),
// "posizionamentoScavo","fileset",
// "posizionamentoScavo."+Field.CHILDREN+"[?(@.fileset)]",
// null,
// RegisterFileSetRequest.ClashOptions.REPLACE_EXISTING,
// "pos.shp","pos.shx");
//
// System.out.println("Registered posizionamento, result is "+ Serialization.write(doc));
//
// // invoke step SUBMIT-FOR-REVIEW
// StepExecutionRequest req=new StepExecutionRequest();
// req.setStepID("SUBMIT-FOR-REVIEW");
// doc=step(doc.getId(),req);
// System.out.println(doc);
// if(doc.getLifecycleInformation().getErrorMessages()!=null) {
// System.out.println("ERROR MESSAGES");
// doc.getLifecycleInformation().getErrorMessages().forEach(s -> System.out.println(s));
// }
// if(doc.getLifecycleInformation().getWarningMessages()!=null) {
// System.out.println("WARNING MESSAGES");
// doc.getLifecycleInformation().getWarningMessages().forEach(s -> System.out.println(s));
// }
//
// assertTrue(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK));
//
// JSONPathWrapper wrapper = new JSONPathWrapper(doc.getTheDocument().toJson());
// RegisteredFileSet fs = Serialization.convert(wrapper.getByPath("$..fileset").get(0),RegisteredFileSet.class);
// assertTrue(fs!=null);
// assertTrue(fs.getPayloads().size()==2);
// assertTrue(fs.getMaterializations().size()>0);
//
//
// for(Object matObj : wrapper.getByPath("$..[?(@."+ Materialization.TYPE +" == '"+GCubeSDILayer.GCUBE_SDY_LAYER_TYPE+"' )]")){
// GCubeSDILayer layer = Serialization.convert(matObj, GCubeSDILayer.class);
// System.out.println("Checking Layer : "+layer);
// assertTrue(layer.getType().equals(GCubeSDILayer.GCUBE_SDY_LAYER_TYPE));
// assertTrue(layer.getOGCLinks().size()>0);
// assertTrue(layer.getPlatformInfo().size()>0);
// assertTrue(layer.getBBox()!=null);
// }
//
// // Checking platform info GeoServer
// for(Object platformObj : wrapper.getByPath("$..[?(@."+ Materialization.TYPE +" == 'GeoServer' )]")){
// Document platform=Serialization.asDocument(platformObj);
// assertTrue(platform.containsKey("layerName"));
// assertTrue(platform.containsKey("workspace"));
// assertTrue(platform.containsKey("storeName"));
// assertTrue(platform.containsKey("persistencePath"));
// assertTrue(platform.get("files",List.class).size()==2);
// }
//
//
// req.setStepID("APPROVE DRAFT");
// doc=step(doc.getId(),req);
// if(doc.getLifecycleInformation().getErrorMessages()!=null) {
// System.out.println("ERROR MESSAGES");
// doc.getLifecycleInformation().getErrorMessages().forEach(s -> System.out.println(s));
// }
// if(doc.getLifecycleInformation().getWarningMessages()!=null) {
// System.out.println("WARNING MESSAGES");
// doc.getLifecycleInformation().getWarningMessages().forEach(s -> System.out.println(s));
// }
//
// assertTrue(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK));
//
// public void testUnlock() throws Exception {
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
// assumeTrue(false);
// String id = "627e87bb02ad3d1a2e0e9e18";
// String ucd = "profiledConcessioni";
// Project p =check(target(InterfaceConstants.Methods.PROJECTS).path(ucd).path(InterfaceConstants.Methods.FORCE_UNLOCK).path(id).request(MediaType.APPLICATION_JSON).
// put(Entity.entity("", MediaType.APPLICATION_JSON)), Project.class);
// assertNull(p.getLock());
// }
}

View File

@ -2,28 +2,21 @@ package org.gcube.application.geoportal.service.profiledDocuments;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.cms.implementations.WorkspaceManager;
import org.gcube.application.cms.implementations.utils.UserUtils;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.cms.tests.model.BasicTests;
import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.identification.SpatialReference;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.utils.UserUtils;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import org.junit.Test;
import javax.management.relation.Relation;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import java.time.LocalDateTime;
import static org.junit.Assert.assertEquals;
@ -70,7 +63,7 @@ public class ProfiledConcessioniTests extends AbstractProfiledDocumentsTests{
"fileset",
"$.posizionamentoScavo."+ Field.CHILDREN+"[?(@.fileset)]",
null,
RegisterFileSetRequest.ClashOptions.MERGE_EXISTING,
RegisterFileSetRequest.ClashOptions.MERGE_EXISTING,new Access(),
"concessioni/pos.SHP");

View File

@ -1,11 +1,12 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.images-plugin
This library contains gcube-cms plugins for images materializations
## [v1.0.2] - 2023-01-10
- Pom updates
## [v1.0.1] - 2022-12-07
- Pom updates
## [v1.0.0] - 2022-02-24
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,7 +1,9 @@
gCube CMS Suite
gCube CMS Suite : Images Plugin
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
This module is expected to define handlers for the materializations of images preview.
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
@ -11,8 +13,8 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log

View File

@ -5,14 +5,14 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>images-plugins</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<name>gCube CMS - Images Plugins</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

View File

@ -1,11 +1,12 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.notifications-plugins
This library contains gcube-cms plugins for notitfications events
## [v1.0.2] - 2023-01-10
- Pom updates
## [v1.0.1] - 2022-12-07
- Pom updates
## [v1.0.0] - 2022-02-24
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,8 +1,11 @@
gCube CMS Suite
gCube CMS Suite : Notifications Plugin
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
This module is expected to contain plugin definitions for the generations of notifications upon certain Lifecycle events.
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
* [OpenJDK](https://openjdk.java.net/) - The JDK used
@ -11,8 +14,8 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log

View File

@ -5,14 +5,14 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>notifications-plugins</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<name>gCube CMS - Notifications Plugins</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<properties>

View File

@ -9,7 +9,7 @@
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<packaging>pom</packaging>
<version>1.0.3</version>
<version>1.0.4</version>
<name>Gcube CMS Suite</name>
<description>gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.</description>
@ -26,17 +26,15 @@
<gcube-smartgears-bom-version>2.1.1</gcube-smartgears-bom-version>
<gcube-portal-bom-version>3.6.3</gcube-portal-bom-version>
<storagehub-version-range>[1.0.0,2.0.0-SNAPSHOT)</storagehub-version-range>
<plugin-framework-version>1.0.1</plugin-framework-version>
<!--dev -->
<!-- <gcube-bom-version>2.1.0-SNAPSHOT</gcube-bom-version>-->
<!-- <gcube-smartgears-bom-version>2.2.0-SNAPSHOT</gcube-smartgears-bom-version>-->
<!-- <gcube-portal-bom-version>3.7.0-SNAPSHOT</gcube-portal-bom-version>-->
<!-- <storagehub-version-range>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</storagehub-version-range>-->
<!--&lt;!&ndash; <storagehub-version-range>[1.0.0,2.0.0-SNAPSHOT)</storagehub-version-range>&ndash;&gt;-->
<!-- <plugin-framework-version>1.0.2-SNAPSHOT</plugin-framework-version>-->
<plugin-framework-version>1.0.3</plugin-framework-version>
</properties>

View File

@ -1,8 +1,7 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.sdi-plugins
This library contains gcube-cms plugins for indexing and materializations in gCube SDI
## [v1.0.2] - 2023-01-10
- Pom updates
## [v1.0.1] - 2022-12-07
- Pom updates
@ -10,3 +9,5 @@ This library contains gcube-cms plugins for indexing and materializations in gCu
## [v1.0.0] - 2022-02-24
- First release
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,15 +1,22 @@
gCube CMS Suite : SDI Plugins
--------------------------------------------------
[gCube CMS Suite](../) module containing references, documentation, guides ad utilities.
This module contains definition of the following plugins :
- SDIIndexerPlugin : indexes Projects in centroid layers in gCube SDI (requires PostGIS DB)
- SDIMaterializerPlugin : materializes layers in gCube SDI (currenlty supported TIF and SHP)
It uses the SDI in the context of the caller, and requires :
- GeoServer
- Postgis DB registered in Geoserver (indexing only)
## Built with
* [gCube SDI] (https://gcube.wiki.gcube-system.org/gcube/) - The gCube SDI
* [OpenJDK](https://openjdk.java.net/) - The JDK used
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
* [Dedicated Wiki](https://sublime-and-sphinx-guide.readthedocs.io) - TBD Powered by [Sphynx](https://www.sphinx-doc.org/en/master/)
* [Service Interactive API]() -TBD Powered by [Enunciate](http://enunciate.webcohesion.com/)
* [Gcube System Wiki](https://gcube.wiki.gcube-system.org/gcube/GeoPortal).
* [Guide Notebooks](../use-cases) - Powered by [Jupyter](https://jupyter.org/)
* [Service Wiki src](../use-cases/src/site/suite.rst)
[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities.
## Change log

View File

@ -5,14 +5,14 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>sdi-plugins</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<name>gCube CMS - SDI Plugins</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<properties>

View File

@ -5,6 +5,7 @@ import lombok.Data;
import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.cms.implementations.utils.UserUtils;
import org.gcube.application.cms.plugins.MaterializationPlugin;
import org.gcube.application.cms.plugins.faults.InitializationException;
import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException;
@ -47,7 +48,9 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa
private SDIManagerWrapper getSDIManager(){
return sdiManagerMap.get(ContextUtils.getCurrentScope());
String context = UserUtils.getCurrent().getContext();
log.debug("Getting SDIManagerWrapper from cache map for context {}");
return sdiManagerMap.get(context);
}
@Override
@ -55,7 +58,7 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa
public InitializationReport initInContext() throws InitializationException {
InitializationReport report = new InitializationReport();
try{
String context = ContextUtils.getCurrentScope();
String context = UserUtils.getCurrent().getContext();
if(getSDIManager()==null) {
log.info("Initializing in " + context);
sdiManagerMap.put(context,new SDIManagerWrapper());

View File

@ -1,6 +1,7 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.use-cases
# Changelog for org.gcube.application.geoportal-client
## [v1.0.4] - 2023-01-10
- Pom updates
## [v1.0.3] - 2022-12-07
- Pom updates
@ -12,4 +13,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Updated parent
## [v1.0.0] - 2021-09-20
- First release, extracted from client
- First release, extracted from client
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -1,19 +1,18 @@
gCube CMS Suite : Use cases
--------------------------------------------------
[gCube CMS Suite](../README.md) module containing references, documentation, guides ad utilities.
This module contains utilities for the management of gCube CMS Suite instances, such as :
- Environment Checks
- Import / Export facilities
- WS Report features
- Stress test
- Collection removal
## Documentation
* [Dedicated Wiki](https://sublime-and-sphinx-guide.readthedocs.io) - TBD Powered by [Sphynx] (https://www.sphinx-doc.org/en/master/)
* [Service Interactive API]() -TBD Powered by [Enunciate] (http://enunciate.webcohesion.com/)
* [Gcube System Wiki] - (https://gcube.wiki.gcube-system.org/gcube/GeoPortal).
* [Guide Notebooks](use-cases) - Powered by [Jupyter] (https://jupyter.org/)
* [Service Wiki src] (use-cases/src/site/suite.rst)
[gCube CMS Suite](../README.md) module containing references, documentation, guides ad utilities.
## Change log
See [CHANGELOG.md](CHANGELOG.md).
## License

View File

@ -4,12 +4,12 @@
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>
<artifactId>use-cases</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<name>CMS Use cases</name>
<parent>
<artifactId>gcube-cms-suite</artifactId>
<groupId>org.gcube.application.cms</groupId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

View File

@ -250,6 +250,9 @@ public class ExportConcessioniAsProjects {
+ "[?(@.fileset)]");
req.addAll(convertFiles(content));
req.setAccess(getAccess(rel));
project = client.registerFileSet(project.getId(),req.getTheRequest());
}
// upload fileset

View File

@ -0,0 +1,56 @@
package org.gcube.application.cms.usecases;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.client.UseCaseDescriptors;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.Assert;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicLong;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
import static org.junit.Assume.assumeTrue;
public class GenericChecks {
UseCaseDescriptorsI getClient(){
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
TokenSetter.set(GCubeTest.getContext());
return useCaseDescriptors().build();
}
@Test
public void getAll() throws Exception {
UseCaseDescriptorsI client =getClient();
QueryRequest request = new QueryRequest();
// All
client.query(request).forEachRemaining(u -> {
try {
System.out.println("Obtained UCD "+u.getId());
client.getById(u.getId()).getId();
Projects pClient = (Projects)projects(u.getId()).build();
AtomicLong counter=new AtomicLong(0);
pClient.query(new QueryRequest()).forEachRemaining( M -> counter.incrementAndGet());
System.out.println("Found "+counter.get()+" elements");
} catch (Exception e) {
e.printStackTrace(System.err);
Assert.fail("Unable to check "+u.getId());
}
});
}
}