diff --git a/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataValueObjectModel.java b/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataValueObjectModel.java index 95bd087..fe07e63 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataValueObjectModel.java +++ b/src/main/java/org/gcube/application/geoportalcommon/ConvertToDataValueObjectModel.java @@ -20,17 +20,17 @@ import org.gcube.application.geoportalcommon.geoportal.config.GcubeProfile; import org.gcube.application.geoportalcommon.geoportal.config.ItemField; import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV; import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; -import org.gcube.application.geoportalcommon.shared.geoportal.GEOPORTAL_CONFIGURATION_TYPE; -import org.gcube.application.geoportalcommon.shared.geoportal.GEOPORTAL_DATA_HANDLER; -import org.gcube.application.geoportalcommon.shared.geoportal.HandlerDeclarationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.IdentificationReferenceDV; -import org.gcube.application.geoportalcommon.shared.geoportal.LifecycleInformationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.ProjectDV; -import org.gcube.application.geoportalcommon.shared.geoportal.RelationshipDV; -import org.gcube.application.geoportalcommon.shared.geoportal.UseCaseDescriptorDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.IdentificationReferenceDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_CONFIGURATION_TYPE; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java index 9d90d3f..31e7f40 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java +++ b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java @@ -6,13 +6,16 @@ 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.rest.QueryRequest; @@ -30,12 +33,18 @@ 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.ProjectDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.PhaseDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV; +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; @@ -75,7 +84,7 @@ public class ProjectsCaller { Document myDocument = Document.parse(jsonDocument); Projects client = getClient(profileID); Project project = client.createNew(myDocument); - + return project; } @@ -166,6 +175,95 @@ public class ProjectsCaller { 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 client = (Projects) getClient(profileID); + Configuration config = client.getConfiguration(); + List 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 getIDsPhases(String profileID) throws Exception { + LOG.info("getIDsPhases called for profileID: {}", profileID); + Projects client = (Projects) getClient(profileID); + Configuration config = client.getConfiguration(); + List 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 listdata = new HashSet(phases.length()); + for (int i = 0; i < phases.length(); i++) { + listdata.add(phases.get(i).toString()); + } + List idsPhases = listdata.stream().collect(Collectors.toList()); + LOG.info("getIDsPhases returning: {}", idsPhases); + return idsPhases; + } + } + + LOG.info("getIDsPhases returning null"); + return null; + } + + public PhaseDV[] getPhases(String profileID) throws Exception { + LOG.info("getPhases called for profileID: {}", profileID); + Projects client = (Projects) getClient(profileID); + Configuration config = client.getConfiguration(); + List 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; + } + /** * Query on mongo. * @@ -251,11 +349,11 @@ public class ProjectsCaller { } } - + Map projection = filter.getProjection(); - + Document projectionDocument = null; - if(projection!=null && !projection.isEmpty()) { + if (projection != null && !projection.isEmpty()) { projectionDocument = new Document(projection); } @@ -264,7 +362,7 @@ public class ProjectsCaller { paging.setOffset(offsetIndex); paging.setLimit(limitIndex); request.setPaging(paging); - + OrderedRequest ordering = new OrderedRequest(); ordering.setDirection(sDirection); ordering.setFields(orderingFields); @@ -311,28 +409,27 @@ public class ProjectsCaller { } } } - - if(projectionDocument!=null) { + + if (projectionDocument != null) { request.setProjection(projectionDocument); - - //THE first field specified in the projection must be not null + + // THE first field specified in the projection must be not null BasicDBObject bsNotEqualEmpty = new BasicDBObject(); bsNotEqualEmpty.append("$ne", null); - + Optional firstKey = projection.keySet().stream().findFirst(); if (firstKey.isPresent()) { - String firstFieldPath = firstKey.get(); - query.append(firstFieldPath, bsNotEqualEmpty); + String firstFieldPath = firstKey.get(); + query.append(firstFieldPath, bsNotEqualEmpty); } - + } - BasicDBObject bsValid_Document = new BasicDBObject(); bsValid_Document.append("$exists", true); bsValid_Document.append("$ne", null); query.append("_theDocument", bsValid_Document); - + BasicDBObject bsDocumentExists = new BasicDBObject(); bsDocumentExists.append("$exists", false); query.append("theDocument", bsDocumentExists); @@ -340,12 +437,12 @@ public class ProjectsCaller { // 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("Projection: " + projectionDocument); LOG.info("Order by Fields: " + orderingFields); LOG.info("Search for conditions: " + filter.getConditions()); if (query != null) { diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/ResultSetPaginatedData.java b/src/main/java/org/gcube/application/geoportalcommon/shared/ResultSetPaginatedData.java index 2c26db6..78b57ad 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/ResultSetPaginatedData.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/ResultSetPaginatedData.java @@ -6,7 +6,7 @@ package org.gcube.application.geoportalcommon.shared; import java.io.Serializable; import java.util.List; -import org.gcube.application.geoportalcommon.shared.geoportal.ProjectDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV; /** * The Class ResultSetPaginatedData. diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ConfigurationDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ConfigurationDV.java index 80a3f6f..5c37457 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ConfigurationDV.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ConfigurationDV.java @@ -4,6 +4,7 @@ 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> implements Serializable { diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/DocumentDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/DocumentDV.java index c0c418a..3b7a6c0 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/DocumentDV.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/DocumentDV.java @@ -9,7 +9,7 @@ public class DocumentDV implements Serializable { * */ private static final long serialVersionUID = 4978517506036855883L; - private LinkedHashMap documentAsMap; + protected LinkedHashMap documentAsMap; private String documentAsJSON; private ConfigurationDV configuration; diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ExtendedDocumentDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ExtendedDocumentDV.java new file mode 100644 index 0000000..1d9d450 --- /dev/null +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ExtendedDocumentDV.java @@ -0,0 +1,35 @@ +package org.gcube.application.geoportalcommon.shared.geoportal; + +import java.util.LinkedHashMap; + +public class ExtendedDocumentDV extends DocumentDV { + + /** + * + */ + private static final long serialVersionUID = -7209592503036632772L; + + public ExtendedDocumentDV() { + + } + + public void addItemToMap(String property, Object value) { + + if (documentAsMap == null) + documentAsMap = new LinkedHashMap(); + + documentAsMap.put(property, value); + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("ExtendedDocumentDV [toString()="); + builder.append(super.toString()); + builder.append("]"); + return builder.toString(); + } + + + +} diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/IdentificationReferenceDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/IdentificationReferenceDV.java similarity index 71% rename from src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/IdentificationReferenceDV.java rename to src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/IdentificationReferenceDV.java index dc6a587..3af3754 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/IdentificationReferenceDV.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/IdentificationReferenceDV.java @@ -1,7 +1,9 @@ -package org.gcube.application.geoportalcommon.shared.geoportal; +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 { /** diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/LifecycleInformationDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/LifecycleInformationDV.java similarity index 98% rename from src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/LifecycleInformationDV.java rename to src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/LifecycleInformationDV.java index 8bfa2d6..3c6db82 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/LifecycleInformationDV.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/LifecycleInformationDV.java @@ -1,4 +1,4 @@ -package org.gcube.application.geoportalcommon.shared.geoportal; +package org.gcube.application.geoportalcommon.shared.geoportal.project; import java.io.Serializable; import java.util.List; diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/PhaseDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/PhaseDV.java new file mode 100644 index 0000000..d4a8b12 --- /dev/null +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/PhaseDV.java @@ -0,0 +1,35 @@ +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() { + + } + } + +} diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ProjectDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/ProjectDV.java similarity index 94% rename from src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ProjectDV.java rename to src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/ProjectDV.java index 2700256..de8daf9 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ProjectDV.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/ProjectDV.java @@ -1,9 +1,11 @@ -package org.gcube.application.geoportalcommon.shared.geoportal; +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; + public class ProjectDV implements Serializable { /** diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/RelationshipDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/RelationshipDV.java similarity index 93% rename from src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/RelationshipDV.java rename to src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/RelationshipDV.java index aab9638..4857325 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/RelationshipDV.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/RelationshipDV.java @@ -1,4 +1,4 @@ -package org.gcube.application.geoportalcommon.shared.geoportal; +package org.gcube.application.geoportalcommon.shared.geoportal.project; import java.io.Serializable; diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/TemporalReferenceDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/TemporalReferenceDV.java similarity index 85% rename from src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/TemporalReferenceDV.java rename to src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/TemporalReferenceDV.java index 0f9e222..f6f3af6 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/TemporalReferenceDV.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/project/TemporalReferenceDV.java @@ -1,4 +1,6 @@ -package org.gcube.application.geoportalcommon.shared.geoportal; +package org.gcube.application.geoportalcommon.shared.geoportal.project; + +import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; /** * The Class TemporalReferenceDV. diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/GEOPORTAL_CONFIGURATION_TYPE.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/GEOPORTAL_CONFIGURATION_TYPE.java similarity index 86% rename from src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/GEOPORTAL_CONFIGURATION_TYPE.java rename to src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/GEOPORTAL_CONFIGURATION_TYPE.java index 3f0df1c..024e1b0 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/GEOPORTAL_CONFIGURATION_TYPE.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/GEOPORTAL_CONFIGURATION_TYPE.java @@ -1,4 +1,4 @@ -package org.gcube.application.geoportalcommon.shared.geoportal; +package org.gcube.application.geoportalcommon.shared.geoportal.ucd; public enum GEOPORTAL_CONFIGURATION_TYPE { item_fields("itemFields"), gcube_profiles("gcubeProfiles"); diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/GEOPORTAL_DATA_HANDLER.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/GEOPORTAL_DATA_HANDLER.java similarity index 86% rename from src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/GEOPORTAL_DATA_HANDLER.java rename to src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/GEOPORTAL_DATA_HANDLER.java index caa1b3b..561e5fe 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/GEOPORTAL_DATA_HANDLER.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/GEOPORTAL_DATA_HANDLER.java @@ -1,4 +1,4 @@ -package org.gcube.application.geoportalcommon.shared.geoportal; +package org.gcube.application.geoportalcommon.shared.geoportal.ucd; public enum GEOPORTAL_DATA_HANDLER { diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/HandlerDeclarationDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/HandlerDeclarationDV.java similarity index 95% rename from src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/HandlerDeclarationDV.java rename to src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/HandlerDeclarationDV.java index 91cf17b..1106f2d 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/HandlerDeclarationDV.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/HandlerDeclarationDV.java @@ -1,7 +1,9 @@ -package org.gcube.application.geoportalcommon.shared.geoportal; +package org.gcube.application.geoportalcommon.shared.geoportal.ucd; import java.io.Serializable; +import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV; + /** * The Class HandlerDeclarationDV. * diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/UseCaseDescriptorDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/UseCaseDescriptorDV.java similarity index 96% rename from src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/UseCaseDescriptorDV.java rename to src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/UseCaseDescriptorDV.java index 3aa739e..ed02738 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/UseCaseDescriptorDV.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/UseCaseDescriptorDV.java @@ -1,4 +1,4 @@ -package org.gcube.application.geoportalcommon.shared.geoportal; +package org.gcube.application.geoportalcommon.shared.geoportal.ucd; import java.io.Serializable; import java.util.List; diff --git a/src/test/java/org/gcube/application/LoadDocumentConfiguration.java b/src/test/java/org/gcube/application/LoadDocumentConfiguration.java index 6ea1891..fb082ed 100644 --- a/src/test/java/org/gcube/application/LoadDocumentConfiguration.java +++ b/src/test/java/org/gcube/application/LoadDocumentConfiguration.java @@ -12,8 +12,8 @@ import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDec import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel; import org.gcube.application.geoportalcommon.geoportal.config.GcubeProfile; import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.HandlerDeclarationDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV; import org.gcube.common.scope.api.ScopeProvider; import org.junit.Test; import org.slf4j.Logger; diff --git a/src/test/java/org/gcube/application/Project_Tests.java b/src/test/java/org/gcube/application/Project_Tests.java index 6e2c828..234fb3e 100644 --- a/src/test/java/org/gcube/application/Project_Tests.java +++ b/src/test/java/org/gcube/application/Project_Tests.java @@ -5,8 +5,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.bson.BsonDocument; +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.lifecycle.LifecycleInformation; +import org.gcube.application.geoportal.common.rest.Projects; import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel; import org.gcube.application.geoportalcommon.ProjectDVBuilder; import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller; @@ -14,14 +18,22 @@ import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller; 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.geoportal.project.LifecycleInformationDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.PhaseDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV; import org.gcube.application.geoportalcommon.shared.WhereClause; -import org.gcube.application.geoportalcommon.shared.geoportal.LifecycleInformationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.ProjectDV; +import org.gcube.com.fasterxml.jackson.databind.ObjectMapper; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.scope.api.ScopeProvider; +import org.json.JSONArray; +import org.json.JSONObject; import org.junit.Before; import org.junit.Test; +import com.jayway.jsonpath.DocumentContext; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider; + public class Project_Tests { private ProjectsCaller client = null; @@ -71,7 +83,7 @@ public class Project_Tests { } - @Test + //@Test public void getListProjectsDVFiltered() throws Exception { //List listOfProjects = client.getListForProfileID(PROFILE_ID); @@ -123,4 +135,29 @@ public class Project_Tests { System.out.println(liDV); // } + + //@Test + public void getConfiguration() throws Exception { + Configuration config = client.getConfiguration(PROFILE_ID); + System.out.println(config); + } + + //@Test + public void getTotalDocument() throws Exception { + + System.out.println(client.getTotalDocument(PROFILE_ID)); + } + + //@Test + public void getListPhases() throws Exception { + + List idsPhases = client.getIDsPhases(PROFILE_ID); + System.out.println(idsPhases); + + PhaseDV[] phases = client.getPhases(PROFILE_ID); + for (PhaseDV phaseDV : phases) { + System.out.println(phaseDV); + } + + } } diff --git a/src/test/java/org/gcube/application/UCD_Tests.java b/src/test/java/org/gcube/application/UCD_Tests.java index 2a6d8d9..8b74e08 100644 --- a/src/test/java/org/gcube/application/UCD_Tests.java +++ b/src/test/java/org/gcube/application/UCD_Tests.java @@ -10,11 +10,11 @@ import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel; import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller; import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller; import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.GEOPORTAL_DATA_HANDLER; -import org.gcube.application.geoportalcommon.shared.geoportal.HandlerDeclarationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.UseCaseDescriptorDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.scope.api.ScopeProvider; import org.junit.Before;