Migrated code to new is-model
This commit is contained in:
parent
08e7fd0ea9
commit
2b3cf622b0
2
pom.xml
2
pom.xml
|
@ -35,7 +35,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>gcube-smartgears-bom</artifactId>
|
<artifactId>gcube-smartgears-bom</artifactId>
|
||||||
<version>2.4.0</version>
|
<version>2.5.0-SNAPSHOT</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -21,16 +21,14 @@ import org.gcube.gcat.api.configuration.CatalogueConfiguration;
|
||||||
import org.gcube.gcat.configuration.service.FacetBasedISServiceCatalogueConfiguration;
|
import org.gcube.gcat.configuration.service.FacetBasedISServiceCatalogueConfiguration;
|
||||||
import org.gcube.gcat.configuration.service.ServiceCKANDB;
|
import org.gcube.gcat.configuration.service.ServiceCKANDB;
|
||||||
import org.gcube.gcat.configuration.service.ServiceCatalogueConfiguration;
|
import org.gcube.gcat.configuration.service.ServiceCatalogueConfiguration;
|
||||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
|
||||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||||
import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl;
|
import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl;
|
||||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
import org.gcube.informationsystem.model.reference.properties.Encrypted;
|
||||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
|
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
|
||||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.DeleteConstraint;
|
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.DeleteConstraint;
|
||||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
|
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
|
||||||
import org.gcube.informationsystem.model.reference.properties.Vault;
|
|
||||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||||
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
|
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||||
|
@ -249,7 +247,7 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
||||||
propagationConstraint.setRemoveConstraint(RemoveConstraint.keep);
|
propagationConstraint.setRemoveConstraint(RemoveConstraint.keep);
|
||||||
propagationConstraint.setDeleteConstraint(DeleteConstraint.keep);
|
propagationConstraint.setDeleteConstraint(DeleteConstraint.keep);
|
||||||
EService gcatEService = new EServiceImpl();
|
EService gcatEService = new EServiceImpl();
|
||||||
gcatEService.setHeader(new HeaderImpl(gcatEServiceUUID));
|
gcatEService.setID(gcatEServiceUUID);
|
||||||
VirtualService virtualService = queryVirtualService();
|
VirtualService virtualService = queryVirtualService();
|
||||||
callsFor = new CallsForImpl<EService, VirtualService>(gcatEService, virtualService, propagationConstraint);
|
callsFor = new CallsForImpl<EService, VirtualService>(gcatEService, virtualService, propagationConstraint);
|
||||||
callsFor = resourceRegistryPublisher.create(callsFor);
|
callsFor = resourceRegistryPublisher.create(callsFor);
|
||||||
|
@ -337,9 +335,8 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ServiceCatalogueConfiguration setConfigurationInfoFromSimpleFacet(SimpleFacet configurationSimpleFacet, ServiceCatalogueConfiguration catalogueConfiguration) throws Exception {
|
protected ServiceCatalogueConfiguration setConfigurationInfoFromSimpleFacet(SimpleFacet configurationSimpleFacet, ServiceCatalogueConfiguration catalogueConfiguration) throws Exception {
|
||||||
Header header = configurationSimpleFacet.getHeader();
|
if(configurationSimpleFacet.getID()!=null) {
|
||||||
if(header!=null && header.getUUID()!=null) {
|
catalogueConfiguration.setID(configurationSimpleFacet.getID().toString());
|
||||||
catalogueConfiguration.setID(header.getUUID().toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catalogueConfiguration.setModerationEnabled((boolean) configurationSimpleFacet.getAdditionalProperty(CatalogueConfiguration.MODERATION_ENABLED_KEY));
|
catalogueConfiguration.setModerationEnabled((boolean) configurationSimpleFacet.getAdditionalProperty(CatalogueConfiguration.MODERATION_ENABLED_KEY));
|
||||||
|
@ -386,8 +383,8 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
||||||
public ServiceCatalogueConfiguration setCkanServiceInfo(ServiceCatalogueConfiguration catalogueConfiguration) throws Exception {
|
public ServiceCatalogueConfiguration setCkanServiceInfo(ServiceCatalogueConfiguration catalogueConfiguration) throws Exception {
|
||||||
AccessPointFacet ckanServiceAccessPointFacet = queryCkanServiceAccessPointFacet();
|
AccessPointFacet ckanServiceAccessPointFacet = queryCkanServiceAccessPointFacet();
|
||||||
catalogueConfiguration.setCkanURL(ckanServiceAccessPointFacet.getEndpoint().toString());
|
catalogueConfiguration.setCkanURL(ckanServiceAccessPointFacet.getEndpoint().toString());
|
||||||
Vault vault = (Vault) ckanServiceAccessPointFacet.getAdditionalProperty(CatalogueConfiguration.SYS_ADMIN_TOKEN_KEY);
|
Encrypted encrypted = (Encrypted) ckanServiceAccessPointFacet.getAdditionalProperty(CatalogueConfiguration.SYS_ADMIN_TOKEN_KEY);
|
||||||
String encryptedPassword = vault.getValue();
|
String encryptedPassword = encrypted.getValue();
|
||||||
catalogueConfiguration.setSysAdminToken(encryptedPassword);
|
catalogueConfiguration.setSysAdminToken(encryptedPassword);
|
||||||
return catalogueConfiguration;
|
return catalogueConfiguration;
|
||||||
}
|
}
|
||||||
|
@ -397,8 +394,8 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
||||||
ServiceCKANDB ckanDB = new ServiceCKANDB();
|
ServiceCKANDB ckanDB = new ServiceCKANDB();
|
||||||
String ckanDbURL = postgresCkanDBAccessPointFacet.getEndpoint().toString();
|
String ckanDbURL = postgresCkanDBAccessPointFacet.getEndpoint().toString();
|
||||||
ckanDB.setUrl(ckanDbURL);
|
ckanDB.setUrl(ckanDbURL);
|
||||||
Vault vault = (Vault) postgresCkanDBAccessPointFacet.getAdditionalProperty(ServiceCKANDB.PASSWORD_KEY);
|
Encrypted encrypted = (Encrypted) postgresCkanDBAccessPointFacet.getAdditionalProperty(ServiceCKANDB.PASSWORD_KEY);
|
||||||
String encryptedPassword = vault.getValue();
|
String encryptedPassword = encrypted.getValue();
|
||||||
ckanDB.setEncryptedPassword(encryptedPassword);
|
ckanDB.setEncryptedPassword(encryptedPassword);
|
||||||
String username = (String) postgresCkanDBAccessPointFacet.getAdditionalProperty(ServiceCKANDB.USERNAME_KEY);
|
String username = (String) postgresCkanDBAccessPointFacet.getAdditionalProperty(ServiceCKANDB.USERNAME_KEY);
|
||||||
ckanDB.setUsername(username);
|
ckanDB.setUsername(username);
|
||||||
|
@ -419,7 +416,7 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
try {
|
try {
|
||||||
uuid = UUID.fromString(catalogueConfiguration.getID());
|
uuid = UUID.fromString(catalogueConfiguration.getID());
|
||||||
simpleFacet.getHeader().setUUID(uuid);
|
simpleFacet.setID(uuid);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -477,14 +474,14 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
||||||
try {
|
try {
|
||||||
resourceRegistryPublisher.delete(simpleFacet);
|
resourceRegistryPublisher.delete(simpleFacet);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new InternalServerErrorException("Unable to delete SimpleFacet with UUID " + simpleFacet.getHeader().getUUID().toString(), e);
|
throw new InternalServerErrorException("Unable to delete SimpleFacet with UUID " + simpleFacet.getID().toString(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ServiceCatalogueConfiguration createOnIS() throws Exception {
|
protected ServiceCatalogueConfiguration createOnIS() throws Exception {
|
||||||
UUID uuid = configurationSimpleFacet.getHeader().getUUID();
|
UUID uuid = configurationSimpleFacet.getID();
|
||||||
if(uuid==null) {
|
if(uuid==null) {
|
||||||
Configuration gcatConfiguration = queryGcatConfiguration();
|
Configuration gcatConfiguration = queryGcatConfiguration();
|
||||||
ConsistsOf<Configuration, SimpleFacet> co = new ConsistsOfImpl<>(gcatConfiguration, configurationSimpleFacet);
|
ConsistsOf<Configuration, SimpleFacet> co = new ConsistsOfImpl<>(gcatConfiguration, configurationSimpleFacet);
|
||||||
|
@ -509,8 +506,7 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ServiceCatalogueConfiguration updateOnIS() throws Exception {
|
protected ServiceCatalogueConfiguration updateOnIS() throws Exception {
|
||||||
Header header = configurationSimpleFacet.getHeader();
|
if(configurationSimpleFacet.getID()!=null) {
|
||||||
if(header!=null && header.getUUID()!=null) {
|
|
||||||
configurationSimpleFacet = getSimpleFacetFromConfiguration(catalogueConfiguration);
|
configurationSimpleFacet = getSimpleFacetFromConfiguration(catalogueConfiguration);
|
||||||
configurationSimpleFacet = resourceRegistryPublisher.update(configurationSimpleFacet);
|
configurationSimpleFacet = resourceRegistryPublisher.update(configurationSimpleFacet);
|
||||||
setConfigurationInfoFromSimpleFacet(configurationSimpleFacet, catalogueConfiguration);
|
setConfigurationInfoFromSimpleFacet(configurationSimpleFacet, catalogueConfiguration);
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
|
||||||
*
|
*
|
||||||
* <h4>Filtering options based on Solr query parameters</h4>
|
* <h4>Filtering options based on Solr query parameters</h4>
|
||||||
* <p>
|
* <p>
|
||||||
* It accepts the following query parameters (a subset of Solr search query parameters, see Solr Query Syntax):
|
* It accepts the following query parameters (a subset of Solr search query parameters, see {@see <a href="https://solrtutorial.com/solr-query-syntax.html">Solr Query Syntax</a>}):
|
||||||
* </p>
|
* </p>
|
||||||
* <dl>
|
* <dl>
|
||||||
* <dt>q (string)</dt>
|
* <dt>q (string)</dt>
|
||||||
|
|
|
@ -28,5 +28,5 @@
|
||||||
"fullname": "Brown Mister",
|
"fullname": "Brown Mister",
|
||||||
"id": "7445ef41-08d8-4559-8750-3232eb0e1914",
|
"id": "7445ef41-08d8-4559-8750-3232eb0e1914",
|
||||||
"number_created_packages": 0
|
"number_created_packages": 0
|
||||||
},
|
}
|
||||||
]
|
]
|
Loading…
Reference in New Issue