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>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-smartgears-bom</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.5.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</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.ServiceCKANDB;
|
||||
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.relations.ConsistsOfImpl;
|
||||
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.AddConstraint;
|
||||
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.Vault;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||
|
@ -249,7 +247,7 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
|||
propagationConstraint.setRemoveConstraint(RemoveConstraint.keep);
|
||||
propagationConstraint.setDeleteConstraint(DeleteConstraint.keep);
|
||||
EService gcatEService = new EServiceImpl();
|
||||
gcatEService.setHeader(new HeaderImpl(gcatEServiceUUID));
|
||||
gcatEService.setID(gcatEServiceUUID);
|
||||
VirtualService virtualService = queryVirtualService();
|
||||
callsFor = new CallsForImpl<EService, VirtualService>(gcatEService, virtualService, propagationConstraint);
|
||||
callsFor = resourceRegistryPublisher.create(callsFor);
|
||||
|
@ -337,9 +335,8 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
|||
}
|
||||
|
||||
protected ServiceCatalogueConfiguration setConfigurationInfoFromSimpleFacet(SimpleFacet configurationSimpleFacet, ServiceCatalogueConfiguration catalogueConfiguration) throws Exception {
|
||||
Header header = configurationSimpleFacet.getHeader();
|
||||
if(header!=null && header.getUUID()!=null) {
|
||||
catalogueConfiguration.setID(header.getUUID().toString());
|
||||
if(configurationSimpleFacet.getID()!=null) {
|
||||
catalogueConfiguration.setID(configurationSimpleFacet.getID().toString());
|
||||
}
|
||||
|
||||
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 {
|
||||
AccessPointFacet ckanServiceAccessPointFacet = queryCkanServiceAccessPointFacet();
|
||||
catalogueConfiguration.setCkanURL(ckanServiceAccessPointFacet.getEndpoint().toString());
|
||||
Vault vault = (Vault) ckanServiceAccessPointFacet.getAdditionalProperty(CatalogueConfiguration.SYS_ADMIN_TOKEN_KEY);
|
||||
String encryptedPassword = vault.getValue();
|
||||
Encrypted encrypted = (Encrypted) ckanServiceAccessPointFacet.getAdditionalProperty(CatalogueConfiguration.SYS_ADMIN_TOKEN_KEY);
|
||||
String encryptedPassword = encrypted.getValue();
|
||||
catalogueConfiguration.setSysAdminToken(encryptedPassword);
|
||||
return catalogueConfiguration;
|
||||
}
|
||||
|
@ -397,8 +394,8 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
|||
ServiceCKANDB ckanDB = new ServiceCKANDB();
|
||||
String ckanDbURL = postgresCkanDBAccessPointFacet.getEndpoint().toString();
|
||||
ckanDB.setUrl(ckanDbURL);
|
||||
Vault vault = (Vault) postgresCkanDBAccessPointFacet.getAdditionalProperty(ServiceCKANDB.PASSWORD_KEY);
|
||||
String encryptedPassword = vault.getValue();
|
||||
Encrypted encrypted = (Encrypted) postgresCkanDBAccessPointFacet.getAdditionalProperty(ServiceCKANDB.PASSWORD_KEY);
|
||||
String encryptedPassword = encrypted.getValue();
|
||||
ckanDB.setEncryptedPassword(encryptedPassword);
|
||||
String username = (String) postgresCkanDBAccessPointFacet.getAdditionalProperty(ServiceCKANDB.USERNAME_KEY);
|
||||
ckanDB.setUsername(username);
|
||||
|
@ -419,7 +416,7 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
|||
UUID uuid = null;
|
||||
try {
|
||||
uuid = UUID.fromString(catalogueConfiguration.getID());
|
||||
simpleFacet.getHeader().setUUID(uuid);
|
||||
simpleFacet.setID(uuid);
|
||||
}catch (Exception e) {
|
||||
|
||||
}
|
||||
|
@ -477,14 +474,14 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
|||
try {
|
||||
resourceRegistryPublisher.delete(simpleFacet);
|
||||
} 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
|
||||
protected ServiceCatalogueConfiguration createOnIS() throws Exception {
|
||||
UUID uuid = configurationSimpleFacet.getHeader().getUUID();
|
||||
UUID uuid = configurationSimpleFacet.getID();
|
||||
if(uuid==null) {
|
||||
Configuration gcatConfiguration = queryGcatConfiguration();
|
||||
ConsistsOf<Configuration, SimpleFacet> co = new ConsistsOfImpl<>(gcatConfiguration, configurationSimpleFacet);
|
||||
|
@ -509,8 +506,7 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
|||
|
||||
@Override
|
||||
protected ServiceCatalogueConfiguration updateOnIS() throws Exception {
|
||||
Header header = configurationSimpleFacet.getHeader();
|
||||
if(header!=null && header.getUUID()!=null) {
|
||||
if(configurationSimpleFacet.getID()!=null) {
|
||||
configurationSimpleFacet = getSimpleFacetFromConfiguration(catalogueConfiguration);
|
||||
configurationSimpleFacet = resourceRegistryPublisher.update(configurationSimpleFacet);
|
||||
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>
|
||||
* <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>
|
||||
* <dl>
|
||||
* <dt>q (string)</dt>
|
||||
|
|
|
@ -28,5 +28,5 @@
|
|||
"fullname": "Brown Mister",
|
||||
"id": "7445ef41-08d8-4559-8750-3232eb0e1914",
|
||||
"number_created_packages": 0
|
||||
},
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue