Compare commits

..

No commits in common. "master" and "feature_22506" have entirely different histories.

115 changed files with 3659 additions and 11149 deletions

View File

@ -1,11 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.7"/>
<installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.8"/>
</faceted-project>

View File

@ -4,64 +4,8 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.3.0]
- Read countByPhase from configuration [#25598]
- Reduced/Optimized some LOGs [#25539]
## [v2.2.0]
- Integrated the cross-filtering configuration [#25074]
- Integrated the overlay layers configuration [#25110]
## [v2.1.0] - 2023-05-11
- Integrated the deleteFileset method [#24977]
- Integrated with the Geoportal_Resolver service [#25031]
## [v2.0.3] - 2023-02-09
#### Enhancements
- [#24569] Added the phase DRAFT in the enum (also required for #24571)
## [v2.0.2] - 2022-02-03
#### Enhancements
- [#24432] Reverted serialization from Sting to Object values returning the Document as Map
- [#24475] Propagated the Access Policy in the fileset
## [v2.0.1] - 2022-01-19
#### Bug fixes
- [#24263] Fixing JSON library v20090211
- [#24432] Fixing serialization issue using LinkedHashMap<String, String> instead of LinkedHashMap<String, Object>.
- [#24432] Added a trim for returning value to solve a space as suffix into returned date (fixing the data displayed in the Timeline Widget)
## [v2.0.0] - 2022-11-17
#### Enhancements
- [#22883] Integrated the configurations exposed by (the new) geoportal-client (>= 1.1.0-SNAPSHOT)
- Passed to UCD/Projects geoportal client/service
- [#23835] Integrated with WORKFLOW_ACTION_LIST_GUI configuration
- [#23909] Declared lombok required for JDK_11
- [#23913] Integrated with GUI presentation configurations read from IS
- [#23927] Integrated with Relationship definition in UCD
- [#23834] Integrated with the create/view/delete Relationship facility
- [#24136] Integrated the temporal dimension on the front-end side
- [#24458] Published projects cannot be edited/updated
## [v1.4.0] - 2022-06-08
#### Enhancements
- [#23392] Implemented the "Clone Project" facility
- [#23457] Implemented the "Publish/UnPublish Project" facility
## [v1.3.0] - 2021-12-03
## [v1.3.0-SNAPSHOT] - 2021-12-03
#### Enhancements

View File

@ -1,6 +1,6 @@
# GeoPortal Data Common
GeoPortal Data Common is a common library used by GUI components developed for the Geoportal
GeoPortal Data Common is a common library used by GUI components developed for GeoNA
## Built With

40
pom.xml
View File

@ -5,12 +5,12 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.2.0</version>
<version>1.1.0</version>
</parent>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>
<version>2.3.0</version>
<version>1.3.0-SNAPSHOT</version>
<description>GeoPortal Data Common is common library used by GUI components developed for GeoNA</description>
<scm>
@ -32,7 +32,7 @@
</developers>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
@ -41,7 +41,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>2.3.0</version>
<version>2.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -68,7 +68,7 @@
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId>
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@ -80,36 +80,15 @@
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>uri-resolver-manager</artifactId>
<artifactId>gcube-url-shortener</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
<scope>compile</scope>
</dependency>
<!-- REQUIRED FOR JDK_11 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<!-- LOGGER -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
<!-- JUNIT -->
@ -120,13 +99,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1212</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -1,71 +0,0 @@
package org.gcube.application.geoportalcommon;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.access.AccessPolicy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
/**
* The Class ConvertToDataServiceModel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Feb 3, 2023
*/
public class ConvertToDataServiceModel {
private static Logger LOG = LoggerFactory.getLogger(ConvertToDataServiceModel.class);
/**
* Gets the access from document section.
*
* @param theJSONDocument the the JSON document
* @param sectionJSONPath the section JSON path
* @return the access from document section
*/
public static Access getAccessFromDocumentSection(String theJSONDocument, String sectionJSONPath) {
String accessPolicyPath = String.format("%s.%s", sectionJSONPath, ConvertToDataValueObjectModel.POLICY);
AccessPolicy accessPolicy = null;
com.jayway.jsonpath.Configuration config = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build();
// Reading policy fields
try {
JsonPath theSectionPolycJsonPath = JsonPath.compile(accessPolicyPath);
String policy = theSectionPolycJsonPath.read(theJSONDocument, config).toString();
LOG.debug("Read " + ConvertToDataValueObjectModel.POLICY + ": " + policy + ", from section: "
+ accessPolicyPath);
if (policy != null) {
accessPolicy = AccessPolicy.valueOf(policy.toUpperCase());
}
} catch (Exception e) {
LOG.info("No " + ConvertToDataValueObjectModel.POLICY + " found in the path: " + accessPolicyPath);
}
// Reading policy fields
String licenseIDPath = String.format("%s.%s", sectionJSONPath, ConvertToDataValueObjectModel.LICENSE_ID);
String licenseID = null;
try {
JsonPath theSectionLicenseJsonPath = JsonPath.compile(licenseIDPath);
licenseID = theSectionLicenseJsonPath.read(theJSONDocument, config).toString();
LOG.debug("Read " + ConvertToDataValueObjectModel.LICENSE_ID + ": " + licenseID + ", from section: "
+ licenseIDPath);
} catch (Exception e) {
LOG.info("No " + ConvertToDataValueObjectModel.LICENSE_ID + " found in the path: " + licenseIDPath);
}
Access access = new Access();
if (accessPolicy != null)
access.setPolicy(accessPolicy);
if (licenseID != null)
access.setLicense(licenseID);
LOG.info("Access is: " + access.getPolicy() + " / " + access.getLicense());
return access;
}
}

View File

@ -1,10 +1,36 @@
package org.gcube.application.geoportalcommon;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
import org.gcube.application.geoportal.common.model.legacy.BBOX;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.common.model.legacy.OtherContent;
import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.content.OtherContentDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus;
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
import org.gcube.application.geoportalcommon.util.DateUtils;
import org.gcube.application.geoportalcommon.util.URLParserUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -22,12 +48,257 @@ public class ConvertToDataViewModel {
/** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(ConvertToDataViewModel.class);
public static final String DATE_FORMAT = "yyyy-MM-dd";
public static final String DATE_FORMAT = "dd-MM-yyyy";
public static final String HOURS_MINUTES_SEPARATOR = ":";
public static final String TIME_FORMAT = "HH" + HOURS_MINUTES_SEPARATOR + "mm";
/**
* To concessione.
*
* @param concessione the concessione
* @return the concessione
* @throws Exception the exception
*/
public static ConcessioneDV toConcessione(Concessione concessione) throws Exception {
LOG.debug("toConcessione called");
if (concessione == null)
return null;
LOG.debug("toConcessione called for concessione with mongoId: " + concessione.getMongo_id());
if (LOG.isTraceEnabled())
LOG.trace("Source concessione is: " + concessione);
try {
ConcessioneDV theConcessione = new ConcessioneDV();
theConcessione.setPolicy(toPolicy(concessione.getPolicy()));
theConcessione.setAuthors(concessione.getAuthors());
theConcessione.setCentroidLat(concessione.getCentroidLat());
theConcessione.setCentroidLong(concessione.getCentroidLong());
theConcessione.setContributore(concessione.getContributore());
theConcessione.setCreationTime(DateUtils.asDate(concessione.getCreationTime()));
theConcessione.setCreationUser(toUser(concessione.getCreationUser()));
theConcessione.setDataInizioProgetto(DateUtils.asDate(concessione.getDataInizioProgetto()));
theConcessione.setDataFineProgetto(DateUtils.asDate(concessione.getDataFineProgetto()));
theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
theConcessione.setEditore(concessione.getEditore());
theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
theConcessione.setItemId(concessione.getMongo_id());
theConcessione.setNome(concessione.getNome());
theConcessione.setIntroduzione(concessione.getIntroduzione());
theConcessione.setLastUpdateTime(DateUtils.asDate(concessione.getLastUpdateTime()));
theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
theConcessione.setLicenzaID(concessione.getLicenzaID());
theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
theConcessione.setResponsabile(concessione.getResponsabile());
theConcessione.setRisorseCorrelate(concessione.getRisorseCorrelate());
theConcessione.setSoggetto(concessione.getSoggetto());
theConcessione.setTitolariCopyright(concessione.getTitolareCopyright());
theConcessione.setTitolariLicenza(concessione.getTitolareLicenza());
theConcessione.setTitolari(concessione.getTitolari());
theConcessione.setVersion(concessione.getVersion());
theConcessione.setRecordType(concessione.getRecordType().name());
theConcessione.setAbstractRelazioneScavo(toAbstractRelazioneScavo(concessione.getAbstractRelazione()));
theConcessione.setRelazioneScavo(toRelazioneScavo(concessione.getRelazioneScavo()));
if (concessione.getImmaginiRappresentative() != null) {
List<UploadedImageDV> uploadedImagesDV = new ArrayList<UploadedImageDV>(
concessione.getImmaginiRappresentative().size());
for (UploadedImage ui : concessione.getImmaginiRappresentative()) {
uploadedImagesDV.add(toUploadedImage(ui));
}
theConcessione.setImmaginiRappresentative(uploadedImagesDV);
}
if (concessione.getGenericContent() != null) {
List<OtherContentDV> otherContentsDV = new ArrayList<OtherContentDV>(
concessione.getGenericContent().size());
for (OtherContent gc : concessione.getGenericContent()) {
otherContentsDV.add(toOtherContentDV(gc));
}
theConcessione.setGenericContent(otherContentsDV);
}
if (concessione.getPianteFineScavo() != null) {
List<LayerConcessioneDV> piantaScavoDV = new ArrayList<LayerConcessioneDV>(
concessione.getPianteFineScavo().size());
for (LayerConcessione lc : concessione.getPianteFineScavo()) {
// TODO CHECK WHY I HAVE TO PASS theConcessione = null IN ORDER TO AVOID GWT
// serialization error
piantaScavoDV.add(toLayerConcessione(lc, null));
}
theConcessione.setPianteFineScavo(piantaScavoDV);
}
if (concessione.getPosizionamentoScavo() != null) {
// TODO CHECK WHY I HAVE TO PASS theConcessione = null IN ORDER TO AVOID GWT
// serialization error
LayerConcessioneDV thePosizScavo = toLayerConcessione(concessione.getPosizionamentoScavo(), null);
theConcessione.setPosizionamentoScavo(thePosizScavo);
}
LOG.debug("Returning concessioneDV with id: " + theConcessione.getItemId());
if (LOG.isTraceEnabled())
LOG.trace("Returning: " + theConcessione);
return theConcessione;
} catch (Exception e) {
LOG.error("Error on converting concessione: " + concessione, e);
return null;
}
}
/**
* To metadata concessione.
*
* @param concessione the concessione
* @param includeValidationReport the include validation report
* @return the concessione DV
* @throws Exception the exception
*/
public static ConcessioneDV toMetadataConcessione(Concessione concessione, boolean includeValidationReport)
throws Exception {
LOG.debug("toMetadataConcessione called");
if (concessione == null)
return null;
LOG.debug("toMetadataConcessione called for concessione with [mongoId: " + concessione.getMongo_id()
+ ", includeValidationReport: " + includeValidationReport + "]");
if (LOG.isTraceEnabled())
LOG.trace("Source concessione is: " + concessione);
try {
ConcessioneDV theConcessione = new ConcessioneDV();
theConcessione.setPolicy(toPolicy(concessione.getPolicy()));
theConcessione.setCentroidLat(concessione.getCentroidLat());
theConcessione.setCentroidLong(concessione.getCentroidLong());
theConcessione.setContributore(concessione.getContributore());
theConcessione.setCreationTime(DateUtils.asDate(concessione.getCreationTime()));
theConcessione.setCreationUser(toUser(concessione.getCreationUser()));
theConcessione.setDataInizioProgetto(DateUtils.asDate(concessione.getDataInizioProgetto()));
theConcessione.setDataFineProgetto(DateUtils.asDate(concessione.getDataFineProgetto()));
theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
theConcessione.setEditore(concessione.getEditore());
theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
theConcessione.setItemId(concessione.getMongo_id());
theConcessione.setNome(concessione.getNome());
theConcessione.setAuthors(concessione.getAuthors());
theConcessione.setCreationTime(DateUtils.asDate(concessione.getCreationTime()));
theConcessione.setIntroduzione(concessione.getIntroduzione());
theConcessione.setLastUpdateTime(DateUtils.asDate(concessione.getLastUpdateTime()));
theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
theConcessione.setLicenzaID(concessione.getLicenzaID());
theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
theConcessione.setResponsabile(concessione.getResponsabile());
theConcessione.setTitolariCopyright(concessione.getTitolareCopyright());
theConcessione.setTitolariLicenza(concessione.getTitolareLicenza());
theConcessione.setTitolari(concessione.getTitolari());
if (includeValidationReport) {
theConcessione.setValidationReport(toValidationReport(concessione.getReport()));
if (theConcessione.getValidationReport() != null)
theConcessione.setValidationStatus(theConcessione.getValidationReport().getStatus());
}
LOG.info("Returning concessioneDV with id: " + theConcessione.getItemId());
if (LOG.isTraceEnabled())
LOG.trace("Returning: " + theConcessione);
return theConcessione;
} catch (Exception e) {
LOG.error("Error on converting concessione: " + concessione, e);
return null;
}
}
/**
* To validation report.
*
* @param validationReport the validation report
* @return the validation report DV
* @throws Exception the exception
*/
public static ValidationReportDV toValidationReport(ValidationReport validationReport) throws Exception {
LOG.debug("toValidationReport called");
if (validationReport == null)
return null;
LOG.debug("toValidationReport called for: "+validationReport);
ValidationReportDV theVR = new ValidationReportDV();
theVR.setErrorMessages(validationReport.getErrorMessages());
theVR.setObjectName(validationReport.getObjectName());
theVR.setStatus(ValidationStatus.valueOf(validationReport.getStatus().name()));
theVR.setWarningMessages(validationReport.getWarningMessages());
theVR.setAsJSONString(toJSON(validationReport));
LOG.debug("Returning: "+theVR);
return theVR;
}
/**
* To base concessione.
*
* @param concessione the concessione
* @return the concessione DV
* @throws Exception the exception
*/
public static BaseConcessioneDV toBaseConcessione(Concessione concessione) throws Exception {
LOG.debug("toBaseConcessione called");
if (concessione == null)
return null;
LOG.debug("toBaseConcessione called for concessione with mongoId: " + concessione.getMongo_id());
if (LOG.isTraceEnabled())
LOG.trace("Source concessione is: " + concessione);
try {
BaseConcessioneDV theConcessione = new BaseConcessioneDV();
theConcessione.setPolicy(toPolicy(concessione.getPolicy()));
theConcessione.setCreationTime(DateUtils.asDate(concessione.getCreationTime()));
theConcessione.setCreationUser(toUser(concessione.getCreationUser()));
theConcessione.setItemId(concessione.getMongo_id());
theConcessione.setNome(concessione.getNome());
theConcessione.setAuthors(concessione.getAuthors());
theConcessione.setCreationTime(DateUtils.asDate(concessione.getCreationTime()));
theConcessione.setIntroduzione(concessione.getIntroduzione());
theConcessione.setLastUpdateTime(DateUtils.asDate(concessione.getLastUpdateTime()));
theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
theConcessione.setLicenzaID(concessione.getLicenzaID());
LOG.debug("Returning BaseConcessioneDV with id: " + theConcessione.getItemId());
if (LOG.isTraceEnabled())
LOG.trace("Returning: " + theConcessione);
return theConcessione;
} catch (Exception e) {
LOG.error("Error on converting concessione: " + concessione, e);
return null;
}
}
/**
* To user.
*
@ -58,6 +329,292 @@ public class ConvertToDataViewModel {
}
/**
* To date format string.
*
* @param dateTime the date time
* @return the string
*/
public static String toDateFormatString(LocalDateTime dateTime) {
if (dateTime == null)
return null;
String time = dateTime.toString();
DateTimeFormatter formatter = null;
try {
if (!time.endsWith(NO_TIME)) {
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
} else {
time = time.replace(NO_TIME, "");
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
}
} catch (Exception e) {
LOG.warn("Parsing error: ", e);
}
try {
if (formatter != null)
return dateTime.format(formatter);
} catch (Exception e) {
LOG.warn("Date format error: ", e);
}
return dateTime.toString();
}
/**
* To abstract relazione scavo.
*
* @param abstractRelazione the abstract relazione
* @return the abstract relazione scavo DV
*/
public static AbstractRelazioneScavoDV toAbstractRelazioneScavo(AbstractRelazione abstractRelazione) {
LOG.debug("toAbstractRelazioneScavo called");
if (abstractRelazione == null)
return null;
AbstractRelazioneScavoDV theARelDiScavo = new AbstractRelazioneScavoDV();
theARelDiScavo.setAbstractSectionIta(abstractRelazione.getAbstractIta());
theARelDiScavo.setAbstractSectionEng(abstractRelazione.getAbstractEng());
theARelDiScavo.setCreationTime(DateUtils.asDate(abstractRelazione.getCreationTime()));
theARelDiScavo.setId(abstractRelazione.getId());
theARelDiScavo.setLicenseID(abstractRelazione.getLicenseID());
theARelDiScavo.setPolicy(toPolicy(abstractRelazione.getPolicy()));
theARelDiScavo.setTitolo(abstractRelazione.getTitolo());
List<PersistedContent> actContent = abstractRelazione.getActualContent();
if (actContent != null && actContent.size() > 0) {
List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
for (PersistedContent content : actContent) {
if (content != null && content instanceof WorkspaceContent) {
listWsContent.add(toWorkspaceContent((WorkspaceContent) content));
}
}
theARelDiScavo.setListWsContent(listWsContent);
}
LOG.debug("Returning: " + theARelDiScavo);
return theARelDiScavo;
}
/**
* To relazione scavo.
*
* @param relazioneScavo the relazione scavo
* @return the relazione scavo data view
*/
public static RelazioneScavoDV toRelazioneScavo(RelazioneScavo relazioneScavo) {
LOG.debug("toRelazioneScavo called");
if (relazioneScavo == null)
return null;
RelazioneScavoDV theRelDiScavo = new RelazioneScavoDV();
theRelDiScavo.setCreationTime(DateUtils.asDate(relazioneScavo.getCreationTime()));
theRelDiScavo.setId(relazioneScavo.getId());
theRelDiScavo.setLicenseID(relazioneScavo.getLicenseID());
theRelDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy()));
// theRelazioneDiScavo.setRecord(recordDV);
theRelDiScavo.setResponsabili(relazioneScavo.getResponsabili());
theRelDiScavo.setSoggetto(relazioneScavo.getSoggetto());
theRelDiScavo.setTitolo(relazioneScavo.getTitolo());
List<PersistedContent> actContent = relazioneScavo.getActualContent();
if (actContent != null && actContent.size() > 0) {
List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
for (PersistedContent content : actContent) {
if (content != null && content instanceof WorkspaceContent) {
listWsContent.add(toWorkspaceContent((WorkspaceContent) content));
}
}
theRelDiScavo.setListWsContent(listWsContent);
}
LOG.debug("Returning: " + theRelDiScavo);
return theRelDiScavo;
}
/**
* To uploaded image.
*
* @param uploadedImage the uploaded image
* @return the uploaded image data-view
*/
public static UploadedImageDV toUploadedImage(UploadedImage uploadedImage) {
LOG.debug("toUploadedImage called");
if (uploadedImage == null)
return null;
UploadedImageDV theUploadedImageDV = new UploadedImageDV();
theUploadedImageDV.setCreationTime(DateUtils.asDate(uploadedImage.getCreationTime()));
theUploadedImageDV.setDidascalia(uploadedImage.getDidascalia());
theUploadedImageDV.setFormat(uploadedImage.getFormat());
theUploadedImageDV.setId(uploadedImage.getId());
theUploadedImageDV.setLicenseID(uploadedImage.getLicenseID());
theUploadedImageDV.setPolicy(toPolicy(uploadedImage.getPolicy()));
// theUploadedImageDV.setRecord(recordDV);
theUploadedImageDV.setResponsabili(uploadedImage.getResponsabili());
theUploadedImageDV.setSoggetto(uploadedImage.getSoggetto());
theUploadedImageDV.setTitolo(uploadedImage.getTitolo());
List<PersistedContent> actContent = uploadedImage.getActualContent();
if (actContent != null && actContent.size() > 0) {
List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
for (PersistedContent content : actContent) {
if (content != null && content instanceof WorkspaceContent) {
listWsContent.add(toWorkspaceContent((WorkspaceContent) content));
}
}
theUploadedImageDV.setListWsContent(listWsContent);
}
LOG.debug("Returning: " + theUploadedImageDV);
return theUploadedImageDV;
}
/**
* To workspace content.
*
* @param wContent the w content
* @return the workspace content DV
*/
public static WorkspaceContentDV toWorkspaceContent(WorkspaceContent wContent) {
LOG.debug("toWorkspaceContent called");
if (wContent == null)
return null;
WorkspaceContentDV theWSDV = new WorkspaceContentDV();
theWSDV.setLink(wContent.getLink());
theWSDV.setMimetype(wContent.getMimetype());
theWSDV.setStorageID(wContent.getStorageID());
theWSDV.setId(wContent.getId());
theWSDV.setName(wContent.getName());
return theWSDV;
}
/**
* To layer concessione.
*
* @param layerConcessione the layer concessione
* @param refersToBaseConcessione the refers to base concessione
* @return the layer concessione data view
*/
public static LayerConcessioneDV toLayerConcessione(LayerConcessione layerConcessione,
BaseConcessioneDV refersToBaseConcessione) {
if (layerConcessione == null)
return null;
LOG.debug("Converting: " + layerConcessione);
LayerConcessioneDV theLayerConessione = new LayerConcessioneDV();
theLayerConessione.setAbstractSection(layerConcessione.getAbstractSection());
String wmsLink = layerConcessione.getWmsLink();
String layerName = null;
BoundsMap bounds = null;
// reading layer name from wmsLink
// string bbox
if (wmsLink != null) {
layerName = URLParserUtil.extractValueOfParameterFromURL("layers", wmsLink);
String bbox = URLParserUtil.extractValueOfParameterFromURL("bbox", wmsLink);
String wmsVersion = URLParserUtil.extractValueOfParameterFromURL("version", wmsLink);
bounds = toBoundMap(wmsVersion, bbox, ",");
LOG.debug("Built bounds from wmsLInk: " + bounds);
}
if (layerName != null)
theLayerConessione.setLayerName(layerName);
else
theLayerConessione.setLayerName(layerConcessione.getLayerName());
theLayerConessione.setWmsLink(wmsLink);
theLayerConessione.setLayerID(layerConcessione.getLayerID());
theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID());
theLayerConessione.setAuthors(layerConcessione.getAuthors());
if (bounds == null)
bounds = toBoundMap(layerConcessione.getBbox());
theLayerConessione.setBbox(bounds);
theLayerConessione.setCreationTime(DateUtils.asDate(layerConcessione.getCreationTime()));
theLayerConessione.setId(layerConcessione.getId());
theLayerConessione.setLicenseID(layerConcessione.getLicenseID());
theLayerConessione.setMetodoRaccoltaDati(layerConcessione.getMetodoRaccoltaDati());
theLayerConessione.setPolicy(toPolicy(layerConcessione.getPolicy()));
// theLayerConessione.setRecord(recordDV);
theLayerConessione.setScalaAcquisizione(layerConcessione.getScalaAcquisizione());
theLayerConessione.setSubTopic(layerConcessione.getSubTopic());
theLayerConessione.setTitolo(layerConcessione.getTitolo());
theLayerConessione.setTopicCategory(layerConcessione.getTopicCategory());
theLayerConessione.setValutazioneQualita(layerConcessione.getValutazioneQualita());
theLayerConessione.setRefersTo(refersToBaseConcessione);
List<PersistedContent> actContent = layerConcessione.getActualContent();
if (actContent != null && actContent.size() > 0) {
List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
for (PersistedContent content : actContent) {
if (content != null && content instanceof WorkspaceContent) {
listWsContent.add(toWorkspaceContent((WorkspaceContent) content));
}
}
theLayerConessione.setListWsContent(listWsContent);
}
LOG.debug("Returning: " + theLayerConessione);
return theLayerConessione;
}
/**
* To other content DV.
*
* @param otherContent the other content
* @return the other content DV
*/
public static OtherContentDV toOtherContentDV(OtherContent otherContent) {
if (otherContent == null)
return null;
OtherContentDV theOtherContent = new OtherContentDV();
theOtherContent.setCreationTime(DateUtils.asDate(otherContent.getCreationTime()));
theOtherContent.setId(otherContent.getId());
theOtherContent.setLicenseID(otherContent.getLicenseID());
theOtherContent.setPolicy(toPolicy(otherContent.getPolicy()));
// theOtherContent.setRecord(recordDV);
theOtherContent.setTitolo(otherContent.getTitolo());
return theOtherContent;
}
public static FileSetPathsDV getFileSetPaths() {
LOG.info("readFileSetPaths called");
FileSetPathsDV fsp = new FileSetPathsDV();
List<String> fileSetPaths = new ArrayList<String>();
fileSetPaths.add(Concessione.Paths.ABSTRACT_RELAZIONE);
fileSetPaths.add(Concessione.Paths.RELAZIONE);
fileSetPaths.add(Concessione.Paths.IMMAGINI);
fileSetPaths.add(Concessione.Paths.POSIZIONAMENTO);
fileSetPaths.add(Concessione.Paths.PIANTE);
fsp.setFileSetPaths(fileSetPaths);
return fsp;
}
/**
* To bound map.
*

View File

@ -9,8 +9,8 @@ import org.gcube.application.geoportalcommon.config.CSVFile;
import org.gcube.application.geoportalcommon.config.CSVReader;
import org.gcube.application.geoportalcommon.config.CSVRow;
import org.gcube.application.geoportalcommon.config.FileUtil;
import org.gcube.application.geoportalcommon.shared.ItemField;
import org.gcube.application.geoportalcommon.shared.exception.GNAConfigException;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -35,11 +35,11 @@ public class GNAConfigsConverter {
* @return the list
* @throws GNAConfigException the GNA user rights config exception
*/
public List<ItemFieldDV> readListItemsConfig(String contentValue) throws GNAConfigException {
public List<ItemField> readListItemsConfig(String contentValue) throws GNAConfigException {
LOG.debug("readListItemsConfig called");
File configurationFile = null;
List<ItemFieldDV> listItemFields = new ArrayList<ItemFieldDV>();
List<ItemField> listItemFields = new ArrayList<ItemField>();
try {
configurationFile = FileUtil.inputStreamToTempFile(contentValue, "GNA_ListItems_Configs"+new Random().nextInt());
@ -57,7 +57,7 @@ public class GNAConfigsConverter {
// Starting from index 1 (means the second row in the CSV)
for (int i = 0; i < rows.size(); i++) {
LOG.trace(i + " row");
ItemFieldDV itemField = new ItemFieldDV();
ItemField itemField = new ItemField();
CSVRow row = rows.get(i);
// mapping to ItemFiel

View File

@ -18,15 +18,13 @@ import org.gcube.application.geoportalcommon.config.CSVReader;
import org.gcube.application.geoportalcommon.config.CSVRow;
import org.gcube.application.geoportalcommon.config.FileUtil;
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
import org.gcube.application.geoportalcommon.shared.ItemField;
import org.gcube.application.geoportalcommon.shared.config.ACTION_ON_ITEM;
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
import org.gcube.application.geoportalcommon.shared.exception.ApplicationProfileNotFoundException;
import org.gcube.application.geoportalcommon.shared.exception.GNAConfigException;
import org.gcube.application.geoportalcommon.shared.guipresentation.BodyWelcome;
import org.gcube.application.geoportalcommon.shared.guipresentation.DataEntryGUIPresentationConfig;
import org.gcube.application.geoportalcommon.shared.guipresentation.Header;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
@ -51,10 +49,7 @@ public class GNADataEntryConfigProfileReader {
public static final String GENERIC_RESOURCE_NAME = "Geoportal-DataEntry-Configs";
private static final String PATH_TO_PERMISSIONS_PATH = RESOURCE_PROFILE_BODY + "/permssions_for_role";
// private static final String PATH_TO_ITEM_FIELDS_CONFIG = RESOURCE_PROFILE_BODY + "/item_fields_config";
private static final String PATH_TO_HEADER_GUI_PRESENTATION = RESOURCE_PROFILE_BODY + "/gui_presentation/data_entry_facility/header";
private static final String PATH_TO_BODY_WELCOME_GUI_PRESENTATION = RESOURCE_PROFILE_BODY + "/gui_presentation/data_entry_facility/body_welcome";
private static final String PATH_TO_ITEM_FIELDS_CONFIG = RESOURCE_PROFILE_BODY + "/item_fields_config";
private String scope;
@ -72,7 +67,7 @@ public class GNADataEntryConfigProfileReader {
* @return the map
* @throws Exception the exception
*/
public GNADataEntryConfigProfile readProfileFromInfrastrucure() throws Exception {
protected GNADataEntryConfigProfile readProfileFromInfrastrucure() throws Exception {
LOG.info("called readProfileFromInfrastrucure");
String queryString = getGcubeGenericQueryString(SECONDARY_TYPE, GENERIC_RESOURCE_NAME);
this.scope = ScopeProvider.instance.get();
@ -120,32 +115,23 @@ public class GNADataEntryConfigProfileReader {
List<RoleRights> listRoleRights = readRoleRightsConfig(value_with_new_lines);
gnDEC.setPermissionsForRole(listRoleRights);
//GUI PRESENTATION CONFIGS
DataEntryGUIPresentationConfig deGUIP = new DataEntryGUIPresentationConfig();
xPathExp = PATH_TO_HEADER_GUI_PRESENTATION;
xPathExp = PATH_TO_ITEM_FIELDS_CONFIG + "/text()";
currValue = helper.evaluate(xPathExp);
LOG.debug("read " + PATH_TO_HEADER_GUI_PRESENTATION + ": " + currValue);
if (currValue != null && currValue.size() > 0) {
String headerGUI = currValue.get(0);
Header headerClass = SerializerUtil.unmarshalXML(headerGUI, Header.class);
LOG.debug("serialized " + Header.class + ": " + headerClass);
deGUIP.setHeader(headerClass);
item_fields = currValue.get(0);
} else
throw new Exception("I'm not able to read the path: " + xPathExp);
xPathExp = PATH_TO_BODY_WELCOME_GUI_PRESENTATION;
currValue = helper.evaluate(xPathExp);
LOG.debug("read " + PATH_TO_BODY_WELCOME_GUI_PRESENTATION + ": " + currValue);
if (currValue != null && currValue.size() > 0) {
String bodyWelcome = currValue.get(0);
BodyWelcome bodyWelcomeClass = SerializerUtil.unmarshalXML(bodyWelcome, BodyWelcome.class);
LOG.debug("serialized " + BodyWelcome.class + ": " + bodyWelcomeClass);
deGUIP.setBodyWelcome(bodyWelcomeClass);
} else
throw new Exception("I'm not able to read the path: " + xPathExp);
gnDEC.setDataEntryGUIPresentation(deGUIP);
// replacing \n with new_line string
LOG.debug("read " + PATH_TO_ITEM_FIELDS_CONFIG + ": " + item_fields);
value_with_new_lines = item_fields.replaceAll("\\\\n", System.lineSeparator());
LOG.debug(PATH_TO_ITEM_FIELDS_CONFIG + " with new lines: " + value_with_new_lines);
GNAConfigsConverter gnc = new GNAConfigsConverter();
List<ItemField> listItemFieldsConfig = gnc.readListItemsConfig(value_with_new_lines);
gnDEC.setListItemFields(listItemFieldsConfig);
LOG.info("returning: " + gnDEC);
return gnDEC;
}
@ -159,7 +145,6 @@ public class GNADataEntryConfigProfileReader {
}
}
/**
* To gcube user role.
@ -246,9 +231,9 @@ public class GNADataEntryConfigProfileReader {
LOG.debug("Role: " + useRights.getUserRole());
LOG.debug("Permissions read: " + mapUserRolePermissions);
Map<OPERATION_ON_ITEM, OPERATION_TYPE> listPermessions = new HashMap<OPERATION_ON_ITEM, OPERATION_TYPE>();
Map<ACTION_ON_ITEM, OPERATION_TYPE> listPermessions = new HashMap<ACTION_ON_ITEM, OPERATION_TYPE>();
for (OPERATION_ON_ITEM value : OPERATION_ON_ITEM.values()) {
for (ACTION_ON_ITEM value : ACTION_ON_ITEM.values()) {
String yesno = mapUserRolePermissions.get(value.name());
if (GNAConfigsConverter.checkYesNoValue(yesno)) {

View File

@ -3,12 +3,20 @@ package org.gcube.application.geoportalcommon;
import static org.gcube.resources.discovery.icclient.ICFactory.client;
import java.io.StringReader;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.ItemField;
import org.gcube.application.geoportalcommon.shared.LayerItem;
import org.gcube.application.geoportalcommon.shared.exception.ApplicationProfileNotFoundException;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
@ -18,6 +26,9 @@ import org.gcube.resources.discovery.client.queries.impl.QueryBox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/**
@ -35,6 +46,7 @@ public class GNADataViewerConfigProfileReader {
*/
public static final String SECONDARY_TYPE = "ApplicationProfile";
public static final String GENERIC_RESOURCE_NAME = "Geoportal-DataViewer-Configs";
private static final String PATH_TO_ITEM_FIELDS_CONFIG = RESOURCE_PROFILE_BODY + "/item_fields_config";
private static Logger LOG = LoggerFactory.getLogger(GNADataViewerConfigProfileReader.class);
private String secondaryType;
@ -76,7 +88,7 @@ public class GNADataViewerConfigProfileReader {
Query q = new QueryBox(queryString);
DiscoveryClient<String> client = client();
List<String> appProfile = client.submit(q);
// String item_fields = "";
String item_fields = "";
if (appProfile == null || appProfile.size() == 0)
throw new ApplicationProfileNotFoundException("ApplicationProfile with SecondaryType: " + secondaryType
@ -103,6 +115,44 @@ public class GNADataViewerConfigProfileReader {
} else
throw new Exception("I'm not able to read the path: " + xPathExp);
XPath xPath = XPathFactory.newInstance().newXPath();
NodeList nodeList = (NodeList) xPath.compile("/Resource/Profile/Body/AvailableLayers/Layer")
.evaluate(doc, XPathConstants.NODESET);
Map<String, LayerItem> mapLayers = new HashMap<String, LayerItem>(nodeList.getLength());
for (int i = 0; i < nodeList.getLength(); i++) {
Node layerNode = nodeList.item(i);
if (layerNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) layerNode;
String layerType = eElement.getElementsByTagName("Type").item(0).getTextContent();
String wmsLink = eElement.getElementsByTagName("WMSLink").item(0).getTextContent();
String decodedURL = URLDecoder.decode(wmsLink, "UTF-8");
LayerItem layer = new LayerItem();
layer.setWmsLink(decodedURL);
mapLayers.put(layerType.toLowerCase(), layer);
}
}
profile.setMapLayers(mapLayers);
xPathExp = PATH_TO_ITEM_FIELDS_CONFIG + "/text()";
currValue = helper.evaluate(xPathExp);
if (currValue != null && currValue.size() > 0) {
item_fields = currValue.get(0);
} else
throw new Exception("I'm not able to read the path: " + xPathExp);
// replacing \n with new_line string
LOG.debug("read " + PATH_TO_ITEM_FIELDS_CONFIG + ": " + item_fields);
String value_with_new_lines = item_fields.replaceAll("\\\\n", System.lineSeparator());
LOG.debug(PATH_TO_ITEM_FIELDS_CONFIG + " with new lines: " + value_with_new_lines);
GNAConfigsConverter gnc = new GNAConfigsConverter();
List<ItemField> listItemFieldsConfig = gnc.readListItemsConfig(value_with_new_lines);
profile.setListItemFields(listItemFieldsConfig);
LOG.info("returning: " + profile);
return profile;
}

View File

@ -3,15 +3,11 @@ package org.gcube.application.geoportalcommon;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.PublicLink;
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder.RESOLVE_AS;
import org.gcube.portlets.user.urlshortener.UrlShortener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -21,30 +17,39 @@ import org.slf4j.LoggerFactory;
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 2, 2023
* Aug 5, 2021
*/
public class GeoportalCommon {
/** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(GeoportalCommon.class);
private GNADataViewerConfigProfile geonaDataProfile;
/**
* Instantiates a new geoportal common.
*/
public GeoportalCommon() {
}
/**
* Instantiates a new geoportal common.
*
* @param geonaDataProfile the geona data profile
*/
public GeoportalCommon(GNADataViewerConfigProfile geonaDataProfile) {
this.geonaDataProfile = geonaDataProfile;
}
/**
* Gets the public links for.
*
* @param gcubeScope the gcube scope
* @param item the item
* @param createShortURL creates and returns the short URL also.
* @return the public links for
* @throws Exception the exception
*/
public GeoportalItemReferences getPublicLinksFor(String gcubeScope, GeoportalItemReferences item,
boolean createShortURL) throws Exception {
public GeoNaItemRef getPublicLinksFor(GeoNaItemRef item, boolean createShortURL) throws Exception {
LOG.info("getPublicLinksFor called for: " + item);
try {
@ -52,22 +57,20 @@ public class GeoportalCommon {
if (item == null)
throw new Exception("Bad request, the item is null");
if (item.getProjectID() == null)
throw new Exception("Bad request, the ProjectID is null");
if (item.getItemId() == null)
throw new Exception("Bad request, the item id is null");
if (item.getProfileID() == null)
throw new Exception("Bad request, the ProfileID is null");
if (item.getItemType() == null)
throw new Exception("Bad request, the item type is null");
UriResolverManager resolver = new UriResolverManager("GEO");
if (this.geonaDataProfile == null)
this.geonaDataProfile = readGNADataViewerConfig(GeoportalCommonConstants.GEOPORTAL_DATA_VIEWER_APP);
// Restricted Link
String link = String.format("%s?%s=%s&%s=%s", geonaDataProfile.getRestrictedPortletURL(),
GeoportalCommonConstants.GET_GEONA_ITEM_ID, item.getItemId(),
GeoportalCommonConstants.GET_GEONA_ITEM_TYPE, item.getItemType());
// PRIVATE LINK
GeoportalResolverQueryStringBuilder builder = new GeoportalResolverQueryStringBuilder(item.getProfileID(),
item.getProjectID());
builder.scope(gcubeScope);
builder.resolverAs(RESOLVE_AS.PRIVATE);
// builder.resolverAs(RESOLVE_AS.PRIVATE);
Map<String, String> params = builder.buildQueryParameters();
String link = resolver.getLink(params, false);
String shortUrl = link;
try {
if (createShortURL)
@ -77,14 +80,14 @@ public class GeoportalCommon {
}
item.setRestrictedLink(new PublicLink(link, shortUrl));
// PUBLIC LINK
builder.resolverAs(RESOLVE_AS.PUBLIC);
params = builder.buildQueryParameters();
link = resolver.getLink(params, false);
// Open Link
link = String.format("%s?%s=%s&%s=%s", geonaDataProfile.getOpenPortletURL(),
GeoportalCommonConstants.GET_GEONA_ITEM_ID, item.getItemId(),
GeoportalCommonConstants.GET_GEONA_ITEM_TYPE, item.getItemType());
shortUrl = link;
try {
if (createShortURL)
shortUrl = getShortUrl(link);
shortUrl = getShortUrl(link);
} catch (Exception e) {
LOG.warn("Error on shortening the URL: ", e);
}
@ -144,6 +147,15 @@ public class GeoportalCommon {
}
}
/**
* Gets the geona data profile.
*
* @return the geona data profile
*/
public GNADataViewerConfigProfile getGeonaDataProfile() {
return geonaDataProfile;
}
/**
* Read GNA data viewer config.
*
@ -174,7 +186,7 @@ public class GeoportalCommon {
*/
public GNADataEntryConfigProfile readGNADataEntryConfig() throws Exception {
LOG.info("readGNADataEntryConfig called");
GNADataEntryConfigProfileReader gnaConfigReader = new GNADataEntryConfigProfileReader();
GNADataEntryConfigProfile config = gnaConfigReader.readProfileFromInfrastrucure();
return config;

View File

@ -14,4 +14,5 @@ public class GeoportalCommonConstants {
public static final String GEOPORTAL_DATA_VIEWER_APP = "geoportal-data-viewer-app";
}

View File

@ -0,0 +1,266 @@
package org.gcube.application.geoportalcommon;
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest.Direction;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.PagedRequest;
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
import org.gcube.application.geoportalcommon.shared.ItemField;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.WhereClause;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.BasicDBObjectBuilder;
/**
* The Class MongoServiceCommon.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 3, 2021
*/
public class MongoServiceCommon {
private static Logger LOG = LoggerFactory.getLogger(MongoServiceCommon.class);
/**
* Gets the instance mongo concessioni.
*
* @return the instance mongo concessioni
*/
public MongoConcessioni getInstanceMongoConcessioni() {
return mongoConcessioni().build();
}
/**
* Gets the list of concessioni.
*
* @param reloadFromService the reload from service
* @return the list of concessioni
* @throws Exception the exception
*/
public List<Concessione> getListOfConcessioni() throws Exception {
LOG.info("called getListOfConcessioni");
List<Concessione> listOfConcessioni = new ArrayList<Concessione>();
LOG.info("Loading list of concessioni from client mongo");
MongoConcessioni clientMongo = getInstanceMongoConcessioni();
Iterator<Concessione> concessioni = clientMongo.getList();
if (concessioni != null) {
while (concessioni.hasNext()) {
Concessione concessione = (Concessione) concessioni.next();
listOfConcessioni.add(concessione);
}
}
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
return listOfConcessioni;
}
/**
* Query on mongo.
*
* @param offset the offset
* @param limit the limit
* @param filter the filter
* @param recordType the record type
* @return the result set paginated data
* @throws Exception the exception
*/
public ResultSetPaginatedData queryOnMongo(Integer totalItems, Integer offset, Integer limit, SearchingFilter filter, String recordType) throws Exception {
try {
if (recordType.equalsIgnoreCase("concessione")) {
MongoConcessioni clientMongo = getInstanceMongoConcessioni();
if(totalItems==null || totalItems < 0) {
// TODO MUST BE REPLACED BY COUNT
List<Concessione> listOfConcessioni = getListOfConcessioni();
int listConcessioniSize = listOfConcessioni.size();
totalItems = listConcessioniSize;
}
Integer offsetIndex = offset;
Integer limitIndex = limit;
if (offset == null || offset<0) {
offsetIndex = 0;
}
if (limit == null || limit<0) {
limitIndex = totalItems;
}
ResultSetPaginatedData searchedData = new ResultSetPaginatedData(offsetIndex, limitIndex, false);
searchedData.setTotalItems(totalItems);
List<ConcessioneDV> toReturnList = new ArrayList<ConcessioneDV>();
Direction sDirection = null;
List<String> orderingFields = new ArrayList<String>();
if (filter == null) {
LOG.info("No filter found, creating empty filter");
filter = new SearchingFilter();
}
ORDER order = filter.getOrder();
if (order == null) {
order = ORDER.ASC;
LOG.info("No direction/order found, using default: " + order);
}
switch (order) {
case ASC:
sDirection = Direction.ASCENDING;
break;
case DESC:
sDirection = Direction.DESCENDING;
break;
}
List<ItemField> orderByFields = filter.getOrderByFields();
if(orderByFields==null) {
orderByFields = new ArrayList<ItemField>();
}
if(orderByFields.isEmpty()) {
ItemField orderD = new ItemField("", Arrays.asList("name"), false, false, false);
LOG.info("Order by is null, adding default: " + orderD);
orderByFields.add(orderD);
}
for (ItemField itemField : orderByFields) {
if (itemField.getJsonFields() != null) {
for (String field : itemField.getJsonFields()) {
orderingFields.add(field);
}
}
}
QueryRequest request = new QueryRequest();
PagedRequest paging = new PagedRequest();
paging.setOffset(offsetIndex);
paging.setLimit(limitIndex);
request.setPaging(paging);
OrderedRequest ordering = new OrderedRequest();
ordering.setDirection(sDirection);
ordering.setFields(orderingFields);
request.setOrdering(ordering);
Document query = new Document();
if(filter.getConditions()!=null) {
for (WhereClause whereClause : filter.getConditions()) {
LOGICAL_OP searchWithOperator = whereClause.getOperator();
if(searchWithOperator==null) {
searchWithOperator = LOGICAL_OP.OR;
}
if (whereClause.getSearchInto() != null) {
Map<String, Object> searchFields = whereClause.getSearchInto();
BasicDBObjectBuilder builder = BasicDBObjectBuilder.start();
for (String key : searchFields.keySet()) {
// using regex and case-insensitive
BasicDBObject bs = new BasicDBObject();
bs.append("$regex", searchFields.get(key));
bs.append("$options", "i");
builder.append(key, bs);
}
//Building list of Document in OR clause
BasicDBList list = new BasicDBList();
Map map = builder.get().toMap();
for (Object key : map.keySet()) {
BasicDBObject value = (BasicDBObject) map.get(key);
Document doc = new Document((String) key, value);
list.add(doc);
}
//query = new Document();
query.put(searchWithOperator.getOperator(), list);
// BasicDBObject bs = new BasicDBObject();
// bs.append("$eq", "PASSED");
// query.put("report.status", bs);
}
}
}
request.setFilter(query);
LOG.info("Paging offset: " + offsetIndex + ", limit: " + limitIndex);
LOG.info("Direction: " + sDirection);
LOG.info("Order by Fields: " + orderingFields);
LOG.info("Search for conditions: " + filter.getConditions());
if (query != null) {
LOG.info("Search query to JSON: " + query.toJson());
}
Iterator<Concessione> concessioni = clientMongo.query(request);
int i = 0;
while (concessioni.hasNext()) {
Concessione concessione = concessioni.next();
ConcessioneDV concessioneDV = ConvertToDataViewModel.toMetadataConcessione(concessione, true);
toReturnList.add(concessioneDV);
i++;
LOG.trace(i+") converted: " + concessioneDV);
}
LOG.debug("read " + toReturnList + " project/s");
searchedData.setData(toReturnList);
// TODO WORKAROUND MUST BE REMOVE AFTER THE QUERY COUNT
// AND LIST.SIZE WILL BE AVAILABLE IN THE SERVICE
if (filter.getConditions() != null) {
searchedData.setTotalItems(toReturnList.size());
totalItems = toReturnList.size();
}
if (totalItems == limit || totalItems == 0) {
LOG.debug("Page completed returning " + totalItems + " items");
int newOffset = offsetIndex + limitIndex;
searchedData.setServerSearchFinished(newOffset > totalItems || totalItems == 0);
LOG.debug("is Search finished: " + searchedData.isServerSearchFinished());
}
return searchedData;
}
} catch (Exception e) {
LOG.error("Error on loading paginated and filtered list of concessioni: ", e);
throw new Exception("Error occurred on loading list of Concessioni. Error: " + e.getMessage());
}
return null;
}
}

View File

@ -1,102 +0,0 @@
package org.gcube.application.geoportalcommon;
import java.util.List;
/**
* The Class ProjectDVBuilder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 10, 2022
*/
public class ProjectDVBuilder {
private boolean lifecycleInformation;
private boolean spatialReference = true; //default
private boolean temporalReference;
private boolean relationships;
private List<String> listDocumentKeys;
private boolean fullDocumentMap;
private ProjectDVBuilder() {
}
public static ProjectDVBuilder newBuilder() {
return new ProjectDVBuilder();
}
public boolean isIncludeLifecycleInformation() {
return lifecycleInformation;
}
public boolean isIncludeSpatialReference() {
return spatialReference;
}
public boolean isIncludeTemporalReference() {
return temporalReference;
}
public boolean isIncludeRelationships() {
return relationships;
}
public List<String> getListDocumentKeys() {
return listDocumentKeys;
}
public boolean isIncludeFullDocumentMap() {
return fullDocumentMap;
}
public ProjectDVBuilder lifecycleInformation(boolean lifecycleInformation) {
this.lifecycleInformation = lifecycleInformation;
return this;
}
public ProjectDVBuilder spatialReference(boolean includeSpatialReference) {
this.spatialReference = includeSpatialReference;
return this;
}
public ProjectDVBuilder temporalReference(boolean includeTemporalReference) {
this.temporalReference = includeTemporalReference;
return this;
}
public ProjectDVBuilder relationships(boolean includeRelationships) {
this.relationships = includeRelationships;
return this;
}
public ProjectDVBuilder listDocumentKeys(List<String> listDocumentKeys) {
this.listDocumentKeys = listDocumentKeys;
return this;
}
public ProjectDVBuilder fullDocumentMap(boolean includeFullDocumentMap) {
this.fullDocumentMap = includeFullDocumentMap;
return this;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ProjectDVBuilder [lifecycleInformation=");
builder.append(lifecycleInformation);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append(", temporalReference=");
builder.append(temporalReference);
builder.append(", relationships=");
builder.append(relationships);
builder.append(", listDocumentKeys=");
builder.append(listDocumentKeys);
builder.append(", fullDocumentMap=");
builder.append(fullDocumentMap);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,108 +0,0 @@
package org.gcube.application.geoportalcommon;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GeoServerPlatformInfoDV;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
/**
* The Class SerializerUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 26, 2022
*/
public class SerializerUtil {
private static Logger LOG = LoggerFactory.getLogger(SerializerUtil.class);
private static ObjectMapper mapper;
private static ObjectMapper mapperXML;
static {
mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.configure(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
mapper.registerModule(new JavaTimeModule());
SimpleModule s = new SimpleModule();
mapper.registerModule(s);
}
/**
* Read JSON.
*
* @param <T> the generic type
* @param string the string
* @param clazz the clazz
* @return the t
* @throws JsonProcessingException the json processing exception
* @throws IOException Signals that an I/O exception has occurred.
*/
public static <T> T readJSON(String string, Class<T> clazz) throws JsonProcessingException, IOException {
return mapper.readerFor(clazz).readValue(string);
}
/**
* Unmarshal XML.
*
* @param <T> the generic type
* @param string the string
* @param theClass the the class
* @return the class
* @throws Exception the exception
*/
public static <T> T unmarshalXML(String string, Class<T> theClass) throws Exception {
LOG.debug("unmarshalXML: " + string.trim() + " as class: " + theClass);
try {
JAXBContext jaxbContext = JAXBContext.newInstance(theClass);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
if (string == null || string.length() == 0)
throw new Exception("Input string is null or empty");
InputStream stream = new ByteArrayInputStream(string.getBytes());
T umarshalledObject = (T) jaxbUnmarshaller.unmarshal(stream);
LOG.debug("returning: " + umarshalledObject);
return umarshalledObject;
} catch (Exception e) {
LOG.error("An error occurred on unmarshalling " + string + "as " + theClass, e);
return null;
}
}
public static class GeoserverPlaformInfoJsonDeserializer extends JsonDeserializer<GeoServerPlatformInfoDV[]> {
@Override
public GeoServerPlatformInfoDV[] deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
LOG.info("deserialize: " +jp.getValueAsString());
return jp.readValueAs(GeoServerPlatformInfoDV[].class);
//return jp.readValueAs(GeoServerPlatformInfoDV[].class);
//List<GeoServerPlatformInfoDV> listPlatform = jp.readValueAs(new TypeReference<List<GeoServerPlatformInfoDV>>() {});
}
}
}

View File

@ -1,33 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal;
/**
* The Class GeoportalClientCaller
*
* Wrapping the geoportal Clients
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 11, 2022
*/
public class GeoportalClientCaller {
/**
* Use case descriptor client.
*
* @return the use case descriptor caller
*/
public static UseCaseDescriptorCaller useCaseDescriptors() {
return new UseCaseDescriptorCaller();
}
/**
* Projects client
*
* @return the projects caller
*/
public static ProjectsCaller projects() {
return new ProjectsCaller();
}
}

View File

@ -1,80 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
/**
* The Class GeoportalConfigUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 15, 2022
*/
public class GeoportalConfigUtil {
private static Logger LOG = LoggerFactory.getLogger(GeoportalConfigUtil.class);
/**
* Read roles for STEP id.
*
* @param handler the handler
* @param stepID the step ID
* @return the list
* @throws Exception the exception
*/
public static List<String> readRolesForSTEPId(HandlerDeclaration handler, String stepID) throws Exception {
LOG.debug("readRolesForSTEPId called for stepID {}, handler {}", stepID, handler);
List<String> roles = new ArrayList<String>();
try {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build();
String toJSON = handler.getConfiguration().toJson();
LOG.debug("Handler to JSON: " + toJSON);
JSONObject jObject = new JSONObject(toJSON);
JsonPath jsonPath = JsonPath.compile("$.step_access[?(@.STEP == '" + stepID + "' )].roles");
LOG.trace("jsonPath: " + jsonPath.getPath());
// $..book[?(@.price <= $['expensive'])]
JSONArray data = jsonPath.read(jObject, configuration);
LOG.debug("jsonPath matching data lenght: " + data.length());
HashSet<String> listdata = new HashSet<String>(data.length());
if(data.length()>0) {
LOG.debug("stepID found");
try {
JSONArray arrayRoles = new JSONArray(data.get(0).toString());
for (int i = 0; i < arrayRoles.length(); i++) {
String role = arrayRoles.get(i).toString();
LOG.debug("for STEP_ID {} read role {}", stepID, role);
listdata.add(role);
}
}catch (Exception e) {
LOG.warn("Error on reading array roles for STEP_ID: "+stepID, e);
}
}
roles = listdata.stream().collect(Collectors.toList());
LOG.info("for STEP_ID {} returning Roles {} ", stepID, roles);
} catch (Exception e) {
LOG.warn("Error occurred on reading roles into handler {} returning no role", handler);
}
return roles;
}
}

View File

@ -1,670 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
import java.io.File;
import java.io.FileNotFoundException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.bson.Document;
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
import org.gcube.application.geoportal.common.model.configuration.Archive;
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.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.QueryRequest.OrderedRequest;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest.Direction;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.PagedRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
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.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.WhereClause;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.PhaseDV;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.BasicDBObjectBuilder;
/**
* The Class ProjectsCaller.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 17, 2022
*/
public class ProjectsCaller {
public static final String DOCUMENT_STORE_COLLECTION = "DOCUMENT-STORE-COLLECTION";
private static Logger LOG = LoggerFactory.getLogger(GeoportalClientCaller.class);
/**
* Gets the client.
*
* @param profileID the profile ID
* @return the client
*/
public Projects<Project> getClient(String profileID) {
LOG.info("getClient called for profileID={}", profileID);
return projects(profileID).build();
}
/**
* Creates the new.
*
* @param profileID the profile ID
* @param jsonDocument the json document
* @return the project
* @throws RemoteException the remote exception
*/
public Project createNew(String profileID, String jsonDocument) throws RemoteException {
LOG.info("createNew called on profileID={}", profileID);
Document myDocument = Document.parse(jsonDocument);
Projects<Project> client = getClient(profileID);
Project project = client.createNew(myDocument);
return project;
}
/**
* Register file set.
*
* @param profileID the profile ID
* @param project the project
* @param theFile the the file
* @param parentPath the parent path
* @param fieldName the field name
* @param fieldDefinition the field definition
* @return the project
* @throws RemoteException the remote exception
* @throws FileNotFoundException the file not found exception
* @throws JsonProcessingException the json processing exception
* @throws InvalidRequestException the invalid request exception
*/
public Project registerFileSet(String profileID, Project project, File theFile, String parentPath, String fieldName,
String fieldDefinition)
throws RemoteException, FileNotFoundException, JsonProcessingException, InvalidRequestException {
LOG.info(
"registerFileSet called with [profileID={}, projectID={}, theFile={}, parentPath={}, fieldName={}, fieldDefinition={}",
parentPath, project.getId(), theFile, parentPath, fieldName, fieldDefinition);
Projects<Project> client = getClient(profileID);
// Prepare request
RegisterFileSetRequest fsRequest = FileSets.prepareRequest(new StorageUtils(), parentPath, fieldName,
fieldDefinition, theFile);
project = client.registerFileSet(project.getId(), fsRequest);
LOG.trace("Resulting Project : " + project);
return project;
}
/**
* Gets the list for profile ID.
*
* @param profileID the profile ID
* @return the list for profile ID
* @throws Exception the exception
*/
public List<Project> getListForProfileID(String profileID) throws Exception {
LOG.info("getListForProfileID called for profileID: {}", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
List<Project> listProjects = new ArrayList<Project>();
Iterator<Project> projects = client.query(new QueryRequest());
for (Iterator<Project> iterator = projects; projects.hasNext();) {
Project prg = (Project) iterator.next();
listProjects.add(prg);
}
LOG.info("returning {} project/s", listProjects.size(), Project.class.getName());
return listProjects;
}
/**
* Gets the project by ID.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the project by ID
* @throws Exception the exception
*/
public Project getProjectByID(String profileID, String projectID) throws Exception {
LOG.info("getProjectByID called for profileID: {}, projectID: {}", profileID, projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Project project = client.getById(projectID);
LOG.info("returning project {}", project != null ? project.getId() : null);
return project;
}
/**
* Gets the relationship chain.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param relationID the relation ID
* @param deep the deep
* @return the relationship chain
* @throws Exception the exception
*/
public Iterator<RelationshipNavigationObject> getRelationshipChain(String profileID, String projectID,
String relationID, Boolean deep) throws Exception {
LOG.info("getRelationshipChain called for projectID: {}, relationID: {}", projectID, projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
return client.getRelationshipChain(projectID, relationID, deep);
}
/**
* Gets the configuration.
*
* @param profileID the profile ID
* @return the configuration
* @throws Exception the exception
*/
public Configuration getConfiguration(String profileID) throws Exception {
LOG.info("getConfiguration called for profileID: {} ", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
LOG.debug("returning: {} ", config);
return config;
}
/**
* Gets the total document.
*
* @param profileID the profile ID
* @return the total document
* @throws Exception the exception
*/
public Integer getTotalDocument(String profileID) throws Exception {
LOG.info("getTotalDocument called for profileID: {}", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
List<Archive> listArchives = config.getArchives();
for (Archive archive : listArchives) {
String theType = archive.getString("_type");
if (theType.equalsIgnoreCase(DOCUMENT_STORE_COLLECTION)) {
String totalDocumentAre = archive.get("count").toString();
int total = Integer.parseInt(totalDocumentAre);
LOG.info("total docs for profileID: {}, are: {}", profileID, total);
return total;
}
}
return null;
}
/**
* Gets the total document.
*
* @param profileID the profile ID
* @return the total document
* @throws Exception the exception
*/
public List<String> getIDsPhases(String profileID) throws Exception {
LOG.info("getIDsPhases called for profileID: {}", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
List<Archive> listArchives = config.getArchives();
for (Archive archive : listArchives) {
String theType = archive.getString("_type");
if (theType.equalsIgnoreCase(DOCUMENT_STORE_COLLECTION)) {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build();
String toJSON = archive.toJson();
JSONObject jObject = new JSONObject(toJSON);
JsonPath jsonPath = JsonPath.compile("$.countByPhase[*]._id.phase");
JSONArray phases = jsonPath.read(jObject, configuration);
HashSet<String> listdata = new HashSet<String>(phases.length());
for (int i = 0; i < phases.length(); i++) {
listdata.add(phases.get(i).toString());
}
List<String> idsPhases = listdata.stream().collect(Collectors.toList());
LOG.info("getIDsPhases returning: {}", idsPhases);
return idsPhases;
}
}
LOG.info("getIDsPhases returning null");
return null;
}
public Integer getCountByPhaseFor(String profileID, String phase, String status) throws Exception {
LOG.info("getCountByPhaseFor called for profileID: {}, phase: {}, status: {}", profileID, phase, status);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
List<Archive> listArchives = config.getArchives();
Integer count = null;
for (Archive archive : listArchives) {
String theType = archive.getString("_type");
if (theType.equalsIgnoreCase(DOCUMENT_STORE_COLLECTION)) {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build();
String toJSON = archive.toJson();
JSONObject jObject = new JSONObject(toJSON);
String query = String.format("$.countByPhase[*][?(@._id.phase == '%s' && @._id.status == '%s')].count",
phase, status);
LOG.debug("Performing query: " + query);
JsonPath jsonPath = JsonPath.compile(query);
JSONArray counts = jsonPath.read(jObject, configuration);
try {
count = counts.getInt(0);
} catch (Exception e) {
LOG.warn("getCountByPhaseFor error: " + e.getLocalizedMessage());
}
}
}
LOG.info("getCountByPhaseFor returning: " + count);
return count;
}
/**
* Gets the phases into document store collection.
*
* @param profileID the profile ID
* @return the phases into document store collection
* @throws Exception the exception
*/
public PhaseDV[] getPhasesIntoDocumentStoreCollection(String profileID) throws Exception {
LOG.info("getPhases called for profileID: {}", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
List<Archive> listArchives = config.getArchives();
for (Archive archive : listArchives) {
String theType = archive.getString("_type");
if (theType.equalsIgnoreCase(DOCUMENT_STORE_COLLECTION)) {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build();
String toJSON = archive.toJson();
JSONObject jObject = new JSONObject(toJSON);
JsonPath jsonPath = JsonPath.compile("$.countByPhase[*]");
JSONArray phases = jsonPath.read(jObject, configuration);
final ObjectMapper objectMapper = new ObjectMapper();
PhaseDV[] phasesArr = objectMapper.readValue(phases.toString(), PhaseDV[].class);
LOG.info("getPhases returning {} PhaseDVs", phasesArr.length);
return phasesArr;
}
}
LOG.info("getPhases returning null");
return null;
}
/**
* Perform step.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param stepID the step ID
* @param options the options
* @return the project
* @throws Exception the exception
*/
public Project performStep(String profileID, String projectID, String stepID, Document options) throws Exception {
LOG.info("performStep called for profileID: {}, projectID: {}", profileID, projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
StepExecutionRequest request = new StepExecutionRequest(stepID, options);
Project project = client.performStep(projectID, request);
LOG.info("performStep returning project ID: " + project.getId());
return project;
}
/**
* Delete project.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param force the force
* @throws RemoteException the remote exception
*/
public void deleteProject(String profileID, String projectID, boolean force) throws RemoteException {
LOG.info("deleteProject called for projectID {}", projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
if (force)
client.deleteById(projectID, force);
else
client.deleteById(projectID);
return;
}
/**
* Update project.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param updatedDocument the updated document
* @return the project
* @throws RemoteException the remote exception
*/
public Project updateProject(String profileID, String projectID, Document updatedDocument) throws RemoteException {
LOG.info("updateProject called for projectID {}", projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
return client.updateDocument(projectID, updatedDocument);
}
/**
* Creates the relationship.
*
* @param fromProfileID the from profile ID
* @param fromProjectID the from project ID
* @param relationshipId the relationship id
* @param toProfileID the to profile ID
* @param toProjectID the to project ID
* @throws RemoteException the remote exception
*/
public void createRelationship(String fromProfileID, String fromProjectID, String relationshipId,
String toProfileID, String toProjectID) throws RemoteException {
LOG.info("createRelationship called for fromProfileID {} and fromProjectID {}", fromProfileID, fromProjectID);
LOG.info("create relationshipName {}", relationshipId);
LOG.info("to toProfileID {} and toProjectID {}", toProfileID, toProjectID);
Projects<Project> client = (Projects<Project>) getClient(fromProfileID);
CreateRelationshipRequest request = new CreateRelationshipRequest(fromProjectID, relationshipId, toProjectID,
toProfileID);
client.setRelation(request);
return;
}
/**
* Delete relationship.
*
* @param fromProfileID the from profile ID
* @param fromProjectID the from project ID
* @param relationshipId the relationship id
* @param toProfileID the to profile ID
* @param toProjectID the to project ID
* @throws RemoteException the remote exception
*/
public void deleteRelationship(String fromProfileID, String fromProjectID, String relationshipId,
String toProfileID, String toProjectID) throws RemoteException {
LOG.info("deleteRelationship called for fromProfileID {} and fromProjectID {}", fromProfileID, fromProjectID);
LOG.info("deleteRelationship relationshipName {}", relationshipId);
LOG.info("to toProfileID {} and toProjectID {}", toProfileID, toProjectID);
Projects<Project> client = (Projects<Project>) getClient(fromProfileID);
DeleteRelationshipRequest request = new DeleteRelationshipRequest(fromProjectID, relationshipId, toProjectID,
toProfileID);
client.deleteRelation(request);
}
/**
* Delete fileset.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param jsonPathToFileset the json path to fileset
* @param force the force
* @param ignoreErrors the ignore errors
* @return the project
* @throws RemoteException the remote exception
*/
public Project deleteFileset(String profileID, String projectID, String jsonPathToFileset, Boolean force,
Boolean ignoreErrors) throws RemoteException {
LOG.info("deleteFileset called for profileID {} and projectID {}, fileset path: {}", profileID, projectID,
jsonPathToFileset);
Projects<Project> client = (Projects<Project>) getClient(profileID);
ignoreErrors = ignoreErrors == null ? false : ignoreErrors;
Project project = client.deleteFileSet(projectID, jsonPathToFileset, force, ignoreErrors);
LOG.info("fileset {} deleted", jsonPathToFileset);
LOG.debug("returning new project: {} ", project.getTheDocument());
return project;
}
/**
* Simple query.
*
* @param profileID the profile ID
* @param filter the filter
* @return the iterator
* @throws Exception the exception
*/
public Iterator<Project> simpleQuery(String profileID, Document filter) throws Exception {
LOG.info("simpleQuery called for profileID {} and filter {}", profileID, filter);
try {
Projects<Project> geoportalClient = getClient(profileID);
QueryRequest request = new QueryRequest();
request.setFilter(filter);
return geoportalClient.query(request);
} catch (Exception e) {
LOG.error("Error on performing query: " + filter, e);
throw new Exception("Error occurred on performing query " + filter + ". Error: " + e.getMessage());
}
}
/**
* Query on mongo.
*
* @param profileID the profile ID
* @param totalItems the total items
* @param offset the offset
* @param limit the limit
* @param filter the filter
* @return the iterator
* @throws Exception the exception
*/
public Iterator<Project> queryOnMongo(String profileID, Integer totalItems, Integer offset, Integer limit,
SearchingFilter filter) throws Exception {
LOG.debug("queryOnMongo called");
try {
Projects<Project> geoportalClient = getClient(profileID);
if (totalItems == null || totalItems < 0) {
// TODO MUST BE REPLACED BY COUNT
List<Project> listOfProjects = getListForProfileID(profileID);
int listConcessioniSize = listOfProjects.size();
totalItems = listConcessioniSize;
}
Integer offsetIndex = offset;
Integer limitIndex = limit;
if (offset == null || offset < 0) {
offsetIndex = 0;
}
if (limit == null || limit < 0) {
limitIndex = totalItems;
}
Direction sDirection = null;
List<String> orderingFields = new ArrayList<String>();
if (filter == null) {
LOG.info("No filter found, creating empty filter");
filter = new SearchingFilter();
}
ORDER order = filter.getOrder();
if (order == null) {
order = ORDER.ASC;
LOG.info("No direction/order found, using default: " + order);
}
switch (order) {
case ASC:
sDirection = Direction.ASCENDING;
break;
case DESC:
sDirection = Direction.DESCENDING;
break;
}
List<ItemFieldDV> orderByFields = filter.getOrderByFields();
if (orderByFields == null) {
orderByFields = new ArrayList<ItemFieldDV>();
}
// if (orderByFields.isEmpty()) {
// ItemFieldDV orderD = new ItemFieldDV("", Arrays.asList("name"), null, false, false, false);
// LOG.info("Order by is null, adding default: " + orderD);
// orderByFields.add(orderD);
// }
for (ItemFieldDV itemField : orderByFields) {
if (itemField.getJsonFields() != null) {
for (String jsonFieldPath : itemField.getJsonFields()) {
// String fieldFullPath = String.format("%s.%s", itemField.getProjection(),
// field);
orderingFields.add(jsonFieldPath);
}
}
}
Map<String, Object> projection = filter.getProjection();
Document projectionDocument = null;
if (projection != null && !projection.isEmpty()) {
projectionDocument = new Document(projection);
}
QueryRequest request = new QueryRequest();
PagedRequest paging = new PagedRequest();
paging.setOffset(offsetIndex);
paging.setLimit(limitIndex);
request.setPaging(paging);
OrderedRequest ordering = new OrderedRequest();
ordering.setDirection(sDirection);
ordering.setFields(orderingFields);
request.setOrdering(ordering);
Document query = new Document();
if (filter.getConditions() != null) {
for (WhereClause whereClause : filter.getConditions()) {
LOGICAL_OP searchWithOperator = whereClause.getOperator();
if (searchWithOperator == null) {
searchWithOperator = LOGICAL_OP.OR;
}
if (whereClause.getSearchInto() != null && !whereClause.getSearchInto().isEmpty()) {
Map<String, Object> searchFields = whereClause.getSearchInto();
BasicDBObjectBuilder builder = BasicDBObjectBuilder.start();
for (String key : searchFields.keySet()) {
// using regex and case-insensitive
BasicDBObject bs = new BasicDBObject();
bs.append("$regex", searchFields.get(key));
bs.append("$options", "i");
builder.append(key, bs);
}
// Building list of Document in OR clause
BasicDBList list = new BasicDBList();
Map map = builder.get().toMap();
for (Object key : map.keySet()) {
BasicDBObject value = (BasicDBObject) map.get(key);
Document doc = new Document((String) key, value);
list.add(doc);
}
// query = new Document();
query.put(searchWithOperator.getOperator(), list);
// BasicDBObject bs = new BasicDBObject();
// bs.append("$eq", "PASSED");
// query.put("report.status", bs);
}
}
}
if (projectionDocument != null) {
request.setProjection(projectionDocument);
// THE first field specified in the projection must be not null
BasicDBObject bsNotEqualEmpty = new BasicDBObject();
bsNotEqualEmpty.append("$ne", null);
Optional<String> firstKey = projection.keySet().stream().findFirst();
if (firstKey.isPresent()) {
String firstFieldPath = firstKey.get();
query.append(firstFieldPath, bsNotEqualEmpty);
}
}
// REMOVING DIRTY DOCUMENTS
/*
* BasicDBObject bsValid_Document = new BasicDBObject();
* bsValid_Document.append("$exists", true); bsValid_Document.append("$ne",
* null); query.append("_theDocument", bsValid_Document);
*
* BasicDBObject bsValidLfc = new BasicDBObject(); bsValidLfc.append("$ne",
* null); query.append("_lifecycleInformation._phase", bsValidLfc);
*/
// BasicDBObject bsDocumentExists = new BasicDBObject();
// bsDocumentExists.append("$exists", false);
// query.append("theDocument", bsDocumentExists);
// BasicDBObject bsNotEqualEmpty = new BasicDBObject();
// bsNotEqualEmpty.append("$ne", null);
// query.append("_theDocument.nome", bsNotEqualEmpty);
request.setFilter(query);
LOG.info("Paging offset: " + offsetIndex + ", limit: " + limitIndex);
LOG.info("Direction: " + sDirection);
LOG.info("Projection: " + projectionDocument);
LOG.info("Order by Fields: " + ordering);
LOG.info("Search for conditions: " + filter.getConditions());
if (query != null) {
LOG.info("Search query to JSON: " + query.toJson());
}
return geoportalClient.query(request);
} catch (Exception e) {
LOG.error("Error on loading paginated and filtered list of Project: ", e);
throw new Exception("Error occurred on loading list of Project. Error: " + e.getMessage());
}
}
}

View File

@ -1,229 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.RelationshipDefinition;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
/**
* The Class UseCaseDescriptorCaller.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 14, 2022
*/
public class UseCaseDescriptorCaller {
private static Logger LOG = LoggerFactory.getLogger(UseCaseDescriptorCaller.class);
public static final String TIMELINE_CONFIG_TJT_DOCUMENT = "tjt_document";
/**
* Use case descriptors client.
*
* @return the use case descriptors I
*/
public UseCaseDescriptorsI useCaseDescriptorsClient() {
LOG.info("useCaseDescriptorsClient called");
return useCaseDescriptors().build();
}
/**
* Gets the list.
*
* @return the list
* @throws Exception the exception
*/
public List<UseCaseDescriptor> getList() throws Exception {
LOG.info("getList called");
UseCaseDescriptorsI client = useCaseDescriptorsClient();
List<UseCaseDescriptor> listUCD = new ArrayList<UseCaseDescriptor>();
Iterator<UseCaseDescriptor> useCaseDescrs = client.query(new QueryRequest());
for (Iterator<UseCaseDescriptor> iterator = useCaseDescrs; useCaseDescrs.hasNext();) {
UseCaseDescriptor prg = (UseCaseDescriptor) iterator.next();
listUCD.add(prg);
}
LOG.info("returning {} {}", listUCD.size(), UseCaseDescriptor.class.getName());
return listUCD;
}
/**
* Gets the list for handler ids.
*
* @param listHandlersIds the list handlers ids
* @return the list for handler ids
* @throws Exception the exception
*/
public List<UseCaseDescriptor> getListForHandlerIds(List<String> listHandlersIds) throws Exception {
LOG.info("getListForHandlerIds called");
return getListForJSONPath("_handlers._id", listHandlersIds);
}
/**
* Gets the list for JSON path.
*
* @param jsonPath the json path
* @param listValues the list values
* @return the list for JSON path
* @throws Exception the exception
*/
public List<UseCaseDescriptor> getListForJSONPath(String jsonPath, List<String> listValues) throws Exception {
LOG.info("getListForJSONPath called for jsonPath: {}, with listValues: {}", jsonPath, listValues);
UseCaseDescriptorsI client = useCaseDescriptorsClient();
List<UseCaseDescriptor> listUCD = new ArrayList<UseCaseDescriptor>();
// BasicDBObjectBuilder builder = BasicDBObjectBuilder.start();
// for (String key : listHandlersIds) {
// // using regex and case-insensitive
// BasicDBObject bs = new BasicDBObject();
// bs.append(jsonPath, key);
// builder.append(key, bs);
//
// }
// Building list of Document in OR clause
BasicDBList list = new BasicDBList();
for (String value : listValues) {
Document doc = new Document(jsonPath, value);
list.add(doc);
}
QueryRequest queryRequest = new QueryRequest();
Document queryDoc = new Document();
queryDoc.put("$and", list);
LOG.debug("Performing query: {}", queryDoc.toJson());
queryRequest.setFilter(queryDoc);
// QueryRequest queryRequest = new QueryRequest();
// Document queryDoc = new Document();
// BasicDBObject bs = new BasicDBObject();
// bs.append("$eq", hasValue);
// queryDoc.put(jsonPath, bs);
// LOG.debug("Performing query: {}", queryDoc.toJson());
// queryRequest.setFilter(queryDoc);
Iterator<UseCaseDescriptor> useCaseDescrsIt = client.query(queryRequest);
if (useCaseDescrsIt != null) {
while (useCaseDescrsIt.hasNext()) {
UseCaseDescriptor prg = (UseCaseDescriptor) useCaseDescrsIt.next();
listUCD.add(prg);
}
}
LOG.info("getListForJSONPath returning {} {}", listUCD.size(), UseCaseDescriptor.class.getName());
return listUCD;
}
/**
* Gets the UCD for id.
*
* @param profileID the profile ID
* @return the UCD for id
* @throws Exception the exception
*/
public UseCaseDescriptor getUCDForId(String profileID) throws Exception {
LOG.info("getUCDForId called for profileID: {}", profileID);
UseCaseDescriptorsI client = useCaseDescriptorsClient();
QueryRequest queryRequest = new QueryRequest();
Document queryDoc = new Document();
BasicDBObject bs = new BasicDBObject();
bs.append("$eq", profileID);
queryDoc.put("_id", bs);
LOG.debug("Performing query: {}", queryDoc.toJson());
queryRequest.setFilter(queryDoc);
Iterator<UseCaseDescriptor> useCaseDescrs = client.query(queryRequest);
UseCaseDescriptor ucd = null;
if (useCaseDescrs.hasNext()) {
ucd = useCaseDescrs.next();
}
LOG.info("for profileID: {}, returning: {}", profileID, ucd);
return ucd;
}
/**
* Gets the handlers by type.
*
* @param profileID the profile ID
* @param theHandlerType the the handler type
* @return the handlers by type
* @throws Exception the exception
*/
public List<HandlerDeclaration> getHandlersByType(String profileID, String theHandlerType) throws Exception {
LOG.info("getHandlersByType called for profileID: {}", profileID);
UseCaseDescriptorsI client = useCaseDescriptorsClient();
UseCaseDescriptor ucd = client.getById(profileID);
return ucd.getHandlersByType(theHandlerType);
}
/**
* Gets the relationship definitions.
*
* @param profileID the profile ID
* @return the relationship definitions
* @throws Exception the exception
*/
public List<RelationshipDefinition> getRelationshipDefinitions(String profileID) throws Exception {
LOG.info("getRelationshipNames called for profileID: {}", profileID);
UseCaseDescriptorsI client = useCaseDescriptorsClient();
UseCaseDescriptor ucd = client.getById(profileID);
return ucd.getRelationshipDefinitions();
}
/**
* Read temporal dimension template.
*
* @param profileID the profile ID
* @return the document
* @throws Exception the exception
*/
public Document readTemporalDimensionTemplate(String profileID) throws Exception {
UseCaseDescriptorsI client = useCaseDescriptorsClient();
UseCaseDescriptor ucd = client.getById(profileID);
List<HandlerDeclaration> timelineHandlers = ucd
.getHandlersByType(GEOPORTAL_DATA_HANDLER.geoportal_timeline_json_template.getType());
if (timelineHandlers != null && timelineHandlers.size() > 0) {
HandlerDeclaration handler = timelineHandlers.get(0); // only one expected
Document config = handler.getConfiguration();
try {
LinkedHashMap<String, Object> tjtDoc = (LinkedHashMap<String, Object>) config
.get(TIMELINE_CONFIG_TJT_DOCUMENT);
return new Document(tjtDoc);
} catch (Exception e) {
LOG.warn("Error on reading the handler type "
+ GEOPORTAL_DATA_HANDLER.geoportal_timeline_json_template.getType() + " in the profileID: "
+ profileID, e);
return null;
}
}
return null;
}
}

View File

@ -1,111 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal.access;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class GeportalCheckAccessPolicy.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 7, 2022
*/
public class GeportalCheckAccessPolicy {
private static final Logger LOG = LoggerFactory.getLogger(GeportalCheckAccessPolicy.class);
/**
* The Enum ACCESS_POLICY.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Sep 8, 2021
*/
public static enum ACCESS_POLICY {
OPEN, RESTICTED
}
/**
* Checks if is open access.
*
* @param policy the policy
* @return true, if is open access
*/
private static boolean isOpenAccess(String policy) {
if (policy == null || policy.equalsIgnoreCase(ACCESS_POLICY.OPEN.name())) {
return true;
}
return false;
}
/**
* Checks if is restricted access.
*
* @param policy the policy
* @return true, if is restricted access
*/
private static boolean isRestrictedAccess(String policy) {
if (policy == null || policy.equalsIgnoreCase(ACCESS_POLICY.RESTICTED.name())) {
return true;
}
return false;
}
/**
* Checks if is accessible according to access policies.
*
* @param policy the policy
* @param myLogin the my login
* @return true, if is accessible
*/
public static boolean isAccessible(String policy, String myLogin) {
boolean bool = isOpenAccess(policy);
if (bool) {
// is open access
return true;
}
// From here managing is NOT OPEN access
if (myLogin == null || myLogin.isEmpty()) {
// here is not open and the user is not authenticated
return false;
}
// Here the login is not null, so checking if the access to item is RESTICTED
bool = isRestrictedAccess(policy);
if (bool) {
// is restricted access
return true;
}
// Here the user is authenticated, but the policy is not managed, so returning
// true
return true;
}
/**
* Access policy from session login.
*
* @param mySessionLogin the my session login
* @return the access policy
*/
public static ACCESS_POLICY accessPolicyFromSessionLogin(String mySessionLogin) {
if (mySessionLogin == null || mySessionLogin.isEmpty()) {
// here is not open and the user is not authenticated
return ACCESS_POLICY.OPEN;
}
return ACCESS_POLICY.RESTICTED;
}
}

View File

@ -1,34 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal.config;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Data
@XmlRootElement(name = "actionsDefinition")
@Slf4j
public class ActionDefinition {
@JsonProperty
private String id;
@JsonProperty
private String title;
@JsonProperty
private String[] call_STEPS;
@JsonProperty
private String description;
@JsonProperty
private String[] display_on_phase;
@JsonProperty
private boolean searchable;
private String configID;
public ActionDefinition() {
}
}

View File

@ -1,25 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal.config;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Data
@XmlRootElement(name = "filePaths")
@Slf4j
public class FilePath {
@JsonProperty
String gcubeProfileFieldName;
@JsonProperty
String fieldDefinition;
@JsonProperty
String fieldName;
public FilePath() {
}
}

View File

@ -1,58 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal.config;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Data
@XmlRootElement(name = "gcubeProfiles")
@Slf4j
public class GcubeProfile {
private static final String FILE_PATHS = "filePaths";
public static final int MIN_MAX_NOT_SPECIFIED = -1;
@JsonProperty
private String gcubeSecondaryType;
@JsonProperty
private String gcubeName;
@JsonProperty
private String parentName;
@JsonProperty
private String sectionName;
@JsonProperty
private String sectionTitle;
/**
* 0: Not specified means Not Mandatory. The Gcube Profile is not mandatory and means that all its fields must be optional in the gCube Meta Profile.
* N: is the MIN number of Occurrences
* Default is 1 occurrence
*/
@JsonProperty
private int minOccurs = 1;
/**
* 0: Not specified means max number of Occurrences is arbitrary.
* N: is the MAX number of Occurrences
*/
@JsonProperty
private int maxOccurs = 1;
@JsonProperty(FILE_PATHS)
private List<FilePath> filePaths;
public GcubeProfile() {}
}

View File

@ -1,33 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal.config;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Data
@XmlRootElement(name = "itemFields")
@Slf4j
public class ItemField {
@JsonProperty
private String label;
@JsonProperty
private List<String> paths;
@JsonProperty
private String operator;
@JsonProperty
private boolean searchable;
@JsonProperty
private boolean sortable;
@JsonProperty
private boolean asResult;
public ItemField() {
}
}

View File

@ -1,83 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal.serdes;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.extern.slf4j.Slf4j;
@XmlRootElement(name = "_payloads")
@Slf4j
public class Payload implements Serializable {
/**
*
*/
private static final long serialVersionUID = -3975356671779455705L;
@JsonProperty("_mimetype")
private String mimetype;
@JsonProperty("_storageID")
private String storageID;
@JsonProperty("_link")
private String link;
@JsonProperty("_name")
private String name;
public Payload() {
}
public String getMimetype() {
return mimetype;
}
public String getStorageID() {
return storageID;
}
public String getLink() {
return link;
}
public String getName() {
return name;
}
public void setMimetype(String mimetype) {
this.mimetype = mimetype;
}
public void setStorageID(String storageID) {
this.storageID = storageID;
}
public void setLink(String link) {
this.link = link;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Payload [mimetype=");
builder.append(mimetype);
builder.append(", storageID=");
builder.append(storageID);
builder.append(", link=");
builder.append(link);
builder.append(", name=");
builder.append(name);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,26 +0,0 @@
package org.gcube.application.geoportalcommon.geoportal.util;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
import org.json.JSONArray;
public class GisUtil {
public static BBOXDV fromJSONArray(JSONArray outerArray) {
try {
if (outerArray == null)
return new BBOXDV();
double[] coords = new double[outerArray.length()];
for (int i = 0; i < outerArray.length(); i++) {
coords[i] = outerArray.getDouble(i);
}
return BBOXDV.fromGeoJSON(coords);
} catch (Exception e) {
return new BBOXDV();
}
}
}

View File

@ -4,7 +4,6 @@ import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
import org.gcube.application.geoportalcommon.shared.guipresentation.DataEntryGUIPresentationConfig;
/**
* The Class GNADataEntryConfigProfile.
@ -15,9 +14,12 @@ import org.gcube.application.geoportalcommon.shared.guipresentation.DataEntryGUI
*/
public class GNADataEntryConfigProfile implements Serializable {
/**
*
*/
private static final long serialVersionUID = 5152380669677928785L;
private List<ItemField> listItemFields;
private List<RoleRights> permissionsForRole;
private DataEntryGUIPresentationConfig dataEntryGUIPresentation;
/**
* Instantiates a new GNA data entry config profile.
@ -26,28 +28,34 @@ public class GNADataEntryConfigProfile implements Serializable {
}
public GNADataEntryConfigProfile(List<RoleRights> permissionsForRole,
DataEntryGUIPresentationConfig dataEntryGUIPresentation) {
/**
* Instantiates a new GNA data entry config profile.
*
* @param listItemFields the list item fields
* @param permissionsForRole the permissions for role
*/
public GNADataEntryConfigProfile(List<ItemField> listItemFields, List<RoleRights> permissionsForRole) {
super();
this.listItemFields = listItemFields;
this.permissionsForRole = permissionsForRole;
this.dataEntryGUIPresentation = dataEntryGUIPresentation;
}
/**
* Gets the data entry GUI presentation.
* Gets the list item fields.
*
* @return the data entry GUI presentation
* @return the list item fields
*/
public DataEntryGUIPresentationConfig getDataEntryGUIPresentation() {
return dataEntryGUIPresentation;
public List<ItemField> getListItemFields() {
return listItemFields;
}
/**
* Sets the data entry GUI presentation.
* Sets the list item fields.
*
* @param dataEntryGUIPresentation the new data entry GUI presentation
* @param listItemFields the new list item fields
*/
public void setDataEntryGUIPresentation(DataEntryGUIPresentationConfig dataEntryGUIPresentation) {
this.dataEntryGUIPresentation = dataEntryGUIPresentation;
public void setListItemFields(List<ItemField> listItemFields) {
this.listItemFields = listItemFields;
}
/**
@ -68,17 +76,18 @@ public class GNADataEntryConfigProfile implements Serializable {
this.permissionsForRole = permissionsForRole;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GNADataEntryConfigProfile [permissionsForRole=");
builder.append(permissionsForRole);
builder.append(", dataEntryGUIPresentation=");
builder.append(dataEntryGUIPresentation);
builder.append("GNADataEntryConfigProfile [listItemFields=");
builder.append(listItemFields);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,6 +1,8 @@
package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* The Class GNADataViewerConfigProfile.
@ -17,6 +19,9 @@ public class GNADataViewerConfigProfile implements Serializable {
private static final long serialVersionUID = 2968334957258327191L;
private String restrictedPortletURL;
private String openPortletURL;
// the key is the layer type
private Map<String, LayerItem> mapLayers;
private List<ItemField> listItemFields;
/**
* Instantiates a new geo na data viewer profile.
@ -61,6 +66,42 @@ public class GNADataViewerConfigProfile implements Serializable {
this.openPortletURL = openPortletURL;
}
/**
* Gets the map layers.
*
* @return the map layers
*/
public Map<String, LayerItem> getMapLayers() {
return mapLayers;
}
/**
* Sets the map layers.
*
* @param mapLayers the map layers
*/
public void setMapLayers(Map<String, LayerItem> mapLayers) {
this.mapLayers = mapLayers;
}
/**
* Gets the list item fields.
*
* @return the list item fields
*/
public List<ItemField> getListItemFields() {
return listItemFields;
}
/**
* Sets the list item fields.
*
* @param listItemFields the new list item fields
*/
public void setListItemFields(List<ItemField> listItemFields) {
this.listItemFields = listItemFields;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@ -68,8 +109,12 @@ public class GNADataViewerConfigProfile implements Serializable {
builder.append(restrictedPortletURL);
builder.append(", openPortletURL=");
builder.append(openPortletURL);
builder.append(", mapLayers=");
builder.append(mapLayers);
builder.append(", listItemFields=");
builder.append(listItemFields);
builder.append("]");
return builder.toString();
}
}

View File

@ -2,14 +2,15 @@ package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
/**
* The Class GeoportalItemReferences.
* The Class GeoNaItemRef.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 18, 2022
* Jul 30, 2021
*/
public class GeoportalItemReferences implements Serializable {
public class GeoNaItemRef implements Serializable {
/**
*
@ -17,73 +18,66 @@ public class GeoportalItemReferences implements Serializable {
private static final long serialVersionUID = -7021431511279022193L;
// this is the mongoID
private String projectID;
private String profileID; // this is the profileID - UCD
private String itemId;
private String itemType;
private String itemName;
private PublicLink restrictedLink;
private PublicLink openLink;
private String layerObjectType;
/**
* Instantiates a new geo na object.
*/
public GeoportalItemReferences() {
public GeoNaItemRef() {
}
/**
* Instantiates a new geo na item ref.
* Instantiates a new geo na object.
*
* @param projectID the project ID
* @param profileID the profile ID
* @param itemId the item id
* @param itemType the item type
*/
public GeoportalItemReferences(String projectID, String profileID) {
public GeoNaItemRef(String itemId, String itemType) {
super();
this.projectID = projectID;
this.profileID = profileID;
this.itemId = itemId;
this.itemType = itemType;
}
/**
* Instantiates a new geo na item ref.
* Gets the item id.
*
* @param projectID the project ID
* @param profileID the profile ID
* @param layerObjectType the layer object type
* @return the item id
*/
public GeoportalItemReferences(String projectID, String profileID, String layerObjectType) {
super();
this.projectID = projectID;
this.profileID = profileID;
this.layerObjectType = layerObjectType;
public String getItemId() {
return itemId;
}
/**
* Gets the profile ID.
* Sets the item id.
*
* @return the profile ID
* @param itemId the new item id
*/
public String getProfileID() {
return profileID;
public void setItemId(String itemId) {
this.itemId = itemId;
}
/**
* Gets the project ID.
* Gets the item type.
*
* @return the project ID
* @return the item type
*/
public String getProjectID() {
return projectID;
public String getItemType() {
return itemType;
}
/**
* Gets the layer object type.
* Sets the item type.
*
* @return the layer object type
* @param itemType the new item type
*/
public String getLayerObjectType() {
return layerObjectType;
public void setItemType(String itemType) {
this.itemType = itemType;
}
/**
@ -148,18 +142,16 @@ public class GeoportalItemReferences implements Serializable {
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GeoportalItemReferences [projectID=");
builder.append(projectID);
builder.append(", profileID=");
builder.append(profileID);
builder.append("GeoNaItemRef [itemId=");
builder.append(itemId);
builder.append(", itemType=");
builder.append(itemType);
builder.append(", itemName=");
builder.append(itemName);
builder.append(", restrictedLink=");
builder.append(restrictedLink);
builder.append(", openLink=");
builder.append(openLink);
builder.append(", layerObjectType=");
builder.append(layerObjectType);
builder.append("]");
return builder.toString();
}

View File

@ -1,69 +1,54 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
import java.util.List;
/**
* The Class ItemFieldDV.
* The Class ItemField.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 16, 2022
* Dec 21, 2021
*/
public class ItemFieldDV implements GeoportalConfigurationID, Serializable {
public class ItemField implements Serializable {
/**
*
*/
private static final long serialVersionUID = -1489912649531434470L;
private static final long serialVersionUID = 1856714668390438433L;
private String displayName;
private List<String> jsonFields;
private String operator;
private boolean displayAsResult;
private boolean sortable;
private boolean searchable;
private String configID;
private boolean displayAsResult;
/**
* Instantiates a new item field.
*/
public ItemFieldDV() {
public ItemField() {
}
/**
* Instantiates a new item field DV.
* Instantiates a new item field.
*
* @param displayName the display name
* @param jsonFields the json fields
* @param operator the operator
* @param displayAsResult the display as result
* @param sortable the sortable
* @param searchable the searchable
*/
public ItemFieldDV(String displayName, List<String> jsonFields, String operator, boolean displayAsResult,
boolean sortable, boolean searchable) {
public ItemField(String displayName, List<String> jsonFields, boolean displayAsResult, boolean sortable,
boolean searchable) {
super();
this.displayName = displayName;
this.jsonFields = jsonFields;
this.operator = operator;
this.displayAsResult = displayAsResult;
this.sortable = sortable;
this.searchable = searchable;
}
@Override
public String getID() {
return configID;
}
@Override
public void setID(String configID) {
this.configID = configID;
}
/**
* Gets the display name.
*
@ -82,42 +67,6 @@ public class ItemFieldDV implements GeoportalConfigurationID, Serializable {
return jsonFields;
}
/**
* Gets the operator.
*
* @return the operator
*/
public String getOperator() {
return operator;
}
/**
* Checks if is display as result.
*
* @return true, if is display as result
*/
public boolean isDisplayAsResult() {
return displayAsResult;
}
/**
* Checks if is sortable.
*
* @return true, if is sortable
*/
public boolean isSortable() {
return sortable;
}
/**
* Checks if is searchable.
*
* @return true, if is searchable
*/
public boolean isSearchable() {
return searchable;
}
/**
* Sets the display name.
*
@ -137,21 +86,12 @@ public class ItemFieldDV implements GeoportalConfigurationID, Serializable {
}
/**
* Sets the operator.
* Checks if is sortable.
*
* @param operator the new operator
* @return true, if is sortable
*/
public void setOperator(String operator) {
this.operator = operator;
}
/**
* Sets the display as result.
*
* @param displayAsResult the new display as result
*/
public void setDisplayAsResult(boolean displayAsResult) {
this.displayAsResult = displayAsResult;
public boolean isSortable() {
return sortable;
}
/**
@ -163,6 +103,15 @@ public class ItemFieldDV implements GeoportalConfigurationID, Serializable {
this.sortable = sortable;
}
/**
* Checks if is searchable.
*
* @return true, if is searchable
*/
public boolean isSearchable() {
return searchable;
}
/**
* Sets the searchable.
*
@ -172,23 +121,42 @@ public class ItemFieldDV implements GeoportalConfigurationID, Serializable {
this.searchable = searchable;
}
/**
* Checks if is display as result.
*
* @return true, if is display as result
*/
public boolean isDisplayAsResult() {
return displayAsResult;
}
/**
* Sets the display as result.
*
* @param displayAsResult the new display as result
*/
public void setDisplayAsResult(boolean displayAsResult) {
this.displayAsResult = displayAsResult;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ItemFieldDV [displayName=");
builder.append("ItemField [displayName=");
builder.append(displayName);
builder.append(", jsonFields=");
builder.append(jsonFields);
builder.append(", operator=");
builder.append(operator);
builder.append(", displayAsResult=");
builder.append(displayAsResult);
builder.append(", sortable=");
builder.append(sortable);
builder.append(", searchable=");
builder.append(searchable);
builder.append(", configID=");
builder.append(configID);
builder.append(", displayAsResult=");
builder.append(displayAsResult);
builder.append("]");
return builder.toString();
}

View File

@ -6,8 +6,7 @@ package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
/**
* The Class ResultSetPaginatedData.
@ -22,7 +21,7 @@ public class ResultSetPaginatedData implements Serializable {
*
*/
private static final long serialVersionUID = 6800997954077785719L;
private List<? extends DocumentDV> data;
private List<ConcessioneDV> data;
private int offset = 0;
private int limit;
private boolean isServerSearchFinished = false;
@ -53,7 +52,7 @@ public class ResultSetPaginatedData implements Serializable {
*
* @return the data
*/
public List<? extends DocumentDV> getData() {
public List<ConcessioneDV> getData() {
return data;
}
@ -89,7 +88,7 @@ public class ResultSetPaginatedData implements Serializable {
*
* @param data the new data
*/
public void setData(List<ResultDocumentDV> data) {
public void setData(List<ConcessioneDV> data) {
this.data = data;
}

View File

@ -1,11 +1,8 @@
package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
/**
* The Class SearchingFilter.
*
@ -82,14 +79,12 @@ public class SearchingFilter implements Serializable {
*/
private static final long serialVersionUID = -4004094263090373626L;
private List<ItemFieldDV> orderByFields;
private List<ItemField> orderByFields;
private ORDER order = ORDER.ASC;
private List<WhereClause> conditions;
private LinkedHashMap<String, Object> projection;
/**
* Instantiates a new sort filter.
*/
@ -97,30 +92,15 @@ public class SearchingFilter implements Serializable {
}
private void addProjectionBaseInfo() {
if (projection != null) {
projection.put("_profileID", 1);
projection.put("_profileVersion", 1);
projection.put("_version", 1);
projection.put("_lifecycleInformation", 1);
projection.put("_info", 1);
projection.put("_relationships", 1);
}
}
/**
* Instantiates a new sort filter.
*
* @param orderByFields the order by fields
* @param order the order
*/
public SearchingFilter(List<ItemFieldDV> orderByFields, ORDER order) {
public SearchingFilter(List<ItemField> orderByFields, ORDER order) {
this.orderByFields = orderByFields;
this.order = order;
if (this.order == null)
order = ORDER.ASC;
}
/**
@ -130,7 +110,7 @@ public class SearchingFilter implements Serializable {
* @param order the order
* @param searchInto the search into
*/
public SearchingFilter(List<ItemFieldDV> orderByFields, ORDER order, List<WhereClause> conditions) {
public SearchingFilter(List<ItemField> orderByFields, ORDER order, List<WhereClause> conditions) {
this.orderByFields = orderByFields;
this.order = order;
this.conditions = conditions;
@ -144,21 +124,12 @@ public class SearchingFilter implements Serializable {
this.conditions = conditions;
}
public void setProjection(LinkedHashMap<String, Object> projection) {
this.projection = projection;
addProjectionBaseInfo();
}
public LinkedHashMap<String, Object> getProjection() {
return projection;
}
/**
* Gets the order by fields.
*
* @return the order by fields
*/
public List<ItemFieldDV> getOrderByFields() {
public List<ItemField> getOrderByFields() {
return orderByFields;
}
@ -176,7 +147,7 @@ public class SearchingFilter implements Serializable {
*
* @param orderByFields the new order by fields
*/
public void setOrderByFields(List<ItemFieldDV> orderByFields) {
public void setOrderByFields(List<ItemField> orderByFields) {
this.orderByFields = orderByFields;
}
@ -198,8 +169,6 @@ public class SearchingFilter implements Serializable {
builder.append(order);
builder.append(", conditions=");
builder.append(conditions);
builder.append(", projection=");
builder.append(projection);
builder.append("]");
return builder.toString();
}

View File

@ -0,0 +1,29 @@
package org.gcube.application.geoportalcommon.shared.config;
/**
* The Class ACTION_ON_ITEM.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 24, 2021
*/
public enum ACTION_ON_ITEM {
CREATE_NEW_PROJECT("Create New Project"),
VIEW_ON_MAP("View on Map"),
SHOW_METADATA("Show Metadata"),
VIEW_REPORT("View the Report"),
EDIT_PROJECT("Edit the Project"),
DELETE_PROJECT("Delete the Project");
String label;
ACTION_ON_ITEM(String label){
this.label = label;
}
public String getLabel() {
return label;
}
}

View File

@ -1,46 +0,0 @@
package org.gcube.application.geoportalcommon.shared.config;
/**
* The Enum OPERATION_ON_ITEM.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 13, 2022
*/
public enum OPERATION_ON_ITEM {
CREATE_NEW_PROJECT("Create New Project"),
VIEW_PROJECT_AS_DOCUMENT("View Project as Document"),
VIEW_PROJECT_AS_JSON("View Projet as JSON"),
VIEW_ON_MAP("View on Map"),
VIEW_REPORT("View the Report"),
EDIT_PROJECT("Edit the Project"),
CLONE_PROJECT("Clone the Project"),
PUBLISH_UNPUBLISH_PROJECT("Publish/UnPublish the Project"),
DELETE_PROJECT("Delete the Project"),
CREATE_RELATION("Create Relation between two Projects"),
DELETE_RELATION("Delete Relation between two Projects"),
VIEW_RELATIONSHIPS("View the relationship/s created for the Project");
String label;
/**
* Instantiates a new operation on item.
*
* @param label the label
*/
OPERATION_ON_ITEM(String label){
this.label = label;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel() {
return label;
}
}

View File

@ -28,7 +28,7 @@ public class RoleRights implements Serializable {
READ, WRITE, READ_WRITE, UNKNOWN
}
private Map<OPERATION_ON_ITEM, OPERATION_TYPE> listPermessions;
private Map<ACTION_ON_ITEM, OPERATION_TYPE> listPermessions;
private GcubeUserRole userRole;
/**
@ -45,7 +45,7 @@ public class RoleRights implements Serializable {
* @param listPermessions the list permessions
* @param userRole the user role
*/
public RoleRights(Map<OPERATION_ON_ITEM, OPERATION_TYPE> listPermessions, GcubeUserRole userRole) {
public RoleRights(Map<ACTION_ON_ITEM, OPERATION_TYPE> listPermessions, GcubeUserRole userRole) {
this.listPermessions = listPermessions;
this.userRole = userRole;
}
@ -55,7 +55,7 @@ public class RoleRights implements Serializable {
*
* @return the list permessions
*/
public Map<OPERATION_ON_ITEM, OPERATION_TYPE> getListPermessions() {
public Map<ACTION_ON_ITEM, OPERATION_TYPE> getListPermessions() {
return listPermessions;
}
@ -73,7 +73,7 @@ public class RoleRights implements Serializable {
*
* @param listPermessions the list permessions
*/
public void setListPermessions(Map<OPERATION_ON_ITEM, OPERATION_TYPE> listPermessions) {
public void setListPermessions(Map<ACTION_ON_ITEM, OPERATION_TYPE> listPermessions) {
this.listPermessions = listPermessions;
}

View File

@ -1,55 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GeoportalConfigurationID;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_CONFIGURATION_TYPE;
public class ConfigurationDV<T extends List<? extends GeoportalConfigurationID>> implements Serializable {
/**
*
*/
private static final long serialVersionUID = 4836713840177636940L;
private T configuration;
private GEOPORTAL_CONFIGURATION_TYPE configurationType;
public ConfigurationDV() {
}
public ConfigurationDV(T configuration) {
this.configuration = configuration;
}
public GEOPORTAL_CONFIGURATION_TYPE getConfigurationType() {
return configurationType;
}
public void setConfigurationType(GEOPORTAL_CONFIGURATION_TYPE configurationType) {
this.configurationType = configurationType;
}
public T getConfiguration() {
return configuration;
}
public void setConfiguration(T config) {
this.configuration = config;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ConfigurationDV [configuration=");
builder.append(configuration);
builder.append(", configurationType=");
builder.append(configurationType);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,77 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
public class DocumentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 4978517506036855883L;
protected LinkedHashMap<String, Object> documentAsMap;
private String documentAsJSON;
private ConfigurationDV<?> configuration;
private String projectID;
public DocumentDV() {
}
public LinkedHashMap<String, Object> getDocumentAsMap() {
return documentAsMap;
}
public Entry<String, Object> getFirstEntryOfMap() {
if (documentAsMap != null && documentAsMap.size() >= 1) {
return documentAsMap.entrySet().iterator().next();
}
return null;
}
public String getProjectID() {
return projectID;
}
public void setProjectID(String projectID) {
this.projectID = projectID;
}
public String getDocumentAsJSON() {
return documentAsJSON;
}
public void setDocumentAsMap(LinkedHashMap<String, Object> documentAsMap) {
this.documentAsMap = documentAsMap;
}
public void setDocumentAsJSON(String documentAsJSON) {
this.documentAsJSON = documentAsJSON;
}
public ConfigurationDV<?> getConfiguration() {
return configuration;
}
public void setConfiguration(ConfigurationDV<?> configuration) {
this.configuration = configuration;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DocumentDV [documentAsMap=");
builder.append(documentAsMap);
builder.append(", documentAsJSON=");
builder.append(documentAsJSON);
builder.append(", configuration=");
builder.append(configuration);
builder.append(", projectID=");
builder.append(projectID);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,117 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.project.BasicLifecycleInformationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.PublicationInfoDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
public class ResultDocumentDV extends DocumentDV implements Serializable {
private String id;
private String profileID;
private BasicLifecycleInformationDV lifecycleInfo;
private PublicationInfoDV publicationInfoDV;
private List<RelationshipDV> listRelationshipDV;
private GeoJSON spatialReference;
private WORKFLOW_PHASE worflowPhase; //never used. Just for serialization in GWT
/**
*
*/
private static final long serialVersionUID = -7209592503036632772L;
public ResultDocumentDV() {
}
public String getId() {
return id;
}
public String getProfileID() {
return profileID;
}
public void setId(String id) {
this.id = id;
}
public void setProfileID(String profileID) {
this.profileID = profileID;
}
public void addItemToMap(String property, Object value) {
if (documentAsMap == null)
documentAsMap = new LinkedHashMap<String, Object>();
documentAsMap.put(property, value);
}
public BasicLifecycleInformationDV getLifecycleInfo() {
return lifecycleInfo;
}
public void setLifecycleInfo(BasicLifecycleInformationDV lifecycleInfo) {
this.lifecycleInfo = lifecycleInfo;
}
public void setListRelationship(List<RelationshipDV> listRelationshipDV) {
this.listRelationshipDV = listRelationshipDV;
}
public void setPublicationInfoDV(PublicationInfoDV publicationInfoDV) {
this.publicationInfoDV = publicationInfoDV;
}
public void setListRelationshipDV(List<RelationshipDV> listRelationshipDV) {
this.listRelationshipDV = listRelationshipDV;
}
public List<RelationshipDV> getListRelationshipDV() {
return listRelationshipDV;
}
public void setPublicationInfo(PublicationInfoDV publicationInfoDV) {
this.publicationInfoDV = publicationInfoDV;
}
public PublicationInfoDV getPublicationInfoDV() {
return publicationInfoDV;
}
public GeoJSON getSpatialReference() {
return spatialReference;
}
public void setSpatialReference(GeoJSON spatialReference) {
this.spatialReference = spatialReference;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ResultDocumentDV [id=");
builder.append(id);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", lifecycleInfo=");
builder.append(lifecycleInfo);
builder.append(", publicationInfoDV=");
builder.append(publicationInfoDV);
builder.append(", listRelationshipDV=");
builder.append(listRelationshipDV);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,35 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal;
/**
* The Enum WORKFLOW_PHASE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 19, 2023
*/
public enum WORKFLOW_PHASE {
PUBLISHED("Published"), //Should be always the last one
DRAFT("Draft");
private String label;
/**
* Instantiates a new workflow phase.
*
* @param label the label
*/
WORKFLOW_PHASE(String label) {
this.label = label;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel() {
return label;
}
}

View File

@ -1,117 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class ActionDefinitionDV implements GeoportalConfigurationID, Serializable {
/**
*
*/
private static final long serialVersionUID = 6071900142588642601L;
private String id;
private String title;
private String[] callSteps;
private String description;
private String[] displayOnPhase;
private String configID;
public Set<String> roles = new HashSet<String>(); //No role/s defined means enable the action by default
public ActionDefinitionDV() {
}
@Override
public String getID() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setID(String configID) {
// TODO Auto-generated method stub
}
public String getId() {
return id;
}
public String getTitle() {
return title;
}
public String[] getCallSteps() {
return callSteps;
}
public String getDescription() {
return description;
}
public String[] getDisplayOnPhase() {
return displayOnPhase;
}
public String getConfigID() {
return configID;
}
public void setId(String id) {
this.id = id;
}
public void setTitle(String title) {
this.title = title;
}
public void setCallSteps(String[] callSteps) {
this.callSteps = callSteps;
}
public void setDescription(String description) {
this.description = description;
}
public void setDisplayOnPhase(String[] displayOnPhase) {
this.displayOnPhase = displayOnPhase;
}
public void setConfigID(String configID) {
this.configID = configID;
}
public Set<String> getRoles() {
return roles;
}
public void setRoles(Set<String> roles) {
this.roles = roles;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ActionDefinitionDV [id=");
builder.append(id);
builder.append(", title=");
builder.append(title);
builder.append(", callSteps=");
builder.append(Arrays.toString(callSteps));
builder.append(", description=");
builder.append(description);
builder.append(", displayOnPhase=");
builder.append(Arrays.toString(displayOnPhase));
builder.append(", configID=");
builder.append(configID);
builder.append(", roles=");
builder.append(roles);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,56 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
import java.io.Serializable;
public class FilePathDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -9186437393759442989L;
private String gcubeProfileFieldName;
private String fieldName;
private String fieldDefinition;
public FilePathDV() {
}
public String getGcubeProfileFieldName() {
return gcubeProfileFieldName;
}
public void setGcubeProfileFieldName(String gcubeProfileFieldName) {
this.gcubeProfileFieldName = gcubeProfileFieldName;
}
public String getFieldName() {
return fieldName;
}
public String getFieldDefinition() {
return fieldDefinition;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public void setFieldDefinition(String fieldDefinition) {
this.fieldDefinition = fieldDefinition;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FilePathDV [gcubeProfileFieldName=");
builder.append(gcubeProfileFieldName);
builder.append(", fieldName=");
builder.append(fieldName);
builder.append(", fieldDefinition=");
builder.append(fieldDefinition);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,240 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
import java.io.Serializable;
import java.util.List;
/**
* The Class GcubeProfileDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 7, 2022
*/
public class GcubeProfileDV implements GeoportalConfigurationID, Serializable {
/**
*
*/
private static final long serialVersionUID = -6177379075015880565L;
public static final int MIN_MAX_NOT_SPECIFIED = -1;
private String configID;
private String gcubeSecondaryType;
private String gcubeName;
private String sectionName;
private String sectionTitle;
private String parentName;
/**
* 0: Not specified means Not Mandatory. The Gcube Profile is not mandatory and
* means that all its fields must be optional in the gCube Meta Profile. N: is
* the MIN number of Occurrences Default is 1 occurrence
*/
private int minOccurs = 1;
/**
* 0: Not specified means max number of Occurrences is arbitrary. N: is the MAX
* number of Occurrences
*/
private int maxOccurs = 1;
private List<FilePathDV> filePaths;
/**
* Instantiates a new gcube profile DV.
*/
public GcubeProfileDV() {
}
@Override
public String getID() {
return configID;
}
@Override
public void setID(String configID) {
this.configID = configID;
}
/**
* Gets the gcube secondary type.
*
* @return the gcube secondary type
*/
public String getGcubeSecondaryType() {
return gcubeSecondaryType;
}
/**
* Gets the gcube name.
*
* @return the gcube name
*/
public String getGcubeName() {
return gcubeName;
}
/**
* Gets the section name.
*
* @return the section name
*/
public String getSectionName() {
return sectionName;
}
/**
* Gets the section title.
*
* @return the section title
*/
public String getSectionTitle() {
return sectionTitle;
}
/**
* Gets the parent name. If is null or empty return the "" /(empty string) as
* default.
*
* @return the parent name
*/
public String getParentName() {
if (parentName == null)
return "";
return parentName;
}
/**
* Gets the min occurs.
*
* @return the min occurs
*/
public int getMinOccurs() {
return minOccurs;
}
/**
* Gets the max occurs.
*
* @return the max occurs
*/
public int getMaxOccurs() {
return maxOccurs;
}
/**
* Gets the file paths.
*
* @return the file paths
*/
public List<FilePathDV> getFilePaths() {
return filePaths;
}
/**
* Sets the gcube secondary type.
*
* @param gcubeSecondaryType the new gcube secondary type
*/
public void setGcubeSecondaryType(String gcubeSecondaryType) {
this.gcubeSecondaryType = gcubeSecondaryType;
}
/**
* Sets the gcube name.
*
* @param gcubeName the new gcube name
*/
public void setGcubeName(String gcubeName) {
this.gcubeName = gcubeName;
}
/**
* Sets the section name.
*
* @param sectionName the new section name
*/
public void setSectionName(String sectionName) {
this.sectionName = sectionName;
}
/**
* Sets the section title.
*
* @param sectionTitle the new section title
*/
public void setSectionTitle(String sectionTitle) {
this.sectionTitle = sectionTitle;
}
/**
* Sets the parent name.
*
* @param parentName the new parent name
*/
public void setParentName(String parentName) {
this.parentName = parentName;
}
/**
* Sets the min occurs.
*
* @param minOccurs the new min occurs
*/
public void setMinOccurs(int minOccurs) {
this.minOccurs = minOccurs;
}
/**
* Sets the max occurs.
*
* @param maxOccurs the new max occurs
*/
public void setMaxOccurs(int maxOccurs) {
this.maxOccurs = maxOccurs;
}
/**
* Sets the file paths.
*
* @param filePaths the new file paths
*/
public void setFilePaths(List<FilePathDV> filePaths) {
this.filePaths = filePaths;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GcubeProfileDV [gcubeSecondaryType=");
builder.append(gcubeSecondaryType);
builder.append(", gcubeName=");
builder.append(gcubeName);
builder.append(", sectionName=");
builder.append(sectionName);
builder.append(", sectionTitle=");
builder.append(sectionTitle);
builder.append(", parentName=");
builder.append(parentName);
builder.append(", minOccurs=");
builder.append(minOccurs);
builder.append(", maxOccurs=");
builder.append(maxOccurs);
builder.append(", filePaths=");
builder.append(filePaths);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,9 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
public interface GeoportalConfigurationID {
String getID();
void setID(String configID);
}

View File

@ -1,82 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The Class GroupedLayersDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 12, 2023
*/
public class GroupedLayersDV<T extends LayerIDV> implements Serializable, GeoportalConfigurationID {
/**
*
*/
private static final long serialVersionUID = -2021774489849084231L;
private String name;
private String description;
@JsonProperty(value = "layers")
private List<T> listCustomLayers;
@Override
public String getID() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setID(String configID) {
// TODO Auto-generated method stub
}
public GroupedLayersDV() {
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public List<T> getListCustomLayers() {
return listCustomLayers;
}
public void setName(String name) {
this.name = name;
}
public void setDescription(String description) {
this.description = description;
}
public void setListCustomLayers(List<T> listCustomLayers) {
this.listCustomLayers = listCustomLayers;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GroupedLayersDV [name=");
builder.append(name);
builder.append(", description=");
builder.append(description);
builder.append(", listCustomLayers=");
builder.append(listCustomLayers);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,98 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config.layers;
import java.io.Serializable;
/**
* The Class ConfiguredLayerDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 12, 2023
*/
public class ConfiguredLayerDV implements LayerIDV, Serializable{
/**
*
*/
private static final long serialVersionUID = 6910607957385140987L;
private String title;
private String description;
private String name;
private String wms_url;
private String wfs_url;
boolean display = false;
public ConfiguredLayerDV() {
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public String getName() {
return name;
}
public String getWMS_URL() {
return wms_url;
}
public String getWFS_URL() {
return wfs_url;
}
public boolean isDisplay() {
return display;
}
public void setTitle(String title) {
this.title = title;
}
public void setDescription(String description) {
this.description = description;
}
public void setName(String name) {
this.name = name;
}
public void setWms_url(String wms_url) {
this.wms_url = wms_url;
}
public void setWfs_url(String wfs_url) {
this.wfs_url = wfs_url;
}
public void setDisplay(boolean display) {
this.display = display;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ConfiguredLayerDV [title=");
builder.append(title);
builder.append(", description=");
builder.append(description);
builder.append(", name=");
builder.append(name);
builder.append(", wms_url=");
builder.append(wms_url);
builder.append(", wfs_url=");
builder.append(wfs_url);
builder.append(", display=");
builder.append(display);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,78 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config.layers;
import java.util.List;
public class CrossFilteringLayerDV extends ConfiguredLayerDV {
/**
*
*/
private static final long serialVersionUID = 1130075528037312939L;
String table_show_field;
String table_key_field;
String table_parent_key_field;
String table_geometry_name;
List<CrossFilteringLayerDV> related_to;
public CrossFilteringLayerDV() {
}
public String getTable_show_field() {
return table_show_field;
}
public String getTable_key_field() {
return table_key_field;
}
public String getTable_parent_key_field() {
return table_parent_key_field;
}
public String getTable_geometry_name() {
return table_geometry_name;
}
public List<CrossFilteringLayerDV> getRelated_to() {
return related_to;
}
public void setTable_show_field(String table_show_field) {
this.table_show_field = table_show_field;
}
public void setTable_key_field(String table_key_field) {
this.table_key_field = table_key_field;
}
public void setTable_parent_key_field(String table_parent_key_field) {
this.table_parent_key_field = table_parent_key_field;
}
public void setTable_geometry_name(String table_geometry_name) {
this.table_geometry_name = table_geometry_name;
}
public void setRelated_to(List<CrossFilteringLayerDV> related_to) {
this.related_to = related_to;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CrossFilteringLayerDV [table_show_field=");
builder.append(table_show_field);
builder.append(", table_key_field=");
builder.append(table_key_field);
builder.append(", table_parent_key_field=");
builder.append(table_parent_key_field);
builder.append(", table_geometry_name=");
builder.append(table_geometry_name);
builder.append(", related_to=");
builder.append(related_to);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,10 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config.layers;
public interface LayerIDV {
String getName();
String getTitle();
String getWMS_URL();
String getWFS_URL();
}

View File

@ -1,67 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.geojson;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Crs implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8848168371106854638L;
public Crs(){
}
@JsonProperty
private String type;
@JsonProperty
private Map<String, Object> properties = new HashMap<String, Object>();
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public Map<String, Object> getProperties() {
return properties;
}
public void setProperties(Map<String, Object> properties) {
this.properties = properties;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Crs)) {
return false;
}
Crs crs = (Crs) o;
if (properties != null ? !properties.equals(crs.properties) : crs.properties != null) {
return false;
}
return !(type != null ? !type.equals(crs.type) : crs.type != null);
}
@Override
public int hashCode() {
int result = type != null ? type.hashCode() : 0;
result = 31 * result + (properties != null ? properties.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "Crs{" + "type='" + type + '\'' + ", properties=" + properties + '}';
}
}

View File

@ -1,74 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.geojson;
import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
public class GeoJSON implements Serializable {
public static final String TYPE = "type";
public static final String BBOX = "bbox";
public static final String CRS = "crs";
public static final String COORDINATES = "coordinates";
/**
*
*/
private static final long serialVersionUID = -7798331554142534921L;
private String type;
private Crs crs;
private BBOXDV bbox;
private String geoJSON;
public GeoJSON() {
}
public String getType() {
return type;
}
public Crs getCrs() {
return crs;
}
public BBOXDV getBbox() {
return bbox;
}
public String getGeoJSON() {
return geoJSON;
}
public void setType(String type) {
this.type = type;
}
public void setCrs(Crs crs) {
this.crs = crs;
}
public void setBbox(BBOXDV bbox) {
this.bbox = bbox;
}
public void setGeoJSON(String geoJSON) {
this.geoJSON = geoJSON;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GeoJSON [type=");
builder.append(type);
builder.append(", crs=");
builder.append(crs);
builder.append(", bbox=");
builder.append(bbox);
builder.append(", geoJSON=");
builder.append(geoJSON);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,80 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
import com.fasterxml.jackson.annotation.JsonProperty;
public class GCubeSDILayer implements Serializable {
// TODO manage heterogeneus collection
/**
*
*/
private static final long serialVersionUID = 5317964084778336268L;
@JsonProperty(value = "_type")
private String type;
@JsonProperty(value = "_platformInfo")
private List<GeoServerPlatformInfoDV> platformInfos;
@JsonProperty(value = "_bbox")
private BBOXDV bbox;
@JsonProperty(value = "_ogcLinks")
private HashMap<String, String> ogcLinks;
public GCubeSDILayer() {
}
public String getType() {
return type;
}
public List<GeoServerPlatformInfoDV> getPlatformInfos() {
return platformInfos;
}
public BBOXDV getBbox() {
return bbox;
}
public HashMap<String, String> getOgcLinks() {
return ogcLinks;
}
public void setType(String type) {
this.type = type;
}
public void setPlatformInfos(List<GeoServerPlatformInfoDV> platformInfos) {
this.platformInfos = platformInfos;
}
public void setBbox(BBOXDV bbox) {
this.bbox = bbox;
}
public void setOgcLinks(HashMap<String, String> ogcLinks) {
this.ogcLinks = ogcLinks;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GCubeSDILayer [type=");
builder.append(type);
builder.append(", platformInfos=");
builder.append(platformInfos);
builder.append(", bbox=");
builder.append(bbox);
builder.append(", ogcLinks=");
builder.append(ogcLinks);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,78 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
import java.io.Serializable;
import java.util.HashMap;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
public class GCubeSDIViewerLayerDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6620710416056942397L;
private String type;
private BBOXDV bbox;
private HashMap<String, String> ogcLinks;
private String layerName;
public GCubeSDIViewerLayerDV() {
}
public String getType() {
return type;
}
public BBOXDV getBbox() {
return bbox;
}
public HashMap<String, String> getOgcLinks() {
return ogcLinks;
}
public String getWMSLink() {
if (ogcLinks != null) {
return ogcLinks.get("wms");
}
return null;
}
public void setType(String type) {
this.type = type;
}
public void setBbox(BBOXDV bbox) {
this.bbox = bbox;
}
public void setOgcLinks(HashMap<String, String> ogcLinks) {
this.ogcLinks = ogcLinks;
}
public void setLayerName(String layerName) {
this.layerName = layerName;
}
public String getLayerName() {
return layerName;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GCubeSDIViewerLayerDV [type=");
builder.append(type);
builder.append(", bbox=");
builder.append(bbox);
builder.append(", ogcLinks=");
builder.append(ogcLinks);
builder.append(", layerName=");
builder.append(layerName);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,85 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
import java.io.Serializable;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
public class GeoServerPlatformInfoDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2630467451758269625L;
@JsonProperty(value = "_type")
private String type;
private String workspace;
private String storeName;
@JsonProperty(value = "_host")
private String host;
private Map<String, String> ogcLinks;
public GeoServerPlatformInfoDV() {
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getWorkspace() {
return workspace;
}
public void setWorkspace(String workspace) {
this.workspace = workspace;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public Map<String, String> getOgcLinks() {
return ogcLinks;
}
public void setOgcLinks(Map<String, String> ogcLinks) {
this.ogcLinks = ogcLinks;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GeoServerPlatformInfoDV [type=");
builder.append(type);
builder.append(", workspace=");
builder.append(workspace);
builder.append(", storeName=");
builder.append(storeName);
builder.append(", host=");
builder.append(host);
builder.append(", ogcLinks=");
builder.append(ogcLinks);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,83 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonProperty;
public class IndexLayerDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 5352754312327975329L;
@JsonProperty(value = "_type")
private String type;
private GCubeSDILayer layer;
private String indexName;
private int records;
private String flag;
public IndexLayerDV() {
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public GCubeSDILayer getLayer() {
return layer;
}
public void setLayer(GCubeSDILayer layer) {
this.layer = layer;
}
public String getIndexName() {
return indexName;
}
public void setIndexName(String indexName) {
this.indexName = indexName;
}
public int getRecords() {
return records;
}
public void setRecords(int records) {
this.records = records;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("IndexLayerDV [type=");
builder.append(type);
builder.append(", layer=");
builder.append(layer);
builder.append(", indexName=");
builder.append(indexName);
builder.append(", records=");
builder.append(records);
builder.append(", flag=");
builder.append(flag);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,186 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject;
import java.io.Serializable;
import java.util.HashMap;
public class BBOXDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4438327945612263171L;
public static final String MAX_X = "_maxX";
public static final String MAX_Y = "_maxY";
public static final String MAX_Z = "_maxZ";
public static final String MIN_X = "_minX";
public static final String MIN_Y = "_minY";
public static final String MIN_Z = "_minZ";
public static final BBOXDV WORLD = new BBOXDV(180d, -180d, 90d, -90d);
public static final BBOXDV WORLD_3D = new BBOXDV(180d, -180d, 90d, -90d);
private HashMap<String, Double> bbox = new HashMap<String, Double>();
public BBOXDV() {
}
public BBOXDV(Double maxX, Double minX, Double maxY, Double minY) {
setMaxX(maxX);
setMinX(minX);
setMaxY(maxY);
setMinY(minY);
}
public BBOXDV(Double maxX, Double minX, Double maxY, Double minY, Double maxZ, Double minZ) {
this(maxX, minX, maxY, minY);
setMaxZ(maxZ);
setMinZ(minZ);
}
public BBOXDV(HashMap<String, Object> hash) {
setMaxX(toDouble(hash.get(MAX_X)));
setMaxY(toDouble(hash.get(MAX_Y)));
setMinX(toDouble(hash.get(MIN_X)));
setMinY(toDouble(hash.get(MIN_Y)));
setMinZ(toDouble(hash.get(MIN_Z)));
setMaxZ(toDouble(hash.get(MAX_Z)));
}
private Double toDouble(Object toDouble) {
try {
return new Double((double) toDouble);
} catch (Exception e) {
// System.out.println(toDouble + " is not castable to " +
// Double.class.getSimpleName());
}
return null;
}
public static final BBOXDV fromGeoJSON(double[] coords) {
BBOXDV toReturn = new BBOXDV();
toReturn.setMaxX(coords[0]);
toReturn.setMinY(coords[1]);
if (coords.length == 6) {
// 3D
toReturn.setMinZ(coords[2]);
toReturn.setMinX(coords[3]);
toReturn.setMaxY(coords[4]);
toReturn.setMaxZ(coords[5]);
} else {
toReturn.setMinX(coords[2]);
toReturn.setMaxY(coords[3]);
}
return toReturn;
}
public BBOXDV setMaxX(Double d) {
this.bbox.put(MAX_X, d);
return this;
}
public BBOXDV setMaxY(Double d) {
this.bbox.put(MAX_Y, d);
return this;
}
public BBOXDV setMaxZ(Double d) {
this.bbox.put(MAX_Z, d);
return this;
}
public BBOXDV setMinX(Double d) {
this.bbox.put(MIN_X, d);
return this;
}
public BBOXDV setMinY(Double d) {
this.bbox.put(MIN_Y, d);
return this;
}
public BBOXDV setMinZ(Double d) {
this.bbox.put(MIN_Z, d);
return this;
}
public Double getMinY() {
try {
return this.bbox.get(MIN_Y);
} catch (Exception e) {
}
return new Double(-90d);
}
public Double getMaxY() {
try {
return this.bbox.get(MAX_Y);
} catch (Exception e) {
}
return new Double(90d);
}
public Double getMinX() {
try {
return this.bbox.get(MIN_X);
} catch (Exception e) {
}
return new Double(-180d);
}
public Double getMaxX() {
try {
return this.bbox.get(MAX_X);
} catch (Exception e) {
}
return new Double(180d);
}
public Double getMinZ() {
return (Double) this.bbox.getOrDefault(MIN_Z, null);
}
public Double getMaxZ() {
return (Double) this.bbox.getOrDefault(MAX_Z, null);
}
public Boolean is3d() {
return getMinZ() != null && getMaxZ() != null;
}
public final String asGeoJSONBBox() {
StringBuilder builder = new StringBuilder("[");
builder.append(getMaxX() + ","); // W
builder.append(getMinY() + ","); // S
if (is3d())
builder.append(getMinZ() + ","); // Z
builder.append(getMinX() + ","); // E
builder.append(getMaxY() + ","); // N
if (is3d())
builder.append(getMaxZ() + ","); // Z
builder.deleteCharAt(builder.length());
builder.append("]");
return builder.toString();
}
public double[] asGeoJSONArray() {
if (is3d()) {
return new double[] { getMaxX(), getMinY(), getMinZ(), getMinX(), getMaxY(), getMaxZ() };
} else
return new double[] { getMaxX(), getMinY(), getMinX(), getMaxY() };
}
}

View File

@ -1,65 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class FilesetDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -3108729581669778828L;
private String gcubeProfileFieldName; // It is the gcubeProfileFieldName in the UCD filePaths
private String filesetFieldName; // It is the fieldName in the UCD filePaths
private List<PayloadDV> listPayloads = new ArrayList<PayloadDV>();
public FilesetDV() {
}
public String getFilesetFieldName() {
return filesetFieldName;
}
public void setFilesetFieldName(String filesetFieldName) {
this.filesetFieldName = filesetFieldName;
}
public String getGcubeProfileFieldName() {
return gcubeProfileFieldName;
}
public void setGcubeProfileFieldName(String name) {
this.gcubeProfileFieldName = name;
}
public List<PayloadDV> getListPayload() {
return listPayloads;
}
public void addPayloadDV(PayloadDV payloadDV) {
listPayloads.add(payloadDV);
}
public void addListPayloadsDV(List<PayloadDV> listPayloadsDV) {
listPayloads.addAll(listPayloadsDV);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FilesetDV [gcubeProfileFieldName=");
builder.append(gcubeProfileFieldName);
builder.append(", filesetFieldName=");
builder.append(filesetFieldName);
builder.append(", listPayloads=");
builder.append(listPayloads);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,72 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject;
import java.io.Serializable;
public class PayloadDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -1638565659484691126L;
private String mimetype;
private String storageID;
private String link;
private String name;
public PayloadDV() {
}
public String getMimetype() {
return mimetype;
}
public String getStorageID() {
return storageID;
}
public String getLink() {
return link;
}
public String getName() {
return name;
}
public void setMimetype(String mimetype) {
this.mimetype = mimetype;
}
public void setStorageID(String storageID) {
this.storageID = storageID;
}
public void setLink(String link) {
this.link = link;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Payload [mimetype=");
builder.append(mimetype);
builder.append(", storageID=");
builder.append(storageID);
builder.append(", link=");
builder.append(link);
builder.append(", name=");
builder.append(name);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,83 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
/**
* The Class AccessDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 10, 2022
*/
public class AccessDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8017931037814730958L;
private String policy;
private String license;
/**
* Instantiates a new access DV.
*/
public AccessDV() {
}
/**
* Gets the policy.
*
* @return the policy
*/
public String getPolicy() {
return policy;
}
/**
* Gets the license.
*
* @return the license
*/
public String getLicense() {
return license;
}
/**
* Sets the policy.
*
* @param policy the new policy
*/
public void setPolicy(String policy) {
this.policy = policy;
}
/**
* Sets the license.
*
* @param license the new license
*/
public void setLicense(String license) {
this.license = license;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AccessDV [policy=");
builder.append(policy);
builder.append(", license=");
builder.append(license);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,108 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
import java.util.Set;
/**
* The Class AccountingInfoDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 10, 2022
*/
public class AccountingInfoDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -5676731760855130687L;
private String username;
private Set<String> roles;
private String context;
private String localDate;
/**
* Instantiates a new accounting info DV.
*/
public AccountingInfoDV() {
}
/**
* Gets the username.
*
* @return the username
*/
public String getUsername() {
return username;
}
/**
* Gets the roles.
*
* @return the roles
*/
public Set<String> getRoles() {
return roles;
}
/**
* Gets the context.
*
* @return the context
*/
public String getContext() {
return context;
}
/**
* Sets the username.
*
* @param username the new username
*/
public void setUsername(String username) {
this.username = username;
}
/**
* Sets the roles.
*
* @param roles the new roles
*/
public void setRoles(Set<String> roles) {
this.roles = roles;
}
/**
* Sets the context.
*
* @param context the new context
*/
public void setContext(String context) {
this.context = context;
}
public String getLocalDate() {
return localDate;
}
public void setLocalDate(String localDate) {
this.localDate = localDate;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AccountingInfoDV [username=");
builder.append(username);
builder.append(", roles=");
builder.append(roles);
builder.append(", context=");
builder.append(context);
builder.append(", localDate=");
builder.append(localDate);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,112 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
/**
* The Class BasicLifecycleInformationDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 10, 2022
*/
public class BasicLifecycleInformationDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2301238401365921132L;
/**
* The Enum Status.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 21, 2022
*/
public static enum Status {
OK("Success"), ERROR("Error"), WARNING("Warning"), NOT_SPECIFIED("Not specified");
private String label;
/**
* Instantiates a new status.
*
* @param label the label
*/
private Status(String label) {
this.label = label;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel() {
return label;
}
}
protected String phase;
protected Status lastOperationStatus;
/**
* Instantiates a new basic lifecycle information DV.
*/
public BasicLifecycleInformationDV() {
}
/**
* Gets the phase.
*
* @return the phase
*/
public String getPhase() {
return phase;
}
/**
* Gets the last operation status.
*
* @return the last operation status
*/
public Status getLastOperationStatus() {
return lastOperationStatus;
}
/**
* Sets the phase.
*
* @param phase the new phase
*/
public void setPhase(String phase) {
this.phase = phase;
}
/**
* Sets the last operation status.
*
* @param lastOperationStatus the new last operation status
*/
public void setLastOperationStatus(Status lastOperationStatus) {
this.lastOperationStatus = lastOperationStatus;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("BasicLifecycleInformationDV [phase=");
builder.append(phase);
builder.append(", lastOperationStatus=");
builder.append(lastOperationStatus);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,46 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
public class IdentificationReferenceDV extends DocumentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4038859146891291745L;
private String type;
public IdentificationReferenceDV() {
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public IdentificationReferencesTYPE asIdentificationReferencesTYPE() {
try {
return IdentificationReferencesTYPE.valueOf(type);
} catch (Exception e) {
}
return null;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("IdentificationReferenceDV [type=");
builder.append(type);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,35 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
/**
* The Enum IdentificationReferencesTYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 26, 2022
*/
public enum IdentificationReferencesTYPE {
SPATIAL_REFERENCE("SPATIAL REFERENCE");
String type;
/**
* Instantiates a new identification references TYPE.
*
* @param type the type
*/
IdentificationReferencesTYPE(String type) {
this.type = type;
}
/**
* Gets the type.
*
* @return the type
*/
public String getType() {
return type;
}
}

View File

@ -1,200 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.util.List;
/**
* The Class LifecycleInformationDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 21, 2022
*/
public class LifecycleInformationDV extends BasicLifecycleInformationDV {
/**
*
*/
private static final long serialVersionUID = 3042285563158430778L;
private String lastInvokedStep;
private List<String> errorMessages;
private List<String> warningMessages;
private String asJSONString;
private String lastEvent;
/**
* Instantiates a new lifecycle information DV.
*/
public LifecycleInformationDV() {
}
/**
* Instantiates a new lifecycle information DV.
*
* @param lastInvokedStep the last invoked step
* @param errorMessages the error messages
* @param warningMessages the warning messages
* @param asJSONString the as JSON string
* @param lastEvent the last event
*/
public LifecycleInformationDV(String lastInvokedStep, List<String> errorMessages, List<String> warningMessages,
String asJSONString, String lastEvent) {
super();
this.lastInvokedStep = lastInvokedStep;
this.errorMessages = errorMessages;
this.warningMessages = warningMessages;
this.asJSONString = asJSONString;
this.lastEvent = lastEvent;
}
/**
* Gets the phase.
*
* @return the phase
*/
public String getPhase() {
return phase;
}
/**
* Gets the last invoked step.
*
* @return the last invoked step
*/
public String getLastInvokedStep() {
return lastInvokedStep;
}
/**
* Gets the last operation status.
*
* @return the last operation status
*/
public Status getLastOperationStatus() {
return lastOperationStatus;
}
/**
* Gets the error messages.
*
* @return the error messages
*/
public List<String> getErrorMessages() {
return errorMessages;
}
/**
* Gets the warning messages.
*
* @return the warning messages
*/
public List<String> getWarningMessages() {
return warningMessages;
}
/**
* Sets the phase.
*
* @param phase the new phase
*/
public void setPhase(String phase) {
this.phase = phase;
}
/**
* Sets the last invoked step.
*
* @param lastInvokedStep the new last invoked step
*/
public void setLastInvokedStep(String lastInvokedStep) {
this.lastInvokedStep = lastInvokedStep;
}
/**
* Sets the last operation status.
*
* @param lastOperationStatus the new last operation status
*/
public void setLastOperationStatus(Status lastOperationStatus) {
this.lastOperationStatus = lastOperationStatus;
}
/**
* Sets the error messages.
*
* @param errorMessages the new error messages
*/
public void setErrorMessages(List<String> errorMessages) {
this.errorMessages = errorMessages;
}
/**
* Sets the warning messages.
*
* @param warningMessages the new warning messages
*/
public void setWarningMessages(List<String> warningMessages) {
this.warningMessages = warningMessages;
}
/**
* Sets the as JSON string.
*
* @param json the new as JSON string
*/
public void setAsJSONString(String json) {
this.asJSONString = json;
}
/**
* Sets the last event.
*
* @param lastEvent the new last event
*/
public void setLastEvent(String lastEvent) {
this.lastEvent = lastEvent;
}
/**
* Gets the last event.
*
* @return the last event
*/
public String getLastEvent() {
return lastEvent;
}
/**
* Gets the as JSON string.
*
* @return the as JSON string
*/
public String getAsJSONString() {
return asJSONString;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("LifecycleInformationDV [lastInvokedStep=");
builder.append(lastInvokedStep);
builder.append(", errorMessages=");
builder.append(errorMessages);
builder.append(", warningMessages=");
builder.append(warningMessages);
builder.append(", asJSONString=");
builder.append(asJSONString);
builder.append(", lastEvent=");
builder.append(lastEvent);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,35 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class PhaseDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -1894531938705738017L;
private Integer count;
private Phase_Id _id;
public PhaseDV() {
}
@Data
@AllArgsConstructor
class Phase_Id {
String phase;
String status;
public Phase_Id() {
}
}
}

View File

@ -1,154 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
public class ProjectDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6296612945369540613L;
private String id;
private String version;
// private PublicationInfo info;
private String profileID; // the profile == UCD
private String profileVersion; // the profile == UCD
private String profileName;
private List<RelationshipDV> relationships;
private DocumentDV theDocument;
// the key is the IdentificationReferenceDV.getType()
private Map<String, IdentificationReferenceDV> mapIdentReferenceDV;
private LifecycleInformationDV lifecycleInformationDV;
// Shortcut to "SPATIAL REFERENCE" containted into IdentificationReferenceDV
private GeoJSON spatialReference;
private TemporalReferenceDV temporalReference;
public ProjectDV() {
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public String getId() {
return id;
}
public String getVersion() {
return version;
}
public String getProfileID() {
return profileID;
}
public String getProfileVersion() {
return profileVersion;
}
public List<RelationshipDV> getRelationships() {
return relationships;
}
public DocumentDV getTheDocument() {
return theDocument;
}
public void setId(String id) {
this.id = id;
}
public void setVersion(String version) {
this.version = version;
}
public void setProfileID(String profileID) {
this.profileID = profileID;
}
public void setProfileVersion(String profileVersion) {
this.profileVersion = profileVersion;
}
public void setRelationships(List<RelationshipDV> relationships) {
this.relationships = relationships;
}
public void setTheDocument(DocumentDV theDocument) {
this.theDocument = theDocument;
}
public LifecycleInformationDV getLifecycleInformationDV() {
return lifecycleInformationDV;
}
public Map<String, IdentificationReferenceDV> getMapIdentReferenceDV() {
return mapIdentReferenceDV;
}
public void setMapIdentReferenceDV(Map<String, IdentificationReferenceDV> mapIdentReferenceDV) {
this.mapIdentReferenceDV = mapIdentReferenceDV;
}
public void setLifecycleInformationDV(LifecycleInformationDV lifecycleInformationDV) {
this.lifecycleInformationDV = lifecycleInformationDV;
}
public GeoJSON getSpatialReference() {
return spatialReference;
}
public void setSpatialReference(GeoJSON spatialReference) {
this.spatialReference = spatialReference;
}
public TemporalReferenceDV getTemporalReference() {
return temporalReference;
}
public void setTemporalReference(TemporalReferenceDV temporalReference) {
this.temporalReference = temporalReference;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ProjectDV [id=");
builder.append(id);
builder.append(", version=");
builder.append(version);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", profileVersion=");
builder.append(profileVersion);
builder.append(", profileName=");
builder.append(profileName);
builder.append(", relationships=");
builder.append(relationships);
builder.append(", theDocument=");
builder.append(theDocument);
builder.append(", mapIdentReferenceDV=");
builder.append(mapIdentReferenceDV);
builder.append(", lifecycleInformationDV=");
builder.append(lifecycleInformationDV);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append(", temporalReference=");
builder.append(temporalReference);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,56 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
public class PublicationInfoDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6381578837148417563L;
private AccountingInfoDV creationInfo;
private AccountingInfoDV lastEditInfo;
private AccessDV access;
public PublicationInfoDV() {
}
public AccountingInfoDV getCreationInfo() {
return creationInfo;
}
public AccountingInfoDV getLastEditInfo() {
return lastEditInfo;
}
public AccessDV getAccess() {
return access;
}
public void setCreationInfo(AccountingInfoDV creationInfo) {
this.creationInfo = creationInfo;
}
public void setLastEditInfo(AccountingInfoDV lastEditInfo) {
this.lastEditInfo = lastEditInfo;
}
public void setAccess(AccessDV access) {
this.access = access;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("PublicationInfoDV [creationInfo=");
builder.append(creationInfo);
builder.append(", lastEditInfo=");
builder.append(lastEditInfo);
builder.append(", access=");
builder.append(access);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,75 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
public class RelationshipDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 8295671124305773593L;
private String relationshipName;
private String targetID;
private String asJSON;
private String targetUCD;
public RelationshipDV() {
}
public RelationshipDV(String relationshipName, String targetID, String targetUCD, String asJSON) {
super();
this.relationshipName = relationshipName;
this.targetID = targetID;
this.targetUCD = targetUCD;
this.asJSON = asJSON;
}
public String getTargetUCD() {
return targetUCD;
}
public void setTargetUCD(String targetUCD) {
this.targetUCD = targetUCD;
}
public String getTargetID() {
return targetID;
}
public void setTargetID(String targetID) {
this.targetID = targetID;
}
public String getRelationshipName() {
return relationshipName;
}
public void setRelationshipName(String relationshipName) {
this.relationshipName = relationshipName;
}
public String getAsJSON() {
return asJSON;
}
public void setAsJSON(String asJSON) {
this.asJSON = asJSON;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RelationshipDV [relationshipName=");
builder.append(relationshipName);
builder.append(", targetID=");
builder.append(targetID);
builder.append(", asJSON=");
builder.append(asJSON);
builder.append(", targetUCD=");
builder.append(targetUCD);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,93 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.util.Date;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
/**
* The Class TemporalReferenceDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 10, 2022
* @param <T>
*/
public class TemporalReferenceDV extends DocumentDV {
/**
*
*/
private static final long serialVersionUID = -7990905553022863653L;
private String profileID;
private String projectID;
private String jsonTimelineObject;
private Date start;
private Date end;
/**
* Instantiates a new temporal reference DV.
*/
public TemporalReferenceDV() {
}
public String getJsonTimelineObject() {
return jsonTimelineObject;
}
public void setJsonTimelineObject(String jsonTimelineObject) {
this.jsonTimelineObject = jsonTimelineObject;
}
public String getProfileID() {
return profileID;
}
public String getProjectID() {
return projectID;
}
public Date getStart() {
return start;
}
public Date getEnd() {
return end;
}
public void setProfileID(String profileID) {
this.profileID = profileID;
}
public void setProjectID(String projectID) {
this.projectID = projectID;
}
public void setStart(Date start) {
this.start = start;
}
public void setEnd(Date end) {
this.end = end;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("TemporalReferenceDV [profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", jsonTimelineObject=");
builder.append(jsonTimelineObject);
builder.append(", start=");
builder.append(start);
builder.append(", end=");
builder.append(end);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,40 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
public enum GEOPORTAL_CONFIGURATION_TYPE {
item_fields("itemFields"),
gcube_profiles("gcubeProfiles"),
actions_definition("actionsDefinition"),
grouped_overlay_layers("grouped_overlay_layers"),
grouped_cross_filtering_layers("grouped_cross_filtering_layers");
String id;
/**
* Instantiates a new gna config managed.
*
* @param id the id
*/
GEOPORTAL_CONFIGURATION_TYPE(String id) {
this.id = id;
}
/**
* Gets the id.
*
* @return the id
*/
public String getId() {
return id;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
return id;
}
}

View File

@ -1,29 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
public enum GEOPORTAL_DATA_HANDLER {
geoportal_data_list("org.gcube.portlets.user.geoportal-data-list", "DATA_LIST_GUI"),
geoportal_basic_data_list("org.gcube.portlets.user.geoportal-basic-data-list", "BASIC_DATA_LIST_GUI"),
geoportal_data_entry("org.gcube.portlets.user.geoportal-data-entry-app", "DATA_ENTRY_GUI"),
geoportal_workflow_action_list("org.gcube.portlets.user.geoportal-workflow-action-list","WORKFLOW_ACTION_LIST_GUI"),
geoportal_timeline_json_template("org.gcube.portlets.user.geoportal-timeline-json-template","TIMELINE_JSON_TEMPLATE"),
geoportal_grouped_cross_filtering("org.gcube.portlets.user.grouped_cross_filtering_layers","GROUPED_CROSS_FILTERING_LAYERS"),
geoportal_grouped_overlay_layers("org.gcube.portlets.user.grouped_overlay_layers","GROUPED_OVERLAY_LAYERS"),
gna_concessioni_lc("GNA-CONCESSIONI-LC", "LifecycleManagement");
String id;
String type;
GEOPORTAL_DATA_HANDLER(String id, String type) {
this.id = id;
this.type = type;
}
public String getId() {
return id;
}
public String getType() {
return type;
}
}

View File

@ -1,167 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
/**
* The Class HandlerDeclarationDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 17, 2022
*/
public class HandlerDeclarationDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 3664650151266716354L;
private String id;
private String type;
private String itemType; // This is the use case (e.g. Concessioni)
private ConfigurationDV<?> configuration;
private GEOPORTAL_DATA_HANDLER dataHandlerType;
/**
* Instantiates a new handler declaration DV.
*/
public HandlerDeclarationDV() {
}
/**
* Instantiates a new handler declaration DV.
*
* @param id the id
* @param type the type
* @param itemType the item type
* @param configuration the configuration
* @param dataHandlerType the data handler type
*/
public HandlerDeclarationDV(String id, String type, String itemType,
ConfigurationDV<?> configuration,
GEOPORTAL_DATA_HANDLER dataHandlerType) {
super();
this.id = id;
this.type = type;
this.itemType = itemType;
this.configuration = configuration;
this.dataHandlerType = dataHandlerType;
}
/**
* Gets the id.
*
* @return the id
*/
public String getId() {
return id;
}
/**
* Gets the type.
*
* @return the type
*/
public String getType() {
return type;
}
/**
* Gets the item type.
*
* @return the item type
*/
public String getItemType() {
return itemType;
}
/**
* Gets the configuration.
*
* @return the configuration
*/
public ConfigurationDV<?> getConfiguration() {
return configuration;
}
/**
* Gets the data handler type.
*
* @return the data handler type
*/
public GEOPORTAL_DATA_HANDLER getDataHandlerType() {
return dataHandlerType;
}
/**
* Sets the id.
*
* @param id the new id
*/
public void setId(String id) {
this.id = id;
}
/**
* Sets the type.
*
* @param type the new type
*/
public void setType(String type) {
this.type = type;
}
/**
* Sets the item type.
*
* @param itemType the new item type
*/
public void setItemType(String itemType) {
this.itemType = itemType;
}
/**
* Sets the configuration.
*
* @param configuration the new configuration
*/
public void setConfiguration(ConfigurationDV<?> configuration) {
this.configuration = configuration;
}
/**
* Sets the data handler type.
*
* @param dataHandlerType the new data handler type
*/
public void setDataHandlerType(GEOPORTAL_DATA_HANDLER dataHandlerType) {
this.dataHandlerType = dataHandlerType;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("HandlerDeclarationDV [id=");
builder.append(id);
builder.append(", type=");
builder.append(type);
builder.append(", itemType=");
builder.append(itemType);
builder.append(", configuration=");
builder.append(configuration);
builder.append(", dataHandlerType=");
builder.append(dataHandlerType);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,63 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
import java.io.Serializable;
public class RelationshipDefinitionDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8542669180440066726L;
private String id;
private String label;
private String reverseRelationId;
public RelationshipDefinitionDV() {
}
public RelationshipDefinitionDV(String id, String label, String reverseRelationId) {
super();
this.id = id;
this.label = label;
this.reverseRelationId = reverseRelationId;
}
public String getId() {
return id;
}
public String getLabel() {
return label;
}
public String getReverseRelationId() {
return reverseRelationId;
}
public void setId(String id) {
this.id = id;
}
public void setLabel(String label) {
this.label = label;
}
public void setReverseRelationId(String reverseRelationId) {
this.reverseRelationId = reverseRelationId;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RelationshipDefinitionDV [id=");
builder.append(id);
builder.append(", label=");
builder.append(label);
builder.append(", reverseRelationId=");
builder.append(reverseRelationId);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,91 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
import java.io.Serializable;
import java.util.List;
public class UseCaseDescriptorDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2864888245002804887L;
private String id; // this is the ProfileID
private String version;
private String name;
private String description;
private List<HandlerDeclarationDV> handlers;
public UseCaseDescriptorDV() {
}
public UseCaseDescriptorDV(String id, String version, String name, String description) {
super();
this.id = id;
this.version = version;
this.name = name;
this.description = description;
}
public String getId() {
return id;
}
public String getProfileID() {
return id;
}
public String getVersion() {
return version;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public List<HandlerDeclarationDV> getHandlers() {
return handlers;
}
public void setId(String id) {
this.id = id;
}
public void setVersion(String version) {
this.version = version;
}
public void setName(String name) {
this.name = name;
}
public void setDescription(String description) {
this.description = description;
}
public void setHandlers(List<HandlerDeclarationDV> handlers) {
this.handlers = handlers;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("UseCaseDescriptorDV [id=");
builder.append(id);
builder.append(", version=");
builder.append(version);
builder.append(", name=");
builder.append(name);
builder.append(", description=");
builder.append(description);
builder.append(", handlers=");
builder.append(handlers);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,7 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.view;
public interface CheckEmpty {
public Boolean isEmpty();
}

View File

@ -1,54 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.view;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
public class ProjectView implements Serializable {
/**
*
*/
private static final long serialVersionUID = -1681876085329564419L;
private ProjectDV theProjectDV;
// The DocumentDV (contained in the ProjectDV) is listed in SectionView
private List<SectionView> listSections = new ArrayList<SectionView>();
public ProjectView() {
}
public void addSectionView(SectionView sectionView) {
listSections.add(sectionView);
}
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
public List<SectionView> getListSections() {
return listSections;
}
public void setTheProjectDV(ProjectDV theProjectDV) {
this.theProjectDV = theProjectDV;
}
public void setListSections(List<SectionView> listSections) {
this.listSections = listSections;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ProjectView [theProjectDV=");
builder.append(theProjectDV);
builder.append(", listSections=");
builder.append(listSections);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,129 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.view;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* The Class SectionView.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 11, 2022
*/
public class SectionView implements Serializable, CheckEmpty {
/**
*
*/
private static final long serialVersionUID = -5360469987059239067L;
private String sectionTitle;
private List<SubDocumentView> listSubDocuments;
/**
* Instantiates a new section view.
*/
public SectionView() {
}
/**
* Checks if is empty.
*
* @return true, if is empty
*/
@Override
public Boolean isEmpty() {
if (listSubDocuments == null)
return true;
for (SubDocumentView subDocumentView : listSubDocuments) {
boolean isEmpty = subDocumentView.isEmpty();
if (isEmpty)
return true;
}
return false;
}
/**
* Checks for spatial layers.
*
* @return true, if successful
*/
public Boolean hasSpatialLayers() {
if (listSubDocuments == null)
return false;
for (SubDocumentView subDocumentView : listSubDocuments) {
boolean hasLayers = subDocumentView.getListLayers() != null && subDocumentView.getListLayers().size() > 0;
if (hasLayers)
return true;
}
return false;
}
/**
* Gets the section title.
*
* @return the section title
*/
public String getSectionTitle() {
return sectionTitle;
}
/**
* Adds the sub document.
*
* @param subDocumentView the sub document view
*/
public void addSubDocument(SubDocumentView subDocumentView) {
if (listSubDocuments == null)
listSubDocuments = new ArrayList<SubDocumentView>();
listSubDocuments.add(subDocumentView);
}
/**
* Gets the list sub documents.
*
* @return the list sub documents
*/
public List<SubDocumentView> getListSubDocuments() {
if (listSubDocuments == null)
listSubDocuments = new ArrayList<SubDocumentView>();
return listSubDocuments;
}
/**
* Sets the section title.
*
* @param sectionTitle the new section title
*/
public void setSectionTitle(String sectionTitle) {
this.sectionTitle = sectionTitle;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SectionView [sectionTitle=");
builder.append(sectionTitle);
builder.append(", listSubDocuments=");
builder.append(listSubDocuments);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,91 +0,0 @@
package org.gcube.application.geoportalcommon.shared.geoportal.view;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
public class SubDocumentView implements Serializable, CheckEmpty {
/**
*
*/
private static final long serialVersionUID = 3563782450418275140L;
private String metadataAsJSON;
private List<FilesetDV> listFiles;
private List<FilesetDV> listImages;
private List<GCubeSDIViewerLayerDV> listLayers;
public SubDocumentView() {
}
@Override
public Boolean isEmpty() {
if (metadataAsJSON != null && !metadataAsJSON.isEmpty())
return false;
if (listFiles != null && !listFiles.isEmpty())
return false;
if (listImages != null && !listImages.isEmpty())
return false;
if (listLayers != null && !listLayers.isEmpty())
return false;
return true;
}
public String getMetadataAsJSON() {
return metadataAsJSON;
}
public List<FilesetDV> getListFiles() {
return listFiles;
}
public List<FilesetDV> getListImages() {
return listImages;
}
public List<GCubeSDIViewerLayerDV> getListLayers() {
return listLayers;
}
public void setMetadataAsJSON(String metadataAsJSON) {
this.metadataAsJSON = metadataAsJSON;
}
public void setListFiles(List<FilesetDV> listFiles) {
this.listFiles = listFiles;
}
public void setListImages(List<FilesetDV> listImages) {
this.listImages = listImages;
}
public void setListLayers(List<GCubeSDIViewerLayerDV> listLayers) {
this.listLayers = listLayers;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SubDocumentView [metadataAsJSON=");
builder.append(metadataAsJSON);
builder.append(", listFiles=");
builder.append(listFiles);
builder.append(", listImages=");
builder.append(listImages);
builder.append(", listLayers=");
builder.append(listLayers);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,53 +0,0 @@
package org.gcube.application.geoportalcommon.shared.guipresentation;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "body_welcome")
@XmlAccessorType(XmlAccessType.FIELD)
public class BodyWelcome implements Serializable {
private static final long serialVersionUID = 801731912505360534L;
@XmlElement
private String title;
@XmlElement
private String description;
public BodyWelcome() {
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public void setTitle(String title) {
this.title = title;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("BodyWelcome [title=");
builder.append(title);
builder.append(", description=");
builder.append(description);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,55 +0,0 @@
package org.gcube.application.geoportalcommon.shared.guipresentation;
import java.io.Serializable;
/**
* The Class DataEntryGUIPresentationConfig.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 26, 2022
*/
public class DataEntryGUIPresentationConfig implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6007504380531152501L;
private Header header;
private BodyWelcome bodyWelcome;
/**
* Instantiates a new data entry GUI presentation config.
*/
public DataEntryGUIPresentationConfig() {
}
public Header getHeader() {
return header;
}
public BodyWelcome getBodyWelcome() {
return bodyWelcome;
}
public void setHeader(Header header) {
this.header = header;
}
public void setBodyWelcome(BodyWelcome bodyWelcome) {
this.bodyWelcome = bodyWelcome;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DataEntryGUIPresentationConfig [header=");
builder.append(header);
builder.append(", bodyWelcome=");
builder.append(bodyWelcome);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,83 +0,0 @@
package org.gcube.application.geoportalcommon.shared.guipresentation;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* The Class Header.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 26, 2022
*/
@XmlRootElement(name = "header")
@XmlAccessorType(XmlAccessType.FIELD)
public class Header implements Serializable {
private static final long serialVersionUID = 1914492109448706008L;
@XmlElement
private String title;
@XmlElement
private String subtitle;
/**
* Instantiates a new header.
*/
public Header() {
}
/**
* Gets the title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Gets the subtitle.
*
* @return the subtitle
*/
public String getSubtitle() {
return subtitle;
}
/**
* Sets the title.
*
* @param title the new title
*/
public void setTitle(String title) {
this.title = title;
}
/**
* Sets the subtitle.
*
* @param subtitle the new subtitle
*/
public void setSubtitle(String subtitle) {
this.subtitle = subtitle;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Header [title=");
builder.append(title);
builder.append(", subtitle=");
builder.append(subtitle);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,84 @@
package org.gcube.application.geoportalcommon.shared.products;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
/**
* The Class BaseConcessioneDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 9, 2021
*/
public class BaseConcessioneDV extends RecordDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2291409985743665842L;
/** The introduzione. */
private String introduzione;
/** The authors. */
private List<String> authors;
/**
* Instantiates a new base concessione DV.
*/
public BaseConcessioneDV() {
}
/**
* Instantiates a new base concessione DV.
*
* @param introduzione the introduzione
* @param authors the authors
*/
public BaseConcessioneDV(String introduzione, List<String> authors) {
this.introduzione = introduzione;
this.authors = authors;
}
/**
* Gets the introduzione.
*
* @return the introduzione
*/
public String getIntroduzione() {
return introduzione;
}
/**
* Gets the authors.
*
* @return the authors
*/
public List<String> getAuthors() {
return authors;
}
/**
* Sets the introduzione.
*
* @param introduzione the new introduzione
*/
public void setIntroduzione(String introduzione) {
this.introduzione = introduzione;
}
/**
* Sets the authors.
*
* @param authors the new authors
*/
public void setAuthors(List<String> authors) {
this.authors = authors;
}
}

View File

@ -0,0 +1,587 @@
package org.gcube.application.geoportalcommon.shared.products;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.content.OtherContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus;
/**
* The Class ConcessioneDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 4, 2020
*/
public class ConcessioneDV extends BaseConcessioneDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1387327199157005059L;
/** The descrizione contenuto. */
private String descrizioneContenuto;
/** The contributore. */
private String contributore;
/** The titolari. */
private List<String> titolari;
/** The responsabile. */
private String responsabile;
/** The editore. */
private String editore;
/** The fonti finanziamento. */
private List<String> fontiFinanziamento;
/** The soggetto. */
private List<String> soggetto;
/** The risorse correlate. */
private List<String> risorseCorrelate;
/** The data inizio progetto. */
private Date dataInizioProgetto;
/** The data fine progetto. */
private Date dataFineProgetto;
/** The titolare licenza. */
private List<String> titolariLicenza;
/** The titolare copyright. */
private List<String> titolariCopyright;
/** The parole chiave libere. */
private List<String> paroleChiaveLibere;
/** The parole chiave ICCD. */
private List<String> paroleChiaveICCD;
/** The centroid lat. */
private Double centroidLat;
/** The centroid long. */
private Double centroidLong;
/** The relazione scavo. */
private AbstractRelazioneScavoDV abstractRelazioneScavo;
/** The relazione scavo. */
private RelazioneScavoDV relazioneScavo;
/** The immagini rappresentative. */
private List<UploadedImageDV> immaginiRappresentative = new ArrayList<UploadedImageDV>();
/** The posizionamento scavo. */
private LayerConcessioneDV posizionamentoScavo;
/** The piante fine scavo. */
private List<LayerConcessioneDV> pianteFineScavo = new ArrayList<LayerConcessioneDV>();
/** The generic content. */
private List<OtherContentDV> genericContent = new ArrayList<OtherContentDV>();
private ValidationReportDV validationReport = null;
// Redundancy required by GUI.
//It is the value of ValidationReportDV::ValidationStatus.
private ValidationStatus validationStatus = null;
/**
* Instantiates a new concessione.
*/
public ConcessioneDV() {
}
/**
* Gets the descrizione contenuto.
*
* @return the descrizione contenuto
*/
public String getDescrizioneContenuto() {
return descrizioneContenuto;
}
/**
* Sets the descrizione contenuto.
*
* @param descrizioneContenuto the new descrizione contenuto
*/
public void setDescrizioneContenuto(String descrizioneContenuto) {
this.descrizioneContenuto = descrizioneContenuto;
}
/**
* Gets the contributore.
*
* @return the contributore
*/
public String getContributore() {
return contributore;
}
/**
* Sets the contributore.
*
* @param contributore the new contributore
*/
public void setContributore(String contributore) {
this.contributore = contributore;
}
/**
* Gets the titolari.
*
* @return the titolari
*/
public List<String> getTitolari() {
return titolari;
}
/**
* Sets the titolari.
*
* @param titolari the new titolari
*/
public void setTitolari(List<String> titolari) {
this.titolari = titolari;
}
/**
* Gets the responsabile.
*
* @return the responsabile
*/
public String getResponsabile() {
return responsabile;
}
/**
* Sets the responsabile.
*
* @param responsabile the new responsabile
*/
public void setResponsabile(String responsabile) {
this.responsabile = responsabile;
}
/**
* Gets the editore.
*
* @return the editore
*/
public String getEditore() {
return editore;
}
/**
* Sets the editore.
*
* @param editore the new editore
*/
public void setEditore(String editore) {
this.editore = editore;
}
/**
* Gets the fonti finanziamento.
*
* @return the fonti finanziamento
*/
public List<String> getFontiFinanziamento() {
return fontiFinanziamento;
}
/**
* Sets the fonti finanziamento.
*
* @param fontiFinanziamento the new fonti finanziamento
*/
public void setFontiFinanziamento(List<String> fontiFinanziamento) {
this.fontiFinanziamento = fontiFinanziamento;
}
/**
* Gets the soggetto.
*
* @return the soggetto
*/
public List<String> getSoggetto() {
return soggetto;
}
/**
* Sets the soggetto.
*
* @param soggetto the new soggetto
*/
public void setSoggetto(List<String> soggetto) {
this.soggetto = soggetto;
}
/**
* Gets the risorse correlate.
*
* @return the risorse correlate
*/
public List<String> getRisorseCorrelate() {
return risorseCorrelate;
}
/**
* Sets the risorse correlate.
*
* @param risorseCorrelate the new risorse correlate
*/
public void setRisorseCorrelate(List<String> risorseCorrelate) {
this.risorseCorrelate = risorseCorrelate;
}
/**
* Gets the data inizio progetto.
*
* @return the data inizio progetto
*/
public Date getDataInizioProgetto() {
return dataInizioProgetto;
}
/**
* Sets the data inizio progetto.
*
* @param dataInizioProgetto the new data inizio progetto
*/
public void setDataInizioProgetto(Date dataInizioProgetto) {
this.dataInizioProgetto = dataInizioProgetto;
}
/**
* Gets the data fine progetto.
*
* @return the data fine progetto
*/
public Date getDataFineProgetto() {
return dataFineProgetto;
}
/**
* Sets the data fine progetto.
*
* @param date the new data fine progetto
*/
public void setDataFineProgetto(Date date) {
this.dataFineProgetto = date;
}
/**
* Gets the titolari licenza.
*
* @return the titolari licenza
*/
public List<String> getTitolariLicenza() {
return titolariLicenza;
}
/**
* Sets the titolari licenza.
*
* @param titolariLicenza the new titolari licenza
*/
public void setTitolariLicenza(List<String> titolariLicenza) {
this.titolariLicenza = titolariLicenza;
}
/**
* Gets the titolari copyright.
*
* @return the titolari copyright
*/
public List<String> getTitolariCopyright() {
return titolariCopyright;
}
/**
* Sets the titolari copyright.
*
* @param titolariCopyright the new titolari copyright
*/
public void setTitolariCopyright(List<String> titolariCopyright) {
this.titolariCopyright = titolariCopyright;
}
/**
* Gets the parole chiave libere.
*
* @return the parole chiave libere
*/
public List<String> getParoleChiaveLibere() {
return paroleChiaveLibere;
}
/**
* Sets the parole chiave libere.
*
* @param paroleChiaveLibere the new parole chiave libere
*/
public void setParoleChiaveLibere(List<String> paroleChiaveLibere) {
this.paroleChiaveLibere = paroleChiaveLibere;
}
/**
* Gets the parole chiave ICCD.
*
* @return the parole chiave ICCD
*/
public List<String> getParoleChiaveICCD() {
return paroleChiaveICCD;
}
/**
* Sets the parole chiave ICCD.
*
* @param paroleChiaveICCD the new parole chiave ICCD
*/
public void setParoleChiaveICCD(List<String> paroleChiaveICCD) {
this.paroleChiaveICCD = paroleChiaveICCD;
}
/**
* Gets the centroid lat.
*
* @return the centroid lat
*/
public Double getCentroidLat() {
return centroidLat;
}
/**
* Sets the centroid lat.
*
* @param centroidLat the new centroid lat
*/
public void setCentroidLat(Double centroidLat) {
this.centroidLat = centroidLat;
}
/**
* Gets the centroid long.
*
* @return the centroid long
*/
public Double getCentroidLong() {
return centroidLong;
}
/**
* Sets the centroid long.
*
* @param centroidLong the new centroid long
*/
public void setCentroidLong(Double centroidLong) {
this.centroidLong = centroidLong;
}
/**
* Gets the relazione scavo.
*
* @return the relazione scavo
*/
public RelazioneScavoDV getRelazioneScavo() {
return relazioneScavo;
}
/**
* Sets the relazione scavo.
*
* @param relazioneScavo the new relazione scavo
*/
public void setRelazioneScavo(RelazioneScavoDV relazioneScavo) {
this.relazioneScavo = relazioneScavo;
}
/**
* Gets the immagini rappresentative.
*
* @return the immagini rappresentative
*/
public List<UploadedImageDV> getImmaginiRappresentative() {
return immaginiRappresentative;
}
/**
* Sets the immagini rappresentative.
*
* @param immaginiRappresentative the new immagini rappresentative
*/
public void setImmaginiRappresentative(List<UploadedImageDV> immaginiRappresentative) {
this.immaginiRappresentative = immaginiRappresentative;
}
/**
* Gets the posizionamento scavo.
*
* @return the posizionamento scavo
*/
public LayerConcessioneDV getPosizionamentoScavo() {
return posizionamentoScavo;
}
/**
* Sets the posizionamento scavo.
*
* @param posizionamentoScavo the new posizionamento scavo
*/
public void setPosizionamentoScavo(LayerConcessioneDV posizionamentoScavo) {
this.posizionamentoScavo = posizionamentoScavo;
}
/**
* Gets the piante fine scavo.
*
* @return the piante fine scavo
*/
public List<LayerConcessioneDV> getPianteFineScavo() {
return pianteFineScavo;
}
/**
* Sets the piante fine scavo.
*
* @param pianteFineScavo the new piante fine scavo
*/
public void setPianteFineScavo(List<LayerConcessioneDV> pianteFineScavo) {
this.pianteFineScavo = pianteFineScavo;
}
/**
* Gets the generic content.
*
* @return the generic content
*/
public List<OtherContentDV> getGenericContent() {
return genericContent;
}
/**
* Sets the generic content.
*
* @param genericContent the new generic content
*/
public void setGenericContent(List<OtherContentDV> genericContent) {
this.genericContent = genericContent;
}
/**
* Gets the abstract relazione scavo.
*
* @return the abstract relazione scavo
*/
public AbstractRelazioneScavoDV getAbstractRelazioneScavo() {
return abstractRelazioneScavo;
}
/**
* Sets the abstract relazione scavo.
*
* @param abstractRelazioneScavo the new abstract relazione scavo
*/
public void setAbstractRelazioneScavo(AbstractRelazioneScavoDV abstractRelazioneScavo) {
this.abstractRelazioneScavo = abstractRelazioneScavo;
}
/**
* Gets the validation report.
*
* @return the validation report
*/
public ValidationReportDV getValidationReport() {
return validationReport;
}
/**
* Sets the validation report.
*
* @param validationReport the new validation report
*/
public void setValidationReport(ValidationReportDV validationReport) {
this.validationReport = validationReport;
}
public ValidationStatus getValidationStatus() {
return validationStatus;
}
public void setValidationStatus(ValidationStatus validationStatus) {
this.validationStatus = validationStatus;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ConcessioneDV [descrizioneContenuto=");
builder.append(descrizioneContenuto);
builder.append(", contributore=");
builder.append(contributore);
builder.append(", titolari=");
builder.append(titolari);
builder.append(", responsabile=");
builder.append(responsabile);
builder.append(", editore=");
builder.append(editore);
builder.append(", fontiFinanziamento=");
builder.append(fontiFinanziamento);
builder.append(", soggetto=");
builder.append(soggetto);
builder.append(", risorseCorrelate=");
builder.append(risorseCorrelate);
builder.append(", dataInizioProgetto=");
builder.append(dataInizioProgetto);
builder.append(", dataFineProgetto=");
builder.append(dataFineProgetto);
builder.append(", titolariLicenza=");
builder.append(titolariLicenza);
builder.append(", titolariCopyright=");
builder.append(titolariCopyright);
builder.append(", paroleChiaveLibere=");
builder.append(paroleChiaveLibere);
builder.append(", paroleChiaveICCD=");
builder.append(paroleChiaveICCD);
builder.append(", centroidLat=");
builder.append(centroidLat);
builder.append(", centroidLong=");
builder.append(centroidLong);
builder.append(", abstractRelazioneScavo=");
builder.append(abstractRelazioneScavo);
builder.append(", relazioneScavo=");
builder.append(relazioneScavo);
builder.append(", immaginiRappresentative=");
builder.append(immaginiRappresentative);
builder.append(", posizionamentoScavo=");
builder.append(posizionamentoScavo);
builder.append(", pianteFineScavo=");
builder.append(pianteFineScavo);
builder.append(", genericContent=");
builder.append(genericContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,201 @@
package org.gcube.application.geoportalcommon.shared.products.content;
import java.io.Serializable;
import java.util.Date;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
/**
* The Class AssociatedContent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 2, 2020
*/
public abstract class AssociatedContentDV implements Serializable{
/**
*
*/
private static final long serialVersionUID = -3666420861504055117L;
/** The id. */
private long id;
/** The policy. */
private String policy;
/** The license ID. */
private String licenseID;
/** The titolo. */
private String titolo;
/** The creation time. */
private Date creationTime;
/** The record. */
private RecordDV record;
/**
* Instantiates a new associated content.
*/
public AssociatedContentDV() {
}
/**
* Instantiates a new associated content.
*
* @param id the id
* @param policy the policy
* @param licenseID the license ID
* @param titolo the titolo
* @param creationTime the creation time
* @param record the record
*/
public AssociatedContentDV(long id, String policy, String licenseID, String titolo, Date creationTime,
RecordDV record) {
super();
this.id = id;
this.policy = policy;
this.licenseID = licenseID;
this.titolo = titolo;
this.creationTime = creationTime;
this.record = record;
}
/**
* Gets the id.
*
* @return the id
*/
public long getId() {
return id;
}
/**
* Sets the id.
*
* @param id the new id
*/
public void setId(long id) {
this.id = id;
}
/**
* Gets the policy.
*
* @return the policy
*/
public String getPolicy() {
return policy;
}
/**
* Sets the policy.
*
* @param policy the new policy
*/
public void setPolicy(String policy) {
this.policy = policy;
}
/**
* Gets the license ID.
*
* @return the license ID
*/
public String getLicenseID() {
return licenseID;
}
/**
* Sets the license ID.
*
* @param licenseID the new license ID
*/
public void setLicenseID(String licenseID) {
this.licenseID = licenseID;
}
/**
* Gets the titolo.
*
* @return the titolo
*/
public String getTitolo() {
return titolo;
}
/**
* Sets the titolo.
*
* @param titolo the new titolo
*/
public void setTitolo(String titolo) {
this.titolo = titolo;
}
/**
* Gets the creation time.
*
* @return the creation time
*/
public Date getCreationTime() {
return creationTime;
}
/**
* Sets the creation time.
*
* @param creationTime the new creation time
*/
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
/**
* Gets the record.
*
* @return the record
*/
public RecordDV getRecord() {
return record;
}
/**
* Sets the record.
*
* @param record the new record
*/
public void setRecord(RecordDV record) {
this.record = record;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AssociatedContent [id=");
builder.append(id);
builder.append(", policy=");
builder.append(policy);
builder.append(", licenseID=");
builder.append(licenseID);
builder.append(", titolo=");
builder.append(titolo);
builder.append(", creationTime=");
builder.append(creationTime);
builder.append(", record=");
builder.append(record);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,41 @@
package org.gcube.application.geoportalcommon.shared.products.content;
import java.io.Serializable;
/**
* The Class OtherContent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 2, 2020
*/
public class OtherContentDV extends AssociatedContentDV implements Serializable{
/**
*
*/
private static final long serialVersionUID = -2550361768550673836L;
/**
* Instantiates a new other content.
*/
public OtherContentDV() {
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("OtherContent [toString()=");
builder.append(super.toString());
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,172 @@
package org.gcube.application.geoportalcommon.shared.products.content;
import java.io.Serializable;
/**
* The Class WorkspaceContentDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 5, 2020
*/
public class WorkspaceContentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -3919923007831416696L;
/** The mimetype. */
private String mimetype;
/** The storage ID. */
private String storageID;
/** The link. */
private String link;
private Long id;
private String name;
// this field is used by GUI
private Integer cliendId;
/**
* Instantiates a new workspace content DV.
*/
public WorkspaceContentDV() {
}
/**
* Gets the id.
*
* @return the id
*/
public Long getId() {
return id;
}
/**
* Sets the id.
*
* @param id the new id
*/
public void setId(Long id) {
this.id = id;
}
/**
* Gets the mimetype.
*
* @return the mimetype
*/
public String getMimetype() {
return mimetype;
}
/**
* Sets the mimetype.
*
* @param mimetype the new mimetype
*/
public void setMimetype(String mimetype) {
this.mimetype = mimetype;
}
/**
* Gets the storage ID.
*
* @return the storage ID
*/
public String getStorageID() {
return storageID;
}
/**
* Sets the storage ID.
*
* @param storageID the new storage ID
*/
public void setStorageID(String storageID) {
this.storageID = storageID;
}
/**
* Gets the link.
*
* @return the link
*/
public String getLink() {
return link;
}
/**
* Sets the link.
*
* @param link the new link
*/
public void setLink(String link) {
this.link = link;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) {
this.name = name;
}
/**
* Gets the cliend id.
*
* @return the cliend id
*/
public Integer getCliendId() {
return cliendId;
}
/**
* Sets the cliend id.
*
* @param cliendId the new cliend id
*/
public void setCliendId(Integer cliendId) {
this.cliendId = cliendId;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("WorkspaceContentDV [mimetype=");
builder.append(mimetype);
builder.append(", storageID=");
builder.append(storageID);
builder.append(", link=");
builder.append(link);
builder.append(", id=");
builder.append(id);
builder.append(", name=");
builder.append(name);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,121 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.content.AssociatedContentDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
/**
* The Class AbstractRelazioneScavoDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 24, 2021
*/
public class AbstractRelazioneScavoDV extends AssociatedContentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 8768745863185590509L;
/** The abstract section. */
private String abstractSectionIta;
private String abstractSectionEng;
private List<WorkspaceContentDV> listWsContent;
/**
* Instantiates a new abstract relazione scavo.
*/
public AbstractRelazioneScavoDV() {
}
/**
* Instantiates a new abstract relazione scavo DV.
*
* @param abstractSectionIta the abstract section ita
* @param abstractSectionEng the abstract section eng
*/
public AbstractRelazioneScavoDV(String abstractSectionIta, String abstractSectionEng) {
super();
this.abstractSectionIta = abstractSectionIta;
this.abstractSectionEng = abstractSectionEng;
}
/**
* Gets the abstract section ita.
*
* @return the abstract section ita
*/
public String getAbstractSectionIta() {
return abstractSectionIta;
}
/**
* Sets the abstract section ita.
*
* @param abstractSectionIta the new abstract section ita
*/
public void setAbstractSectionIta(String abstractSectionIta) {
this.abstractSectionIta = abstractSectionIta;
}
/**
* Gets the abstract section eng.
*
* @return the abstract section eng
*/
public String getAbstractSectionEng() {
return abstractSectionEng;
}
/**
* Sets the abstract section eng.
*
* @param abstractSectionEng the new abstract section eng
*/
public void setAbstractSectionEng(String abstractSectionEng) {
this.abstractSectionEng = abstractSectionEng;
}
/**
* Gets the list ws content.
*
* @return the list ws content
*/
public List<WorkspaceContentDV> getListWsContent() {
return listWsContent;
}
/**
* Sets the list ws content.
*
* @param listWsContent the new list ws content
*/
public void setListWsContent(List<WorkspaceContentDV> listWsContent) {
this.listWsContent = listWsContent;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AbstractRelazioneScavoDV [abstractSectionIta=");
builder.append(abstractSectionIta);
builder.append(", abstractSectionEng=");
builder.append(abstractSectionEng);
builder.append(", listWsContent=");
builder.append(listWsContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,271 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
/**
* The Class LayerConcessioneDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 9, 2021
*/
public class LayerConcessioneDV extends SDILayerDescriptorDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2633250621043744245L;
// 1.Identificazione
private String abstractSection;
// 2.Classificazione
private String topicCategory;
// 3.Keyword
private String subTopic;
// 4. Delimitazione geographica
private BoundsMap bbox;
// 5. Temporal
// 6. Quality
private String valutazioneQualita;
private String metodoRaccoltaDati;
private String scalaAcquisizione;
private List<String> authors;
private BaseConcessioneDV refersTo;
private List<WorkspaceContentDV> listWsContent;
/**
* Instantiates a new layer concessione DV.
*/
public LayerConcessioneDV() {
}
/**
* Gets the abstract section.
*
* @return the abstract section
*/
public String getAbstractSection() {
return abstractSection;
}
/**
* Sets the abstract section.
*
* @param abstractSection the new abstract section
*/
public void setAbstractSection(String abstractSection) {
this.abstractSection = abstractSection;
}
/**
* Gets the topic category.
*
* @return the topic category
*/
public String getTopicCategory() {
return topicCategory;
}
/**
* Sets the topic category.
*
* @param topicCategory the new topic category
*/
public void setTopicCategory(String topicCategory) {
this.topicCategory = topicCategory;
}
/**
* Gets the sub topic.
*
* @return the sub topic
*/
public String getSubTopic() {
return subTopic;
}
/**
* Sets the sub topic.
*
* @param subTopic the new sub topic
*/
public void setSubTopic(String subTopic) {
this.subTopic = subTopic;
}
/**
* Gets the bbox.
*
* @return the bbox
*/
public BoundsMap getBbox() {
return bbox;
}
/**
* Sets the bbox.
*
* @param bbox the new bbox
*/
public void setBbox(BoundsMap bbox) {
this.bbox = bbox;
}
/**
* Gets the valutazione qualita.
*
* @return the valutazione qualita
*/
public String getValutazioneQualita() {
return valutazioneQualita;
}
/**
* Sets the valutazione qualita.
*
* @param valutazioneQualita the new valutazione qualita
*/
public void setValutazioneQualita(String valutazioneQualita) {
this.valutazioneQualita = valutazioneQualita;
}
/**
* Gets the metodo raccolta dati.
*
* @return the metodo raccolta dati
*/
public String getMetodoRaccoltaDati() {
return metodoRaccoltaDati;
}
/**
* Sets the metodo raccolta dati.
*
* @param metodoRaccoltaDati the new metodo raccolta dati
*/
public void setMetodoRaccoltaDati(String metodoRaccoltaDati) {
this.metodoRaccoltaDati = metodoRaccoltaDati;
}
/**
* Gets the scala acquisizione.
*
* @return the scala acquisizione
*/
public String getScalaAcquisizione() {
return scalaAcquisizione;
}
/**
* Sets the scala acquisizione.
*
* @param scalaAcquisizione the new scala acquisizione
*/
public void setScalaAcquisizione(String scalaAcquisizione) {
this.scalaAcquisizione = scalaAcquisizione;
}
/**
* Gets the authors.
*
* @return the authors
*/
public List<String> getAuthors() {
return authors;
}
/**
* Sets the authors.
*
* @param authors the new authors
*/
public void setAuthors(List<String> authors) {
this.authors = authors;
}
/**
* Gets the refers to.
*
* @return the refers to
*/
public BaseConcessioneDV getRefersTo() {
return refersTo;
}
/**
* Sets the refers to.
*
* @param refersTo the new refers to
*/
public void setRefersTo(BaseConcessioneDV refersTo) {
this.refersTo = refersTo;
}
/**
* Sets the list ws content.
*
* @param listWsContent the new list ws content
*/
public void setListWsContent(List<WorkspaceContentDV> listWsContent) {
this.listWsContent = listWsContent;
}
/**
* Gets the list ws content.
*
* @return the list ws content
*/
public List<WorkspaceContentDV> getListWsContent() {
return listWsContent;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("LayerConcessioneDV [abstractSection=");
builder.append(abstractSection);
builder.append(", topicCategory=");
builder.append(topicCategory);
builder.append(", subTopic=");
builder.append(subTopic);
builder.append(", bbox=");
builder.append(bbox);
builder.append(", valutazioneQualita=");
builder.append(valutazioneQualita);
builder.append(", metodoRaccoltaDati=");
builder.append(metodoRaccoltaDati);
builder.append(", scalaAcquisizione=");
builder.append(scalaAcquisizione);
builder.append(", authors=");
builder.append(authors);
builder.append(", refersTo=");
builder.append(refersTo);
builder.append(", listWsContent=");
builder.append(listWsContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,297 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.Date;
/**
* The Class RecordDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 2, 2021
*/
public abstract class RecordDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2913726613820175679L;
/** The id. */
// this is the mongoID
private String itemId;
/** The record type. */
private String recordType;
/** The version. */
private String version = "1.0.0";
/** The licenza ID. */
private String licenzaID;
private String policy;
/** The nome. */
// Nome del progetto
private String nome;
/** The folder id. */
// Storage Info
private String folderId;
/** The last update time. */
// Accounting
private Date lastUpdateTime;
/** The last update user. */
private String lastUpdateUser;
/** The creation time. */
private Date creationTime;
/** The creation user. */
private String creationUser;
/**
* Instantiates a new record.
*/
public RecordDV() {
}
/**
* Gets the item id.
*
* @return the item id
*/
public String getItemId() {
return itemId;
}
/**
* Sets the item id.
*
* @param itemId the new item id
*/
public void setItemId(String itemId) {
this.itemId = itemId;
}
/**
* Gets the record type.
*
* @return the record type
*/
public String getRecordType() {
return recordType;
}
/**
* Sets the record type.
*
* @param recordType the new record type
*/
public void setRecordType(String recordType) {
this.recordType = recordType;
}
/**
* Gets the version.
*
* @return the version
*/
public String getVersion() {
return version;
}
/**
* Sets the version.
*
* @param version the new version
*/
public void setVersion(String version) {
this.version = version;
}
/**
* Gets the licenza ID.
*
* @return the licenza ID
*/
public String getLicenzaID() {
return licenzaID;
}
/**
* Sets the licenza ID.
*
* @param licenzaID the new licenza ID
*/
public void setLicenzaID(String licenzaID) {
this.licenzaID = licenzaID;
}
/**
* Gets the accesso.
*
* @return the accesso
*/
public String getPolicy() {
return policy;
}
/**
* Sets the accesso.
*
* @param policy the new policy
*/
public void setPolicy(String policy) {
this.policy = policy;
}
/**
* Gets the nome.
*
* @return the nome
*/
public String getNome() {
return nome;
}
/**
* Sets the nome.
*
* @param nome the new nome
*/
public void setNome(String nome) {
this.nome = nome;
}
/**
* Gets the folder id.
*
* @return the folder id
*/
public String getFolderId() {
return folderId;
}
/**
* Sets the folder id.
*
* @param folderId the new folder id
*/
public void setFolderId(String folderId) {
this.folderId = folderId;
}
/**
* Gets the last update time.
*
* @return the last update time
*/
public Date getLastUpdateTime() {
return lastUpdateTime;
}
/**
* Sets the last update time.
*
* @param date the new last update time
*/
public void setLastUpdateTime(Date date) {
this.lastUpdateTime = date;
}
/**
* Gets the last update user.
*
* @return the last update user
*/
public String getLastUpdateUser() {
return lastUpdateUser;
}
/**
* Sets the last update user.
*
* @param lastUpdateUser the new last update user
*/
public void setLastUpdateUser(String lastUpdateUser) {
this.lastUpdateUser = lastUpdateUser;
}
/**
* Gets the creation time.
*
* @return the creation time
*/
public Date getCreationTime() {
return creationTime;
}
/**
* Sets the creation time.
*
* @param creationTime the new creation time
*/
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
/**
* Gets the creation user.
*
* @return the creation user
*/
public String getCreationUser() {
return creationUser;
}
/**
* Sets the creation user.
*
* @param creationUser the new creation user
*/
public void setCreationUser(String creationUser) {
this.creationUser = creationUser;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RecordDV [itemId=");
builder.append(itemId);
builder.append(", recordType=");
builder.append(recordType);
builder.append(", version=");
builder.append(version);
builder.append(", licenzaID=");
builder.append(licenzaID);
builder.append(", policy=");
builder.append(policy);
builder.append(", nome=");
builder.append(nome);
builder.append(", folderId=");
builder.append(folderId);
builder.append(", lastUpdateTime=");
builder.append(lastUpdateTime);
builder.append(", lastUpdateUser=");
builder.append(lastUpdateUser);
builder.append(", creationTime=");
builder.append(creationTime);
builder.append(", creationUser=");
builder.append(creationUser);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,125 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.content.AssociatedContentDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
/**
* The Class RelazioneScavoDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Dec 21, 2020
*/
public class RelazioneScavoDV extends AssociatedContentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2456950567302197554L;
/** The responsabili. */
private List<String> responsabili;
/** The soggetto. */
private List<String> soggetto;
private List<WorkspaceContentDV> listWsContent;
/**
* Instantiates a new relazione scavo DV.
*/
public RelazioneScavoDV() {
}
/**
* Instantiates a new relazione scavo DV.
*
* @param responsabili the responsabili
* @param soggetto the soggetto
*/
public RelazioneScavoDV(List<String> responsabili, List<String> soggetto) {
super();
this.responsabili = responsabili;
this.soggetto = soggetto;
}
/**
* Gets the responsabili.
*
* @return the responsabili
*/
public List<String> getResponsabili() {
return responsabili;
}
/**
* Sets the responsabili.
*
* @param responsabili the new responsabili
*/
public void setResponsabili(List<String> responsabili) {
this.responsabili = responsabili;
}
/**
* Gets the soggetto.
*
* @return the soggetto
*/
public List<String> getSoggetto() {
return soggetto;
}
/**
* Sets the soggetto.
*
* @param soggetto the new soggetto
*/
public void setSoggetto(List<String> soggetto) {
this.soggetto = soggetto;
}
/**
* Gets the list ws content.
*
* @return the list ws content
*/
public List<WorkspaceContentDV> getListWsContent() {
return listWsContent;
}
/**
* Sets the list ws content.
*
* @param listWsContent the new list ws content
*/
public void setListWsContent(List<WorkspaceContentDV> listWsContent) {
this.listWsContent = listWsContent;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RelazioneScavoDV [responsabili=");
builder.append(responsabili);
builder.append(", soggetto=");
builder.append(soggetto);
builder.append(", listWsContent=");
builder.append(listWsContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,141 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.products.content.AssociatedContentDV;
/**
* The Class SDILayerDescriptorDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 4, 2020
*/
public class SDILayerDescriptorDV extends AssociatedContentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6137246723753812015L;
// meta
private String layerUUID;
private Long layerID;
// layer
private String layerName;
private String wmsLink;
/**
* Instantiates a new SDI layer descriptor DV.
*/
public SDILayerDescriptorDV() {
}
/**
* Instantiates a new SDI layer descriptor DV.
*
* @param layerUUID the layer UUID
* @param layerID the layer ID
* @param layerName the layer name
* @param wmsLink the wms link
*/
public SDILayerDescriptorDV(String layerUUID, Long layerID, String layerName, String wmsLink) {
super();
this.layerUUID = layerUUID;
this.layerID = layerID;
this.layerName = layerName;
this.wmsLink = wmsLink;
}
/**
* Gets the layer UUID.
*
* @return the layer UUID
*/
public String getLayerUUID() {
return layerUUID;
}
/**
* Sets the layer UUID.
*
* @param layerUUID the new layer UUID
*/
public void setLayerUUID(String layerUUID) {
this.layerUUID = layerUUID;
}
/**
* Gets the layer ID.
*
* @return the layer ID
*/
public Long getLayerID() {
return layerID;
}
/**
* Sets the layer ID.
*
* @param layerID the new layer ID
*/
public void setLayerID(Long layerID) {
this.layerID = layerID;
}
/**
* Gets the layer name.
*
* @return the layer name
*/
public String getLayerName() {
return layerName;
}
/**
* Sets the layer name.
*
* @param layerName the new layer name
*/
public void setLayerName(String layerName) {
this.layerName = layerName;
}
/**
* Gets the wms link.
*
* @return the wms link
*/
public String getWmsLink() {
return wmsLink;
}
/**
* Sets the wms link.
*
* @param wmsLink the new wms link
*/
public void setWmsLink(String wmsLink) {
this.wmsLink = wmsLink;
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.geoportaldataviewer.shared.products.content.AssociatedContentDV#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SDILayerDescriptor [layerUUID=");
builder.append(layerUUID);
builder.append(", layerID=");
builder.append(layerID);
builder.append(", layerName=");
builder.append(layerName);
builder.append(", wmsLink=");
builder.append(wmsLink);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,139 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.content.AssociatedContentDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
/**
* The Class UploadedImage.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 2, 2020
*/
public class UploadedImageDV extends AssociatedContentDV implements Serializable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 809167060189883015L;
/** The didascalia. */
private String didascalia;
/** The format. */
private String format;
/** The responsabili. */
private List<String> responsabili;
/** The soggetto. */
private List<String> soggetto;
private List<WorkspaceContentDV> listWsContent;
/**
* Instantiates a new uploaded image.
*/
public UploadedImageDV() {
}
/**
* Gets the didascalia.
*
* @return the didascalia
*/
public String getDidascalia() {
return didascalia;
}
/**
* Sets the didascalia.
*
* @param didascalia the new didascalia
*/
public void setDidascalia(String didascalia) {
this.didascalia = didascalia;
}
/**
* Gets the format.
*
* @return the format
*/
public String getFormat() {
return format;
}
/**
* Sets the format.
*
* @param format the new format
*/
public void setFormat(String format) {
this.format = format;
}
/**
* Gets the responsabili.
*
* @return the responsabili
*/
public List<String> getResponsabili() {
return responsabili;
}
/**
* Sets the responsabili.
*
* @param responsabili the new responsabili
*/
public void setResponsabili(List<String> responsabili) {
this.responsabili = responsabili;
}
/**
* Gets the soggetto.
*
* @return the soggetto
*/
public List<String> getSoggetto() {
return soggetto;
}
/**
* Sets the soggetto.
*
* @param soggetto the new soggetto
*/
public void setSoggetto(List<String> soggetto) {
this.soggetto = soggetto;
}
public List<WorkspaceContentDV> getListWsContent() {
return listWsContent;
}
public void setListWsContent(List<WorkspaceContentDV> listWsContent) {
this.listWsContent = listWsContent;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("UploadedImageDV [didascalia=");
builder.append(didascalia);
builder.append(", format=");
builder.append(format);
builder.append(", responsabili=");
builder.append(responsabili);
builder.append(", soggetto=");
builder.append(soggetto);
builder.append(", listWsContent=");
builder.append(listWsContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,186 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* The Class ValidationReportDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 13, 2021
*/
public class ValidationReportDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4579856308279187824L;
/**
* The Enum ValidationStatus.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 13, 2021
*/
public static enum ValidationStatus {
PASSED("Success"), ERROR("Error"), WARNING("Warning");
private String label;
private ValidationStatus(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
}
private String objectName;
private ValidationStatus status;
private List<String> errorMessages = new ArrayList<String>();
private List<String> warningMessages = new ArrayList<String>();
private String asJSONString;
/**
* Instantiates a new validation report DV.
*/
public ValidationReportDV() {
}
/**
* Instantiates a new validation report DV.
*
* @param objectName the object name
* @param status the status
* @param errorMessages the error messages
* @param warningMessages the warning messages
* @param asJSONString the as JSON string
*/
public ValidationReportDV(String objectName, ValidationStatus status, List<String> errorMessages,
List<String> warningMessages, String asJSONString) {
super();
this.objectName = objectName;
this.status = status;
this.errorMessages = errorMessages;
this.warningMessages = warningMessages;
this.asJSONString = asJSONString;
}
/**
* Gets the object name.
*
* @return the object name
*/
public String getObjectName() {
return objectName;
}
/**
* Gets the status.
*
* @return the status
*/
public ValidationStatus getStatus() {
return status;
}
/**
* Gets the error messages.
*
* @return the error messages
*/
public List<String> getErrorMessages() {
return errorMessages;
}
/**
* Gets the warning messages.
*
* @return the warning messages
*/
public List<String> getWarningMessages() {
return warningMessages;
}
/**
* Gets the as JSON string.
*
* @return the as JSON string
*/
public String getAsJSONString() {
return asJSONString;
}
/**
* Sets the object name.
*
* @param objectName the new object name
*/
public void setObjectName(String objectName) {
this.objectName = objectName;
}
/**
* Sets the status.
*
* @param status the new status
*/
public void setStatus(ValidationStatus status) {
this.status = status;
}
/**
* Sets the error messages.
*
* @param errorMessages the new error messages
*/
public void setErrorMessages(List<String> errorMessages) {
this.errorMessages = errorMessages;
}
/**
* Sets the warning messages.
*
* @param warningMessages the new warning messages
*/
public void setWarningMessages(List<String> warningMessages) {
this.warningMessages = warningMessages;
}
/**
* Sets the as JSON string.
*
* @param asJSONString the new as JSON string
*/
public void setAsJSONString(String asJSONString) {
this.asJSONString = asJSONString;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ValidationReportDV [objectName=");
builder.append(objectName);
builder.append(", status=");
builder.append(status);
builder.append(", errorMessages=");
builder.append(errorMessages);
builder.append(", warningMessages=");
builder.append(warningMessages);
builder.append(", asJSONString=");
builder.append(asJSONString);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,66 @@
package org.gcube.application.geoportalcommon.shared.products.paths;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* The Class FileSetPathsDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 29, 2021
*/
public class FileSetPathsDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 7494678009053802818L;
List<String> fileSetPaths = new ArrayList<String>();
/**
* Instantiates a new file set paths DV.
*/
public FileSetPathsDV() {
}
/**
* Instantiates a new file set paths DV.
*
* @param fileSetPaths the file set paths
*/
public FileSetPathsDV(List<String> fileSetPaths) {
super();
this.fileSetPaths = fileSetPaths;
}
/**
* Gets the file set paths.
*
* @return the file set paths
*/
public List<String> getFileSetPaths() {
return fileSetPaths;
}
/**
* Sets the file set paths.
*
* @param fileSetPaths the new file set paths
*/
public void setFileSetPaths(List<String> fileSetPaths) {
this.fileSetPaths = fileSetPaths;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FileSetPathsDV [fileSetPaths=");
builder.append(fileSetPaths);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,6 +1,5 @@
package org.gcube.application.geoportalcommon.util;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -12,7 +11,7 @@ import java.util.Date;
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 4, 2021
* Aug 4, 2021
*/
public class DateUtils {
@ -63,32 +62,4 @@ public class DateUtils {
return null;
return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDateTime();
}
public static Date toDate(String date) {
if (date == null || date.isEmpty())
return null;
try {
LocalDate localDate = LocalDate.parse(date);
return asDate(localDate);
} catch (Exception e) {
// TODO: handle exception
}
try {
LocalDateTime dateTime = LocalDateTime.parse(date);
return asDate(dateTime);
} catch (Exception e) {
// TODO: handle exception
}
try {
return new SimpleDateFormat("yyy-MM-dd").parse(date);
} catch (Exception e) {
// TODO: handle exception
}
return null;
}
}

View File

@ -1,27 +0,0 @@
package org.gcube.application.geoportalcommon.util;
/**
* The Class StringUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 31, 2023
*/
public class StringUtil {
/**
* Ellipsize.
*
* @param input the input
* @param maxLength the max length
* @return the string
*/
public static String ellipsize(String input, int maxLength) {
String ellip = "...";
if (input == null || input.length() <= maxLength || input.length() < ellip.length()) {
return input;
}
return input.substring(0, maxLength - ellip.length()).concat(ellip);
}
}

1
src/test/.gitignore vendored
View File

@ -1 +0,0 @@
/resources/

View File

@ -1,43 +0,0 @@
package org.gcube.application;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class ContextConfigTest {
private static final String GCUBE_CONFIG_PROPERTIES_FILENAME = "gcube_config.properties";
// APP Working Directory + /src/test/resources must be the location of
// gcube_config.properties
private static String gcube_config_path = String.format("%s/%s",
System.getProperty("user.dir") + "/src/test/resources", GCUBE_CONFIG_PROPERTIES_FILENAME);
public static String CONTEXT;
public static String TOKEN;
/**
* Read context settings.
*/
public static void readContextSettings() {
try (InputStream input = new FileInputStream(gcube_config_path)) {
Properties prop = new Properties();
// load a properties file
prop.load(input);
CONTEXT = prop.getProperty("CONTEXT");
TOKEN = prop.getProperty("TOKEN");
// get the property value and print it out
System.out.println("CONTEXT: " + CONTEXT);
System.out.println("TOKEN: " + TOKEN);
} catch (IOException ex) {
ex.printStackTrace();
}
}
}

View File

@ -1,428 +0,0 @@
package org.gcube.application;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
import org.gcube.application.geoportalcommon.shared.WhereClause;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.se.RuntimeResourceReader;
import org.gcube.application.se.ServiceEndpointBean;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder.RESOLVE_AS;
public class CreateGeoportalGisLinkInTheCentroidLayers {
// private static String CONTEXT = "/gcube/devsec/devVRE";
// private static String TOKEN = ""; // devVRE
// private static final String CONTEXT = "/pred4s/preprod/preVRE";
// private static final String TOKEN = ""; //preVRE
// private static final String CONTEXT = "/d4science.research-infrastructures.eu/D4OS/GNA";
// private static final String TOKEN = ""; //GNA
//Esquiline
private static final String CONTEXT = "/d4science.research-infrastructures.eu/gCubeApps/Esquiline";
private static final String TOKEN = ""; //Esquiline
private static String PROFILE_ID = "esquilino";
// GEOPORTAL
//private static String PROFILE_ID = "profiledConcessioni";
// private static final String PROFILE_ID = "concessioni-estere";
private static final String JSON_KEY_DATA_FINE_PROGETTO = "dataFineProgetto";
private static final String JSON_KEY_DATA_INIZIO_PROGETTO = "dataInizioProgetto";
private static final String JSON_KEY_INTRODUZIONE = "introduzione";
// DB
private static final String platformName = "postgis";
private static final String category = "Database";
// private static final String resourceName = "GNA-POSTGIS-DB"; // devVRE
//private static final String resourceName = "Geoserver-t postgis"; //preVRE
private static final String resourceName = "GNA-postgis"; // GNA
private static final String TABLE_COLUMN_GEO_VIEWER_LINK = "geov_link";
private static ProjectsCaller client = null;
public static final boolean READ_ONLY_MODE = true;
/**
* Gets the client.
*
* @return the client
*/
// @Before
public static void initGeoportalClient() {
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ScopeProvider.instance.set(CONTEXT);
SecurityTokenProvider.instance.set(TOKEN);
client = GeoportalClientCaller.projects();
}
public static void main(String[] args) {
System.out.println("READ_ONLY_MODE ENABLED: " + READ_ONLY_MODE);
System.out.println("CONTEXT IS: " + CONTEXT);
System.out.println("PROFILE_ID: " + PROFILE_ID);
initGeoportalClient();
//devVRE
// PROFILE_ID = "profiledConcessioni";
// String tableName = "profiledconcessioni_devvre_centroids";
// tableName = "profiledconcessioni_internal__devvre_centroids";
// PROFILE_ID = "concessioni-estere";
// String tableName = "concessioni_estere_devvre_centroids";
// tableName = "concessioni_estere_internal__devvre_centroids";
// preVRE
// PROFILE_ID = "profiledConcessioni";
//String tableName = "profiledconcessioni_internal__prevre_centroids";
// String tableName = "profiledconcessioni_prevre_centroids";
// PROFILE_ID = "concessioni-estere";
// String tableName = "concessioni_estere_internal__prevre_centroids";
// tableName = "concessioni_estere_prevre_centroids";
// GNA
// PROFILE_ID = "concessioni-estere";
// String tableName = "concessioni_estere_internal__gna_centroids";
// String tableName = "concessioni_estere_gna_centroids";
// PROFILE_ID = "profiledConcessioni";
// String tableName = "profiledconcessioni_internal__gna_centroids";
// String tableName = "profiledconcessioni_gna_centroids";
// Esquiline
PROFILE_ID = "esquilino";
String tableName = "esquilino_esquiline_centroids";
long startTime = System.currentTimeMillis();
try {
RuntimeResourceReader rrr = new RuntimeResourceReader(CONTEXT, resourceName, platformName, category, null);
ServiceEndpointBean se = rrr.getListSE().get(0);
AccessPoint ap = se.getListAP().get(0);
System.out.println(ap.address());
System.out.println(ap.username());
String pwdDB = RuntimeResourceReader.dectryptPassword(CONTEXT, ap);
System.out.println(pwdDB);
Connection dbConnection = getDatabaseConnection(ap.address(), ap.username(), pwdDB);
// MUST BE DONE JUST ONCE
try {
boolean columnExists = checkColumnExists(dbConnection, tableName, TABLE_COLUMN_GEO_VIEWER_LINK);
if(!columnExists) {
addColumnTable(dbConnection, tableName, TABLE_COLUMN_GEO_VIEWER_LINK, "TEXT");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
List<String> listProjectIdsIntoDB = readTableIDs(dbConnection, tableName, "projectid");
ScopeProvider.instance.set(CONTEXT);
SecurityTokenProvider.instance.set(TOKEN);
// List<ResultDocumentDV> listPublishedProjectsIntoService =
// getListProjectsDVFiltered();
int counter = 1;
UriResolverManager uriResolverManager = new UriResolverManager("GEO");
for (String projectId : listProjectIdsIntoDB) {
Project project = null;
System.out.println("\n\n################ " + counter + " of " + listProjectIdsIntoDB.size()
+ ") Reading the project id: " + projectId);
try {
project = client.getProjectByID(PROFILE_ID, projectId);
} catch (Exception e) {
System.err.println("Project id not found: " + projectId);
}
try {
if (project == null)
continue;
System.out.println("\n###### Trying to update " + TABLE_COLUMN_GEO_VIEWER_LINK
+ " column for project id: " + projectId);
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(false);
ProjectDV projectDV = ConvertToDataValueObjectModel.toProjectDV(project, projectBuilder);
//Geoportal Resolver QueryString Builder
GeoportalResolverQueryStringBuilder builder = new GeoportalResolverQueryStringBuilder(projectDV.getProfileID(),projectId);
builder.scope(CONTEXT);
if(tableName.contains("internal")) {
builder.resolverAs(RESOLVE_AS.PRIVATE);
}
Map<String, String> params = builder.buildQueryParameters();
String shortLink = uriResolverManager.getLink(params, true);
LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
hashMap.put(TABLE_COLUMN_GEO_VIEWER_LINK, shortLink);
updateTable(dbConnection, tableName, "projectId='" + projectId + "'", hashMap);
System.out.println("###UPDATED project id: " + projectId);
Thread.sleep(500);
System.out.println("################ Update completed for: " + projectId);
} catch (Exception e) {
System.err.println("Error on updating the table for the project id: " + projectId);
}
counter++;
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
long endTime = System.currentTimeMillis();
System.out.println("\n\nSCRIPT END at: " + endTime);
double toSec = (endTime - startTime) / 1000;
System.out.println("SCRIPT TERMINATED in " + toSec + "sec");
}
public static List<ResultDocumentDV> getListProjectsDVFiltered() throws Exception {
// List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID);
SearchingFilter filter = new SearchingFilter();
// Where Clause
List<WhereClause> conditions = new ArrayList<WhereClause>();
Map<String, Object> searchInto = new HashMap<String, Object>();
searchInto.put("_lifecycleInformation._phase", "Published");
WhereClause whereClause = new WhereClause(LOGICAL_OP.OR, searchInto);
conditions.add(whereClause);
filter.setConditions(conditions);
LinkedHashMap<String, Object> projection = new LinkedHashMap<String, Object>();
// default
// PROJECTION
String theDoc = Project.THE_DOCUMENT + ".";
projection.put(Project.ID, 1);
projection.put(theDoc + "nome", 1);
projection.put(theDoc + JSON_KEY_DATA_INIZIO_PROGETTO, 1);
projection.put(theDoc + JSON_KEY_DATA_FINE_PROGETTO, 1);
filter.setProjection(projection);
Integer totalDocs = client.getTotalDocument(PROFILE_ID);
Iterator<Project> projects = client.queryOnMongo(PROFILE_ID, totalDocs, 0, null, filter);
List<ResultDocumentDV> results = ConvertToDataValueObjectModel.toListResultDocument(projects);
int i = 0;
for (ResultDocumentDV projectDV : results) {
System.out.println(++i + ") " + projectDV.getId() + " " + JSON_KEY_DATA_INIZIO_PROGETTO + ": "
+ projectDV.getDocumentAsMap().get(JSON_KEY_DATA_INIZIO_PROGETTO) + " "
+ JSON_KEY_DATA_FINE_PROGETTO + ": " + projectDV.getDocumentAsMap().get(JSON_KEY_DATA_FINE_PROGETTO)
+ " " + JSON_KEY_INTRODUZIONE + ": " + projectDV.getDocumentAsMap().get(JSON_KEY_INTRODUZIONE));
}
return results;
}
/**
* Gets the database connection.
*
* @param dbURL the db url
* @param user the user
* @param pwd the pwd
* @return the database connection
*/
public static Connection getDatabaseConnection(String dbURL, String user, String pwd) {
System.out.println("dbURL: " + dbURL);
Connection c = null;
try {
Class.forName("org.postgresql.Driver");
c = DriverManager.getConnection(dbURL, user, pwd);
c.setAutoCommit(false);
} catch (Exception e) {
e.printStackTrace();
System.err.println(e.getClass().getName() + ": " + e.getMessage());
System.exit(0);
}
System.out.println("Opened database successfully");
return c;
}
public static void addColumnTable(Connection con, String tableName, String newColumn, String type)
throws SQLException {
String alterTableString = String.format("ALTER TABLE %s ADD COLUMN %s %s", tableName, newColumn, type);
System.out.println("Executing: " + alterTableString);
try {
con.setAutoCommit(false);
if (!READ_ONLY_MODE) {
con.createStatement().execute(alterTableString);
con.commit();
}
} catch (SQLException e) {
e.printStackTrace();
if (con != null) {
try {
System.err.print("Transaction is being rolled back");
con.rollback();
} catch (SQLException excep) {
e.printStackTrace();
}
}
}
System.out.println("Executed: " + alterTableString);
}
public static Boolean checkColumnExists(Connection con, String tableName, String columnName) throws SQLException {
String columnExistsLabel = "COLUMN_EXISTS";
String sql = String.format(
"SELECT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name='%s' AND column_name='%s') as %s",
tableName, columnName, columnExistsLabel);
System.out.println("Executing: " + sql);
PreparedStatement p;
ResultSet resultSet;
try {
p = con.prepareStatement(sql);
resultSet = p.executeQuery();
// Expected 1 row
resultSet.next();
Boolean columnExists = resultSet.getBoolean(columnExistsLabel);
System.out.println("\n####Column exists: " + columnExists + "\n");
return columnExists;
} catch (SQLException e) {
System.err.println(e);
return false;
}
}
public static void updateTable(Connection con, String tableName, String whereCondition,
LinkedHashMap<String, String> mapColumnValue) throws SQLException {
StringBuilder updateSQL = new StringBuilder();
updateSQL.append("UPDATE " + tableName + " SET");
int i = 1;
for (String column : mapColumnValue.keySet()) {
updateSQL.append(" " + column + "=?");
if (i < mapColumnValue.size())
updateSQL.append(", ");
i++;
}
updateSQL.append(" WHERE " + whereCondition);
String update = updateSQL.toString();
// System.out.println("Executing: " + update);
try (PreparedStatement updatePS = con.prepareStatement(update);) {
int index = 1;
for (String column : mapColumnValue.keySet()) {
updatePS.setString(index, mapColumnValue.get(column));
index++;
}
con.setAutoCommit(false);
System.out.println("Executing: " + updatePS.toString());
if (!READ_ONLY_MODE) {
updatePS.executeUpdate();
con.commit();
}
} catch (SQLException e) {
e.printStackTrace();
if (con != null) {
try {
System.err.print("Transaction is being rolled back");
con.rollback();
} catch (SQLException excep) {
e.printStackTrace();
}
}
}
}
// Step1: Main driver method
public static List<String> readTableIDs(Connection con, String tableName, String columnNameProjectId) {
PreparedStatement p = null;
ResultSet resultSet = null;
// Try block to catch exception/s
List<String> listProjectIds = new ArrayList<String>();
try {
// SQL command data stored in String datatype
String sql = String.format("SELECT * FROM %s", tableName);
p = con.prepareStatement(sql);
resultSet = p.executeQuery();
ResultSetMetaData rsmd = resultSet.getMetaData();
int columnsNumber = rsmd.getColumnCount();
int row = 1;
System.out.println("\n####TABLE: " + tableName + " content..\n");
while (resultSet.next()) {
System.out.print("" + row + "] ");
for (int i = 1; i <= columnsNumber; i++) {
String columnValue = resultSet.getString(i);
System.out.print("(" + rsmd.getColumnName(i) + ") " + columnValue + " | ");
}
row++;
System.out.println("\n");
String projectId = resultSet.getString(columnNameProjectId);
listProjectIds.add(projectId);
}
System.out.println("####TABLE: " + tableName + " end content\n");
}
// Catch block to handle exception
catch (SQLException e) {
// Print exception pop-up on screen
System.err.println(e);
}
System.out.println("returning list IDs: " + listProjectIds);
return listProjectIds;
}
}

View File

@ -1,538 +0,0 @@
package org.gcube.application;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
import org.gcube.application.se.RuntimeResourceReader;
import org.gcube.application.se.ServiceEndpointBean;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
import org.gcube.common.scope.api.ScopeProvider;
public class GNA_New_DataModel_IndexTable_25925 {
private static String PROFILE_ID = "profiledConcessioni";
private static final String platformName = "postgis";
private static final String category = "Database";
// These are defined via ContextConfigTest.readContextSettings();
private static String CONTEXT = "";
private static String TOKEN = "";
// #### DEV
// DB
// private static final String resourceName = "GNA-POSTGIS-DB"; // devVRE
// #### PRE
// DB
private static final String resourceName = "Geoserver-t postgis"; // preVRE
// #### PROD
// DB
// private static final String resourceName = "GNA-postgis"; // GNA
// Esquiline
// private static final String CONTEXT = "/d4science.research-infrastructures.eu/gCubeApps/Esquiline";
// private static final String TOKEN = ""; //Esquiline
// private static String PROFILE_ID = "esquilino";
// GEOPORTAL
// private static String PROFILE_ID = "profiledConcessioni";
// private static final String PROFILE_ID = "concessioni-estere";
private static final Map<String, String> ADD_TABLE_COLUMNS = new LinkedHashMap<>();
// static {
// ADD_TABLE_COLUMNS.put("ufficio_mic_competente", "TEXT");
// ADD_TABLE_COLUMNS.put("funzionario_responsabile", "TEXT");
// ADD_TABLE_COLUMNS.put("modalita_individuazione", "TEXT");
// ADD_TABLE_COLUMNS.put("contesto_indagine", "TEXT");
// ADD_TABLE_COLUMNS.put("denominazione", "TEXT");
// ADD_TABLE_COLUMNS.put("stato_attuale", "TEXT");
// ADD_TABLE_COLUMNS.put("accessibilita", "TEXT");
// ADD_TABLE_COLUMNS.put("cronologia_macrofase", "TEXT");
// ADD_TABLE_COLUMNS.put("specifiche_cronologia", "TEXT");
// ADD_TABLE_COLUMNS.put("quota_max", "TEXT");
// ADD_TABLE_COLUMNS.put("quota_min", "TEXT");
// }
private static final Map<String, String> DROP_TABLE_COLUMNS = new HashMap<>();
// static {
// DROP_TABLE_COLUMNS.put("autore", "");
// DROP_TABLE_COLUMNS.put("titolare", "");
// DROP_TABLE_COLUMNS.put("titolare_licenza", "");
// }
private static final Map<String, String> RENAME_TABLE_COLUMNS = new HashMap<>();
//Rename from column to column
// static {
// RENAME_TABLE_COLUMNS.put("ufficio_mic_competente", "ufficio_competente");
// }
private static ProjectsCaller client = null;
public static final boolean READ_ONLY_MODE = true;
public static List<String> listTable = new ArrayList<String>();
/**
* Gets the client.
*
* @return the client
*/
// @Before
public static void initGeoportalClient() {
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ContextConfigTest.readContextSettings();
CONTEXT = ContextConfigTest.CONTEXT;
TOKEN = ContextConfigTest.TOKEN;
ScopeProvider.instance.set(CONTEXT);
SecurityTokenProvider.instance.set(TOKEN);
client = GeoportalClientCaller.projects();
}
public static void main(String[] args) {
initGeoportalClient();
System.out.println("READ_ONLY_MODE ENABLED: " + READ_ONLY_MODE);
System.out.println("CONTEXT IS: " + CONTEXT);
System.out.println("PROFILE_ID: " + PROFILE_ID);
// devVRE
// PROFILE_ID = "profiledConcessioni";
// String tableName = "profiledconcessioni_devvre_centroids";
// tableName = "profiledconcessioni_internal__devvre_centroids";
// PROFILE_ID = "concessioni-estere";
// String tableName = "concessioni_estere_devvre_centroids";
// tableName = "concessioni_estere_internal__devvre_centroids";
// preVRE
// PROFILE_ID = "profiledConcessioni";
// listTable.add("profiledconcessioni_internal__prevre_centroids");
// listTable.add("profiledconcessioni_prevre_centroids");
PROFILE_ID = "concessioni-estere";
listTable.add("concessioni_estere_internal__prevre_centroids");
listTable.add("concessioni_estere_prevre_centroids");
// GNA
// PROFILE_ID = "concessioni-estere";
// String tableName = "concessioni_estere_internal__gna_centroids";
// String tableName = "concessioni_estere_gna_centroids";
// PROFILE_ID = "profiledConcessioni";
// String tableName = "profiledconcessioni_internal__gna_centroids";
// String tableName = "profiledconcessioni_gna_centroids";
// Esquiline
// PROFILE_ID = "esquilino";
// String tableName = "esquilino_esquiline_centroids";
long startTime = System.currentTimeMillis();
try {
RuntimeResourceReader rrr = new RuntimeResourceReader(CONTEXT, resourceName, platformName, category, null);
ServiceEndpointBean se = rrr.getListSE().get(0);
AccessPoint ap = se.getListAP().get(0);
System.out.println(ap.address());
System.out.println(ap.username());
String pwdDB = RuntimeResourceReader.dectryptPassword(CONTEXT, ap);
System.out.println(pwdDB);
Connection dbConnection = getDatabaseConnection(ap.address(), ap.username(), pwdDB);
for (String tableName : listTable) {
System.out.println("\n\n# SOURCE TABLE");
Boolean tableExists = checkTableExists(dbConnection, tableName);
if (!tableExists) {
throw new Exception("Table '" + tableName + "' does not exits in the DB!!! Exit");
}
printTableColumn(dbConnection, tableName);
System.out.println("\n\n### ADDING COLUMNS...\n");
// ADD NEW COLUMNS
for (String columnName : ADD_TABLE_COLUMNS.keySet()) {
try {
boolean columnExists = checkColumnExists(dbConnection, tableName, columnName);
if (!columnExists) {
addColumnTable(dbConnection, tableName, columnName, ADD_TABLE_COLUMNS.get(columnName));
int sleeping = 500;
System.out.println("... sleeping " + sleeping + " ...");
Thread.sleep(sleeping);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
}
System.out.println("\n\n### END ADD COLUMNS");
System.out.println("\n\n### DROPPING COLUMNS...\n");
// REMOVE OLD COLUMNS
for (String columnName : DROP_TABLE_COLUMNS.keySet()) {
try {
boolean columnExists = checkColumnExists(dbConnection, tableName, columnName);
if (columnExists) {
dropColumnTable(dbConnection, tableName, columnName, DROP_TABLE_COLUMNS.get(columnName));
int sleeping = 1000;
System.out.println("... sleeping " + sleeping + " ...");
Thread.sleep(sleeping);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
}
System.out.println("\n\n### END DROP COLUMNS");
System.out.println("\n\n### RENAMING COLUMNS...\n");
// RENAME_TABLE_COLUMNS
for (String columnName : RENAME_TABLE_COLUMNS.keySet()) {
try {
boolean columnExists = checkColumnExists(dbConnection, tableName, columnName);
if (columnExists) {
renameColumnTable(dbConnection, tableName, columnName, RENAME_TABLE_COLUMNS.get(columnName));
int sleeping = 1000;
System.out.println("... sleeping " + sleeping + " ...");
Thread.sleep(sleeping);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
}
System.out.println("\n\n### END RENAME COLUMNS");
System.out.println("\n\n# UPDATED TABLE");
printTableColumn(dbConnection, tableName);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
long endTime = System.currentTimeMillis();
System.out.println("\n\nSCRIPT END at: " + endTime);
double toSec = (endTime - startTime) / 1000;
System.out.println("SCRIPT TERMINATED in " + toSec + "sec");
}
public static void printTableColumn(Connection con, String tablename) {
try {
DatabaseMetaData databaseMetaData = con.getMetaData();
// Print TABLE_TYPE "TABLE"
ResultSet columns = databaseMetaData.getColumns(null, null, tablename, null);
System.out.println("\n==== TABLE " + tablename + " ");
System.out.println("[COLUMN_NAME - TYPE_NAME ( COLUMN_SIZE )]");
System.out.println("-----------------------------------------------");
while (columns.next()) {
String columnName = columns.getString("COLUMN_NAME");
String columnType = columns.getString("TYPE_NAME");
int columnSize = columns.getInt("COLUMN_SIZE");
System.out.println("\t" + columnName + " - " + columnType + " (" + columnSize + ")");
}
System.out.println("-----------------------------------------------");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* Gets the database connection.
*
* @param dbURL the db url
* @param user the user
* @param pwd the pwd
* @return the database connection
*/
public static Connection getDatabaseConnection(String dbURL, String user, String pwd) {
System.out.println("dbURL: " + dbURL);
Connection c = null;
try {
Class.forName("org.postgresql.Driver");
c = DriverManager.getConnection(dbURL, user, pwd);
c.setAutoCommit(false);
} catch (Exception e) {
e.printStackTrace();
System.err.println(e.getClass().getName() + ": " + e.getMessage());
System.exit(0);
}
System.out.println("Opened database successfully");
return c;
}
public static void addColumnTable(Connection con, String tableName, String newColumn, String type)
throws SQLException {
String alterTableString = String.format("ALTER TABLE %s ADD COLUMN %s %s", tableName, newColumn, type);
System.out.println("Executing: " + alterTableString);
try {
con.setAutoCommit(false);
if (!READ_ONLY_MODE) {
con.createStatement().execute(alterTableString);
con.commit();
}
} catch (SQLException e) {
e.printStackTrace();
if (con != null) {
try {
System.err.print("Transaction is being rolled back");
con.rollback();
} catch (SQLException excep) {
e.printStackTrace();
}
}
}
System.out.println("Executed: " + alterTableString);
}
public static void renameColumnTable(Connection con, String tableName, String oldColumn, String newColumn)
throws SQLException {
String alterTableString = String.format("ALTER TABLE %s RENAME COLUMN %s TO %s", tableName, oldColumn,
newColumn);
System.out.println("Executing: " + alterTableString);
try {
con.setAutoCommit(false);
if (!READ_ONLY_MODE) {
con.createStatement().execute(alterTableString);
con.commit();
}
} catch (SQLException e) {
e.printStackTrace();
if (con != null) {
try {
System.err.print("Transaction is being rolled back");
con.rollback();
} catch (SQLException excep) {
e.printStackTrace();
}
}
}
System.out.println("Executed: " + alterTableString);
}
public static void dropColumnTable(Connection con, String tableName, String oldColumn, String type)
throws SQLException {
String alterTableString = String.format("ALTER TABLE %s DROP COLUMN %s", tableName, oldColumn);
System.out.println("Executing: " + alterTableString);
try {
con.setAutoCommit(false);
if (!READ_ONLY_MODE) {
con.createStatement().execute(alterTableString);
con.commit();
}
} catch (SQLException e) {
e.printStackTrace();
if (con != null) {
try {
System.err.print("Transaction is being rolled back");
con.rollback();
} catch (SQLException excep) {
e.printStackTrace();
}
}
}
System.out.println("Executed: " + alterTableString);
}
public static Boolean checkColumnExists(Connection con, String tableName, String columnName) throws SQLException {
String columnExistsLabel = "COLUMN_EXISTS";
String sql = String.format(
"SELECT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name='%s' AND column_name='%s') as %s",
tableName, columnName, columnExistsLabel);
System.out.println("\n+++ " + columnExistsLabel + " checking '" + tableName + "': " + sql);
PreparedStatement p;
ResultSet resultSet;
try {
p = con.prepareStatement(sql);
resultSet = p.executeQuery();
// Expected 1 row
resultSet.next();
Boolean columnExists = resultSet.getBoolean(columnExistsLabel);
System.out.println("\t RESP --> Column '" + columnName + "' exists: " + columnExists + "\n");
return columnExists;
} catch (SQLException e) {
System.err.println(e);
return false;
}
}
public static Boolean checkTableExists(Connection con, String tableName) throws SQLException {
String tableExistsLabel = "TABLE_EXISTS";
String sql = String.format(
"SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='%s' AND table_type LIKE 'BASE TABLE' AND table_schema LIKE 'public') as %s",
tableName, tableExistsLabel);
System.out.println("\n+++ " + tableExistsLabel + " checking '" + tableName + "': " + sql);
PreparedStatement p;
ResultSet resultSet;
try {
p = con.prepareStatement(sql);
resultSet = p.executeQuery();
// Expected 1 row
resultSet.next();
Boolean tableExists = resultSet.getBoolean(tableExistsLabel);
System.out.println("\t RESP --> Table '" + tableName + "' exists: " + tableExists + "\n");
return tableExists;
} catch (SQLException e) {
System.err.println(e);
return false;
}
}
public static void updateTable(Connection con, String tableName, String whereCondition,
LinkedHashMap<String, String> mapColumnValue) throws SQLException {
StringBuilder updateSQL = new StringBuilder();
updateSQL.append("UPDATE " + tableName + " SET");
int i = 1;
for (String column : mapColumnValue.keySet()) {
updateSQL.append(" " + column + "=?");
if (i < mapColumnValue.size())
updateSQL.append(", ");
i++;
}
updateSQL.append(" WHERE " + whereCondition);
String update = updateSQL.toString();
// System.out.println("Executing: " + update);
try (PreparedStatement updatePS = con.prepareStatement(update);) {
int index = 1;
for (String column : mapColumnValue.keySet()) {
updatePS.setString(index, mapColumnValue.get(column));
index++;
}
con.setAutoCommit(false);
System.out.println("Executing: " + updatePS.toString());
if (!READ_ONLY_MODE) {
updatePS.executeUpdate();
con.commit();
}
} catch (SQLException e) {
e.printStackTrace();
if (con != null) {
try {
System.err.print("Transaction is being rolled back");
con.rollback();
} catch (SQLException excep) {
e.printStackTrace();
}
}
}
}
// Step1: Main driver method
public static List<String> readTableIDs(Connection con, String tableName, String columnNameProjectId) {
PreparedStatement p = null;
ResultSet resultSet = null;
// Try block to catch exception/s
List<String> listProjectIds = new ArrayList<String>();
try {
// SQL command data stored in String datatype
String sql = String.format("SELECT * FROM %s", tableName);
p = con.prepareStatement(sql);
resultSet = p.executeQuery();
ResultSetMetaData rsmd = resultSet.getMetaData();
int columnsNumber = rsmd.getColumnCount();
int row = 1;
System.out.println("\n####TABLE: " + tableName + " content..\n");
while (resultSet.next()) {
System.out.print("" + row + "] ");
for (int i = 1; i <= columnsNumber; i++) {
String columnValue = resultSet.getString(i);
System.out.print("(" + rsmd.getColumnName(i) + ") " + columnValue + " | ");
}
row++;
System.out.println("\n");
String projectId = resultSet.getString(columnNameProjectId);
listProjectIds.add(projectId);
}
System.out.println("####TABLE: " + tableName + " end content\n");
}
// Catch block to handle exception
catch (SQLException e) {
// Print exception pop-up on screen
System.err.println(e);
}
System.out.println("returning list IDs: " + listProjectIds);
return listProjectIds;
}
}

View File

@ -1,511 +0,0 @@
package org.gcube.application;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
import org.gcube.application.se.RuntimeResourceReader;
import org.gcube.application.se.ServiceEndpointBean;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
import org.gcube.common.scope.api.ScopeProvider;
public class GNA_New_DataModel_IndexTable_PROD_25926 {
private static String PROFILE_ID = "profiledConcessioni";
private static final String platformName = "postgis";
private static final String category = "Database";
// These are defined via ContextConfigTest.readContextSettings();
private static String CONTEXT = "";
private static String TOKEN = "";
// #### PROD
// DB
private static final String resourceName = "GNA-postgis"; // GNA
// Esquiline
// private static final String CONTEXT = "/d4science.research-infrastructures.eu/gCubeApps/Esquiline";
// private static final String TOKEN = ""; //Esquiline
// private static String PROFILE_ID = "esquilino";
private static final Map<String, String> ADD_TABLE_COLUMNS = new LinkedHashMap<>();
// static {
// ADD_TABLE_COLUMNS.put("ufficio_mic_competente", "TEXT");
// ADD_TABLE_COLUMNS.put("funzionario_responsabile", "TEXT");
// ADD_TABLE_COLUMNS.put("modalita_individuazione", "TEXT");
// ADD_TABLE_COLUMNS.put("contesto_indagine", "TEXT");
// ADD_TABLE_COLUMNS.put("denominazione", "TEXT");
// ADD_TABLE_COLUMNS.put("stato_attuale", "TEXT");
// ADD_TABLE_COLUMNS.put("accessibilita", "TEXT");
// ADD_TABLE_COLUMNS.put("cronologia_macrofase", "TEXT");
// ADD_TABLE_COLUMNS.put("specifiche_cronologia", "TEXT");
// ADD_TABLE_COLUMNS.put("quota_max", "TEXT");
// ADD_TABLE_COLUMNS.put("quota_min", "TEXT");
// }
//
private static final Map<String, String> DROP_TABLE_COLUMNS = new HashMap<>();
// static {
// DROP_TABLE_COLUMNS.put("autore", "");
// DROP_TABLE_COLUMNS.put("titolare", "");
// DROP_TABLE_COLUMNS.put("titolare_licenza", "");
// }
private static final Map<String, String> RENAME_TABLE_COLUMNS = new HashMap<>();
// Rename from column to column
static {
RENAME_TABLE_COLUMNS.put("ufficio_mic_competente", "ufficio_competente");
}
private static ProjectsCaller client = null;
public static final boolean READ_ONLY_MODE = true;
public static List<String> listTable = new ArrayList<String>();
/**
* Gets the client.
*
* @return the client
*/
// @Before
public static void initGeoportalClient() {
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ContextConfigTest.readContextSettings();
CONTEXT = ContextConfigTest.CONTEXT;
TOKEN = ContextConfigTest.TOKEN;
ScopeProvider.instance.set(CONTEXT);
SecurityTokenProvider.instance.set(TOKEN);
client = GeoportalClientCaller.projects();
}
public static void main(String[] args) {
initGeoportalClient();
System.out.println("READ_ONLY_MODE ENABLED: " + READ_ONLY_MODE);
System.out.println("CONTEXT IS: " + CONTEXT);
System.out.println("PROFILE_ID: " + PROFILE_ID);
// GNA
// PROFILE_ID = "profiledConcessioni";
// listTable.add("profiledconcessioni_internal__gna_centroids");
// listTable.add("profiledconcessioni_gna_centroids");
// PROFILE_ID = "concessioni-estere";
// listTable.add("concessioni_estere_internal__gna_centroids");
// listTable.add("concessioni_estere_gna_centroids");
// Esquiline
// PROFILE_ID = "esquilino";
// String tableName = "esquilino_esquiline_centroids";
long startTime = System.currentTimeMillis();
try {
RuntimeResourceReader rrr = new RuntimeResourceReader(CONTEXT, resourceName, platformName, category, null);
ServiceEndpointBean se = rrr.getListSE().get(0);
AccessPoint ap = se.getListAP().get(0);
System.out.println(ap.address());
System.out.println(ap.username());
String pwdDB = RuntimeResourceReader.dectryptPassword(CONTEXT, ap);
System.out.println(pwdDB);
Connection dbConnection = getDatabaseConnection(ap.address(), ap.username(), pwdDB);
for (String tableName : listTable) {
System.out.println("\n\n# SOURCE TABLE");
Boolean tableExists = checkTableExists(dbConnection, tableName);
if (!tableExists) {
throw new Exception("Table '" + tableName + "' does not exits in the DB!!! Exit");
}
printTableColumn(dbConnection, tableName);
System.out.println("\n\n### ADDING COLUMNS...\n");
// ADD NEW COLUMNS
for (String columnName : ADD_TABLE_COLUMNS.keySet()) {
try {
boolean columnExists = checkColumnExists(dbConnection, tableName, columnName);
if (!columnExists) {
addColumnTable(dbConnection, tableName, columnName, ADD_TABLE_COLUMNS.get(columnName));
int sleeping = 500;
System.out.println("... sleeping " + sleeping + " ...");
Thread.sleep(sleeping);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
}
System.out.println("\n\n### END ADD COLUMNS");
System.out.println("\n\n### DROPPING COLUMNS...\n");
// REMOVE OLD COLUMNS
for (String columnName : DROP_TABLE_COLUMNS.keySet()) {
try {
boolean columnExists = checkColumnExists(dbConnection, tableName, columnName);
if (columnExists) {
dropColumnTable(dbConnection, tableName, columnName, DROP_TABLE_COLUMNS.get(columnName));
int sleeping = 1000;
System.out.println("... sleeping " + sleeping + " ...");
Thread.sleep(sleeping);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
}
System.out.println("\n\n### END DROP COLUMNS");
System.out.println("\n\n### RENAMING COLUMNS...\n");
// RENAME_TABLE_COLUMNS
for (String columnName : RENAME_TABLE_COLUMNS.keySet()) {
try {
boolean columnExists = checkColumnExists(dbConnection, tableName, columnName);
if (columnExists) {
renameColumnTable(dbConnection, tableName, columnName,
RENAME_TABLE_COLUMNS.get(columnName));
int sleeping = 1000;
System.out.println("... sleeping " + sleeping + " ...");
Thread.sleep(sleeping);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
}
System.out.println("\n\n### END RENAME COLUMNS");
System.out.println("\n\n# UPDATED TABLE");
printTableColumn(dbConnection, tableName);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
long endTime = System.currentTimeMillis();
System.out.println("\n\nSCRIPT END at: " + endTime);
double toSec = (endTime - startTime) / 1000;
System.out.println("SCRIPT TERMINATED in " + toSec + "sec");
}
public static void printTableColumn(Connection con, String tablename) {
try {
DatabaseMetaData databaseMetaData = con.getMetaData();
// Print TABLE_TYPE "TABLE"
ResultSet columns = databaseMetaData.getColumns(null, null, tablename, null);
System.out.println("\n==== TABLE " + tablename + " ");
System.out.println("[COLUMN_NAME - TYPE_NAME ( COLUMN_SIZE )]");
System.out.println("-----------------------------------------------");
while (columns.next()) {
String columnName = columns.getString("COLUMN_NAME");
String columnType = columns.getString("TYPE_NAME");
int columnSize = columns.getInt("COLUMN_SIZE");
System.out.println("\t" + columnName + " - " + columnType + " (" + columnSize + ")");
}
System.out.println("-----------------------------------------------");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* Gets the database connection.
*
* @param dbURL the db url
* @param user the user
* @param pwd the pwd
* @return the database connection
*/
public static Connection getDatabaseConnection(String dbURL, String user, String pwd) {
System.out.println("dbURL: " + dbURL);
Connection c = null;
try {
Class.forName("org.postgresql.Driver");
c = DriverManager.getConnection(dbURL, user, pwd);
c.setAutoCommit(false);
} catch (Exception e) {
e.printStackTrace();
System.err.println(e.getClass().getName() + ": " + e.getMessage());
System.exit(0);
}
System.out.println("Opened database successfully");
return c;
}
public static void addColumnTable(Connection con, String tableName, String newColumn, String type)
throws SQLException {
String alterTableString = String.format("ALTER TABLE %s ADD COLUMN %s %s", tableName, newColumn, type);
System.out.println("Executing: " + alterTableString);
try {
con.setAutoCommit(false);
if (!READ_ONLY_MODE) {
con.createStatement().execute(alterTableString);
con.commit();
}
} catch (SQLException e) {
e.printStackTrace();
if (con != null) {
try {
System.err.print("Transaction is being rolled back");
con.rollback();
} catch (SQLException excep) {
e.printStackTrace();
}
}
}
System.out.println("Executed: " + alterTableString);
}
public static void renameColumnTable(Connection con, String tableName, String oldColumn, String newColumn)
throws SQLException {
String alterTableString = String.format("ALTER TABLE %s RENAME COLUMN %s TO %s", tableName, oldColumn,
newColumn);
System.out.println("Executing: " + alterTableString);
try {
con.setAutoCommit(false);
if (!READ_ONLY_MODE) {
con.createStatement().execute(alterTableString);
con.commit();
}
} catch (SQLException e) {
e.printStackTrace();
if (con != null) {
try {
System.err.print("Transaction is being rolled back");
con.rollback();
} catch (SQLException excep) {
e.printStackTrace();
}
}
}
System.out.println("Executed: " + alterTableString);
}
public static void dropColumnTable(Connection con, String tableName, String oldColumn, String type)
throws SQLException {
String alterTableString = String.format("ALTER TABLE %s DROP COLUMN %s", tableName, oldColumn);
System.out.println("Executing: " + alterTableString);
try {
con.setAutoCommit(false);
if (!READ_ONLY_MODE) {
con.createStatement().execute(alterTableString);
con.commit();
}
} catch (SQLException e) {
e.printStackTrace();
if (con != null) {
try {
System.err.print("Transaction is being rolled back");
con.rollback();
} catch (SQLException excep) {
e.printStackTrace();
}
}
}
System.out.println("Executed: " + alterTableString);
}
public static Boolean checkColumnExists(Connection con, String tableName, String columnName) throws SQLException {
String columnExistsLabel = "COLUMN_EXISTS";
String sql = String.format(
"SELECT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name='%s' AND column_name='%s') as %s",
tableName, columnName, columnExistsLabel);
System.out.println("\n+++ " + columnExistsLabel + " checking '" + tableName + "': " + sql);
PreparedStatement p;
ResultSet resultSet;
try {
p = con.prepareStatement(sql);
resultSet = p.executeQuery();
// Expected 1 row
resultSet.next();
Boolean columnExists = resultSet.getBoolean(columnExistsLabel);
System.out.println("\t RESP --> Column '" + columnName + "' exists: " + columnExists + "\n");
return columnExists;
} catch (SQLException e) {
System.err.println(e);
return false;
}
}
public static Boolean checkTableExists(Connection con, String tableName) throws SQLException {
String tableExistsLabel = "TABLE_EXISTS";
String sql = String.format(
"SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='%s' AND table_type LIKE 'BASE TABLE' AND table_schema LIKE 'public') as %s",
tableName, tableExistsLabel);
System.out.println("\n+++ " + tableExistsLabel + " checking '" + tableName + "': " + sql);
PreparedStatement p;
ResultSet resultSet;
try {
p = con.prepareStatement(sql);
resultSet = p.executeQuery();
// Expected 1 row
resultSet.next();
Boolean tableExists = resultSet.getBoolean(tableExistsLabel);
System.out.println("\t RESP --> Table '" + tableName + "' exists: " + tableExists + "\n");
return tableExists;
} catch (SQLException e) {
System.err.println(e);
return false;
}
}
public static void updateTable(Connection con, String tableName, String whereCondition,
LinkedHashMap<String, String> mapColumnValue) throws SQLException {
StringBuilder updateSQL = new StringBuilder();
updateSQL.append("UPDATE " + tableName + " SET");
int i = 1;
for (String column : mapColumnValue.keySet()) {
updateSQL.append(" " + column + "=?");
if (i < mapColumnValue.size())
updateSQL.append(", ");
i++;
}
updateSQL.append(" WHERE " + whereCondition);
String update = updateSQL.toString();
// System.out.println("Executing: " + update);
try (PreparedStatement updatePS = con.prepareStatement(update);) {
int index = 1;
for (String column : mapColumnValue.keySet()) {
updatePS.setString(index, mapColumnValue.get(column));
index++;
}
con.setAutoCommit(false);
System.out.println("Executing: " + updatePS.toString());
if (!READ_ONLY_MODE) {
updatePS.executeUpdate();
con.commit();
}
} catch (SQLException e) {
e.printStackTrace();
if (con != null) {
try {
System.err.print("Transaction is being rolled back");
con.rollback();
} catch (SQLException excep) {
e.printStackTrace();
}
}
}
}
// Step1: Main driver method
public static List<String> readTableIDs(Connection con, String tableName, String columnNameProjectId) {
PreparedStatement p = null;
ResultSet resultSet = null;
// Try block to catch exception/s
List<String> listProjectIds = new ArrayList<String>();
try {
// SQL command data stored in String datatype
String sql = String.format("SELECT * FROM %s", tableName);
p = con.prepareStatement(sql);
resultSet = p.executeQuery();
ResultSetMetaData rsmd = resultSet.getMetaData();
int columnsNumber = rsmd.getColumnCount();
int row = 1;
System.out.println("\n####TABLE: " + tableName + " content..\n");
while (resultSet.next()) {
System.out.print("" + row + "] ");
for (int i = 1; i <= columnsNumber; i++) {
String columnValue = resultSet.getString(i);
System.out.print("(" + rsmd.getColumnName(i) + ") " + columnValue + " | ");
}
row++;
System.out.println("\n");
String projectId = resultSet.getString(columnNameProjectId);
listProjectIds.add(projectId);
}
System.out.println("####TABLE: " + tableName + " end content\n");
}
// Catch block to handle exception
catch (SQLException e) {
// Print exception pop-up on screen
System.err.println(e);
}
System.out.println("returning list IDs: " + listProjectIds);
return listProjectIds;
}
}

Some files were not shown because too many files have changed in this diff Show More