Refactored. Added getListPhases, getConfiguration, getTotalDocument
This commit is contained in:
parent
83f6fb915c
commit
0d2fddce07
|
@ -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.geoportal.config.ItemField;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
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.FilePathDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
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.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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,16 @@ import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
|
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.configuration.Configuration;
|
||||||
import org.gcube.application.geoportal.common.model.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
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.LOGICAL_OP;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||||
import org.gcube.application.geoportalcommon.shared.WhereClause;
|
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.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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
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.BasicDBList;
|
||||||
import com.mongodb.BasicDBObject;
|
import com.mongodb.BasicDBObject;
|
||||||
import com.mongodb.BasicDBObjectBuilder;
|
import com.mongodb.BasicDBObjectBuilder;
|
||||||
|
@ -166,6 +175,95 @@ public class ProjectsCaller {
|
||||||
return 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 PhaseDV[] getPhases(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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query on mongo.
|
* Query on mongo.
|
||||||
*
|
*
|
||||||
|
@ -255,7 +353,7 @@ public class ProjectsCaller {
|
||||||
Map<String, Object> projection = filter.getProjection();
|
Map<String, Object> projection = filter.getProjection();
|
||||||
|
|
||||||
Document projectionDocument = null;
|
Document projectionDocument = null;
|
||||||
if(projection!=null && !projection.isEmpty()) {
|
if (projection != null && !projection.isEmpty()) {
|
||||||
projectionDocument = new Document(projection);
|
projectionDocument = new Document(projection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,10 +410,10 @@ public class ProjectsCaller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(projectionDocument!=null) {
|
if (projectionDocument != null) {
|
||||||
request.setProjection(projectionDocument);
|
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();
|
BasicDBObject bsNotEqualEmpty = new BasicDBObject();
|
||||||
bsNotEqualEmpty.append("$ne", null);
|
bsNotEqualEmpty.append("$ne", null);
|
||||||
|
|
||||||
|
@ -327,7 +425,6 @@ public class ProjectsCaller {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BasicDBObject bsValid_Document = new BasicDBObject();
|
BasicDBObject bsValid_Document = new BasicDBObject();
|
||||||
bsValid_Document.append("$exists", true);
|
bsValid_Document.append("$exists", true);
|
||||||
bsValid_Document.append("$ne", null);
|
bsValid_Document.append("$ne", null);
|
||||||
|
@ -345,7 +442,7 @@ public class ProjectsCaller {
|
||||||
|
|
||||||
LOG.info("Paging offset: " + offsetIndex + ", limit: " + limitIndex);
|
LOG.info("Paging offset: " + offsetIndex + ", limit: " + limitIndex);
|
||||||
LOG.info("Direction: " + sDirection);
|
LOG.info("Direction: " + sDirection);
|
||||||
LOG.info("Projection: "+projectionDocument);
|
LOG.info("Projection: " + projectionDocument);
|
||||||
LOG.info("Order by Fields: " + orderingFields);
|
LOG.info("Order by Fields: " + orderingFields);
|
||||||
LOG.info("Search for conditions: " + filter.getConditions());
|
LOG.info("Search for conditions: " + filter.getConditions());
|
||||||
if (query != null) {
|
if (query != null) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ package org.gcube.application.geoportalcommon.shared;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ProjectDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ResultSetPaginatedData.
|
* The Class ResultSetPaginatedData.
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GeoportalConfigurationID;
|
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 {
|
public class ConfigurationDV<T extends List<? extends GeoportalConfigurationID>> implements Serializable {
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class DocumentDV implements Serializable {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 4978517506036855883L;
|
private static final long serialVersionUID = 4978517506036855883L;
|
||||||
private LinkedHashMap<String, Object> documentAsMap;
|
protected LinkedHashMap<String, Object> documentAsMap;
|
||||||
private String documentAsJSON;
|
private String documentAsJSON;
|
||||||
private ConfigurationDV<?> configuration;
|
private ConfigurationDV<?> configuration;
|
||||||
|
|
||||||
|
|
|
@ -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<String, Object>();
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
package org.gcube.application.geoportalcommon.shared.geoportal;
|
package org.gcube.application.geoportalcommon.shared.geoportal.project;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
|
|
||||||
public class IdentificationReferenceDV extends DocumentDV implements Serializable {
|
public class IdentificationReferenceDV extends DocumentDV implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -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.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
|
|
||||||
public class ProjectDV implements Serializable {
|
public class ProjectDV implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -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.io.Serializable;
|
||||||
|
|
|
@ -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.
|
* The Class TemporalReferenceDV.
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.application.geoportalcommon.shared.geoportal;
|
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
|
||||||
|
|
||||||
public enum GEOPORTAL_CONFIGURATION_TYPE {
|
public enum GEOPORTAL_CONFIGURATION_TYPE {
|
||||||
item_fields("itemFields"), gcube_profiles("gcubeProfiles");
|
item_fields("itemFields"), gcube_profiles("gcubeProfiles");
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.application.geoportalcommon.shared.geoportal;
|
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
|
||||||
|
|
||||||
public enum GEOPORTAL_DATA_HANDLER {
|
public enum GEOPORTAL_DATA_HANDLER {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package org.gcube.application.geoportalcommon.shared.geoportal;
|
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class HandlerDeclarationDV.
|
* The Class HandlerDeclarationDV.
|
||||||
*
|
*
|
|
@ -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.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -12,8 +12,8 @@ import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDec
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.config.GcubeProfile;
|
import org.gcube.application.geoportalcommon.geoportal.config.GcubeProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
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.config.GcubeProfileDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
|
@ -5,8 +5,12 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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.Project;
|
||||||
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
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.ConvertToDataValueObjectModel;
|
||||||
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
|
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
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.ResultSetPaginatedData;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
|
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.WhereClause;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.LifecycleInformationDV;
|
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ProjectDV;
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
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 {
|
public class Project_Tests {
|
||||||
|
|
||||||
private ProjectsCaller client = null;
|
private ProjectsCaller client = null;
|
||||||
|
@ -71,7 +83,7 @@ public class Project_Tests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void getListProjectsDVFiltered() throws Exception {
|
public void getListProjectsDVFiltered() throws Exception {
|
||||||
//List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID);
|
//List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID);
|
||||||
|
|
||||||
|
@ -123,4 +135,29 @@ public class Project_Tests {
|
||||||
System.out.println(liDV);
|
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<String> idsPhases = client.getIDsPhases(PROFILE_ID);
|
||||||
|
System.out.println(idsPhases);
|
||||||
|
|
||||||
|
PhaseDV[] phases = client.getPhases(PROFILE_ID);
|
||||||
|
for (PhaseDV phaseDV : phases) {
|
||||||
|
System.out.println(phaseDV);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,11 @@ import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
|
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
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.GcubeProfileDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
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.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
Loading…
Reference in New Issue