Collection information parsing
This commit is contained in:
parent
a07befcc1d
commit
0933ed0d46
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||
|
||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
|
||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -12,9 +13,15 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
||||
import org.gcube.application.geoportal.common.model.configuration.Index;
|
||||
import org.gcube.application.geoportal.common.model.document.Project;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||
import org.gcube.application.geoportal.common.rest.Projects;
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||
|
@ -26,16 +33,19 @@ import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
|||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.faults.InvalidObjectException;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.ConcessioniMongoServiceIdentityProxy;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.DVConversion;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||
|
@ -732,7 +742,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
// // setting identity as D4S User or KC client
|
||||
// new ConcessioniMongoServiceIdentityProxy(this.getThreadLocalRequest());
|
||||
// SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||
// MongoServiceCommon serviceCommon = new MongoServiceCommon();
|
||||
// MongoServiceCommon serviceCommon = new MongoServiceCommon();
|
||||
// // TODO MUST BE REPLACED BY COUNT
|
||||
// List<Concessione> listOfConcessioni = SessionUtil.getListOfConcessioni(getThreadLocalRequest(),
|
||||
// reloadFromService);
|
||||
|
@ -763,6 +773,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
@Override
|
||||
protected ViewerConfiguration run() throws Exception, ControlledError {
|
||||
try {
|
||||
|
||||
// ************* LOAD BASE LAYERS
|
||||
|
||||
final ViewerConfiguration config = new ViewerConfiguration();
|
||||
LOG.info("Getting initial configuration ");
|
||||
LOG.debug("Loading base layers..");
|
||||
|
@ -772,17 +785,66 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
config.setBaseLayers(listBL);
|
||||
|
||||
|
||||
|
||||
|
||||
// ************** LOAD AVAILABLE COLLECTIONS
|
||||
|
||||
LOG.debug("Loading available collections.. ");
|
||||
config.setAvailableCollections(new ArrayList<GCubeCollection>());
|
||||
|
||||
// TODO filter by
|
||||
// configured ?
|
||||
// gis indexed
|
||||
QueryRequest request = new QueryRequest();
|
||||
|
||||
// TODO Constant
|
||||
String Id="org.gcube.portlets.user.geoportaldataviewer";
|
||||
request.setFilter(Document.parse("{\""+UseCaseDescriptor.HANDLERS+"."+
|
||||
org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration.ID+"\" : "
|
||||
+ "{\"$eq\" : \""+Id+"\"}}"));
|
||||
|
||||
|
||||
|
||||
useCaseDescriptors().build().query(new QueryRequest()).forEachRemaining(u->{
|
||||
try{
|
||||
LOG.debug("Checking configuration for collection "+u.getId());
|
||||
|
||||
Projects<Project> p=projects(u.getId()).build();
|
||||
UseCaseDescriptorDV ucd = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(u, null);
|
||||
Configuration ucdConfig = p.getConfiguration();
|
||||
GCubeCollection coll=new GCubeCollection();
|
||||
coll.setUcd(ucd);
|
||||
config.getAvailableCollections().add(coll);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO TO Check index flag should be in configuration or evaluated according to user credentials
|
||||
|
||||
String toCheckFlag = "internal";
|
||||
|
||||
// TODO constant
|
||||
coll.setIndexes(new ArrayList());
|
||||
|
||||
LOG.debug("Checking if "+u.getId()+" is GIS Indexed. Index flag needed is "+toCheckFlag);
|
||||
|
||||
for(Index index : ucdConfig.getIndexes()) {
|
||||
try {
|
||||
IndexLayer toAdd = DVConversion.convert(index);
|
||||
if(toAdd.getFlag().equals(toCheckFlag))
|
||||
coll.getIndexes().add(toAdd);
|
||||
}catch(InvalidObjectException e) {
|
||||
LOG.debug("Skipping invalid index ",e);
|
||||
}catch(Throwable t) {
|
||||
LOG.error("Unable to check index ",t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return only if gis indexed
|
||||
if(coll.getIndexes().isEmpty())
|
||||
LOG.info("No available GIS Index for collection "+coll.getUcd().getName());
|
||||
else config.getAvailableCollections().add(coll);
|
||||
|
||||
}catch(Throwable t) {
|
||||
LOG.warn("Invalid UCD, can't translate to DV. UCID : "+u.getId(),t);
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.server.faults;
|
||||
|
||||
public class InvalidObjectException extends Exception {
|
||||
|
||||
public InvalidObjectException() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidObjectException(String message) {
|
||||
super(message);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidObjectException(Throwable cause) {
|
||||
super(cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidObjectException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidObjectException(String message, Throwable cause, boolean enableSuppression,
|
||||
boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||
|
||||
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||
import org.gcube.application.geoportal.common.model.configuration.Index;
|
||||
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.faults.InvalidObjectException;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||
|
||||
public class DVConversion {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {
|
||||
"_type": "GIS-CENTROIDS",
|
||||
"layer": {
|
||||
"_type": "gcube-sdi-layer",
|
||||
"_platformInfo": [
|
||||
{
|
||||
"_type": "Geoserver",
|
||||
"workspace": "profiledconcessioni_devvre",
|
||||
"storeName": "profiledconcessioni_devvre_centroids",
|
||||
"_host": "geoserver-218.dev.d4science.org"
|
||||
}
|
||||
],
|
||||
"_bbox": {
|
||||
"_maxX": 180.0,
|
||||
"_minX": -180.0,
|
||||
"_maxY": 90.0,
|
||||
"_minY": -90.0
|
||||
},
|
||||
"_ogcLinks": {
|
||||
"wms": {
|
||||
"wms": "https://geoserver-218.dev.d4science.org/geoserver/profiledconcessioni_devvre/wms?service=WMS&version=1.1.0&request=GetMap&layers=profiledconcessioni_devvre:null&styles=&bbox=-180.000000,-90.000000,180.000000,90.000000&srs=EPSG:4326&format=application/openlayers&width=400&height=400"
|
||||
}
|
||||
}
|
||||
},
|
||||
"indexName": "profiledconcessioni_devvre_centroids",
|
||||
"records": 4,
|
||||
"crossReferencedLayers": {},
|
||||
"flag": "public"
|
||||
}
|
||||
* @throws InvalidObjectException
|
||||
*
|
||||
*/
|
||||
|
||||
public static IndexLayer convert(Index toConvert) throws InvalidObjectException {
|
||||
IndexLayer toReturn = null;
|
||||
|
||||
|
||||
switch(toConvert.getType()) {
|
||||
case "GIS-CENTROIDS" : {
|
||||
toReturn = Serialization.convert(toConvert,IndexLayer.class);
|
||||
// toReturn.setLayer(Serialization.read(toConvert.get("layer"), GCubeSDILayer.class));
|
||||
// toReturn.setFlag(toConvert.getString("flag"));
|
||||
// toReturn.setIndexName(toConvert.getString());
|
||||
break;
|
||||
|
||||
}
|
||||
default:{
|
||||
throw new InvalidObjectException("Unable to convert Index. Unknown type : "+toConvert.getType());
|
||||
}
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document;
|
||||
|
||||
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.accouting.AccountingInfo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
public class Lock {
|
||||
|
||||
public static final String ID="_id";
|
||||
public static final String INFO="_info";
|
||||
public static final String OPERATION="_operation";
|
||||
|
||||
@JsonProperty(INFO)
|
||||
private AccountingInfo info;
|
||||
@JsonProperty(ID)
|
||||
private String id;
|
||||
@JsonProperty(OPERATION)
|
||||
private String operation;
|
||||
public AccountingInfo getInfo() {
|
||||
return info;
|
||||
}
|
||||
public void setInfo(AccountingInfo info) {
|
||||
this.info = info;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getOperation() {
|
||||
return operation;
|
||||
}
|
||||
public void setOperation(String operation) {
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,203 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.accouting.PublicationInfo;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.identification.IdentificationReference;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.lifecycle.LifecycleInformation;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.relationships.Relationship;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
|
||||
public class Project {
|
||||
|
||||
public static final String ID="_id";
|
||||
public static final String VERSION="_version";
|
||||
public static final String INFO="_info";
|
||||
public static final String PROFILE_ID="_profileID";
|
||||
public static final String PROFILE_VERSION="_profileVersion";
|
||||
public static final String LIFECYCLE_INFORMATION="_lifecycleInformation";
|
||||
public static final String RELATIONSHIPS="_relationships";
|
||||
public static final String IDENTIFICATION_REFERENCES="_identificationReferences";
|
||||
public static final String THE_DOCUMENT="_theDocument";
|
||||
public static final String LOCK="_lock";
|
||||
|
||||
// CORE METADATA
|
||||
|
||||
@JsonProperty(ID)
|
||||
private String id;
|
||||
@JsonProperty(VERSION)
|
||||
private String version;
|
||||
|
||||
// Publication Info
|
||||
@JsonProperty(INFO)
|
||||
private PublicationInfo info;
|
||||
|
||||
// UseCaseDescriptor reference
|
||||
@JsonProperty(PROFILE_ID)
|
||||
private String profileID;
|
||||
@JsonProperty(PROFILE_VERSION)
|
||||
private String profileVersion;
|
||||
|
||||
@JsonProperty(LIFECYCLE_INFORMATION)
|
||||
private LifecycleInformation lifecycleInformation;
|
||||
|
||||
@JsonProperty(RELATIONSHIPS)
|
||||
private List<Relationship> relationships;
|
||||
|
||||
@JsonProperty(IDENTIFICATION_REFERENCES)
|
||||
private List<IdentificationReference> identificationReferences;
|
||||
|
||||
@JsonProperty(THE_DOCUMENT)
|
||||
private Object theDocument;
|
||||
|
||||
@JsonProperty(LOCK)
|
||||
private Lock lock;
|
||||
|
||||
|
||||
/**
|
||||
* Similar to equals but without checking following fields
|
||||
*
|
||||
* lock
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
public boolean isEquivalent(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof Project)) return false;
|
||||
Project project = (Project) o;
|
||||
return Objects.equals(getId(), project.getId()) && Objects.equals(getVersion(), project.getVersion()) && Objects.equals(getInfo(), project.getInfo()) && Objects.equals(getProfileID(), project.getProfileID()) && Objects.equals(getProfileVersion(), project.getProfileVersion()) && Objects.equals(getLifecycleInformation(), project.getLifecycleInformation()) && Objects.equals(getIdentificationReferences(), project.getIdentificationReferences()) && Objects.equals(getRelationships(), project.getRelationships()) && Objects.equals(getTheDocument(), project.getTheDocument());
|
||||
}
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
public List<IdentificationReference> getIdentificationReferenceByType(String type){
|
||||
if(identificationReferences==null) return Collections.emptyList();
|
||||
else return identificationReferences.stream()
|
||||
.filter(item -> item.getType().equals(type)).collect(Collectors.toList());
|
||||
};
|
||||
|
||||
@JsonIgnore
|
||||
public List<Relationship> getRelationshipsByName(String relation){
|
||||
if(relationships==null)return Collections.emptyList();
|
||||
else return relationships.stream().filter(relationship -> relationship.
|
||||
getRelationshipName().equals(relation)).collect(Collectors.toList());
|
||||
};
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
public Project addRelation(Relationship rel){
|
||||
if(relationships==null) relationships = new ArrayList<>();
|
||||
relationships.add(rel);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
public PublicationInfo getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
public void setInfo(PublicationInfo info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
|
||||
public void setProfileID(String profileID) {
|
||||
this.profileID = profileID;
|
||||
}
|
||||
|
||||
|
||||
public String getProfileVersion() {
|
||||
return profileVersion;
|
||||
}
|
||||
|
||||
|
||||
public void setProfileVersion(String profileVersion) {
|
||||
this.profileVersion = profileVersion;
|
||||
}
|
||||
|
||||
|
||||
public LifecycleInformation getLifecycleInformation() {
|
||||
return lifecycleInformation;
|
||||
}
|
||||
|
||||
|
||||
public void setLifecycleInformation(LifecycleInformation lifecycleInformation) {
|
||||
this.lifecycleInformation = lifecycleInformation;
|
||||
}
|
||||
|
||||
|
||||
public List<Relationship> getRelationships() {
|
||||
return relationships;
|
||||
}
|
||||
|
||||
|
||||
public void setRelationships(List<Relationship> relationships) {
|
||||
this.relationships = relationships;
|
||||
}
|
||||
|
||||
|
||||
public List<IdentificationReference> getIdentificationReferences() {
|
||||
return identificationReferences;
|
||||
}
|
||||
|
||||
|
||||
public void setIdentificationReferences(List<IdentificationReference> identificationReferences) {
|
||||
this.identificationReferences = identificationReferences;
|
||||
}
|
||||
|
||||
|
||||
public Object getTheDocument() {
|
||||
return theDocument;
|
||||
}
|
||||
|
||||
|
||||
public void setTheDocument(Object theDocument) {
|
||||
this.theDocument = theDocument;
|
||||
}
|
||||
|
||||
|
||||
public Lock getLock() {
|
||||
return lock;
|
||||
}
|
||||
|
||||
|
||||
public void setLock(Lock lock) {
|
||||
this.lock = lock;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.access;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
public class Access {
|
||||
|
||||
public static final String POLICY="_policy";
|
||||
public static final String LICENSE="_license";
|
||||
|
||||
@JsonProperty(POLICY)
|
||||
private AccessPolicy policy;
|
||||
@JsonProperty(LICENSE)
|
||||
private String license;
|
||||
public AccessPolicy getPolicy() {
|
||||
return policy;
|
||||
}
|
||||
public void setPolicy(AccessPolicy policy) {
|
||||
this.policy = policy;
|
||||
}
|
||||
public String getLicense() {
|
||||
return license;
|
||||
}
|
||||
public void setLicense(String license) {
|
||||
this.license = license;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.access;
|
||||
|
||||
public enum AccessPolicy {
|
||||
|
||||
OPEN,RESTRICTED,EMBARGOED;
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.accouting;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
public class AccountingInfo {
|
||||
|
||||
public static final String USER="_user";
|
||||
public static final String CONTEXT="_context";
|
||||
public static final String INSTANT="_instant";
|
||||
|
||||
@JsonProperty(USER)
|
||||
private User user;
|
||||
@JsonProperty(CONTEXT)
|
||||
private Context context;
|
||||
@JsonProperty(INSTANT)
|
||||
private String instant;
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
public String getInstant() {
|
||||
return instant;
|
||||
}
|
||||
public void setInstant(String instant) {
|
||||
this.instant = instant;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.accouting;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
public class Context {
|
||||
public static final String ID="_id";
|
||||
public static final String NAME = "_name";
|
||||
|
||||
@JsonProperty(ID)
|
||||
private String id;
|
||||
@JsonProperty(NAME)
|
||||
private String name;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.accouting;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.access.Access;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
public class PublicationInfo {
|
||||
|
||||
public static final String CREATION_INFO="_creationInfo";
|
||||
public static final String LAST_EDIT_INFO="_lastEditInfo";
|
||||
public static final String ACCESS = "_access";
|
||||
|
||||
@JsonProperty(CREATION_INFO)
|
||||
private AccountingInfo creationInfo;
|
||||
@JsonProperty(LAST_EDIT_INFO)
|
||||
private AccountingInfo lastEditInfo;
|
||||
@JsonProperty(ACCESS)
|
||||
private Access access;
|
||||
public AccountingInfo getCreationInfo() {
|
||||
return creationInfo;
|
||||
}
|
||||
public void setCreationInfo(AccountingInfo creationInfo) {
|
||||
this.creationInfo = creationInfo;
|
||||
}
|
||||
public AccountingInfo getLastEditInfo() {
|
||||
return lastEditInfo;
|
||||
}
|
||||
public void setLastEditInfo(AccountingInfo lastEditInfo) {
|
||||
this.lastEditInfo = lastEditInfo;
|
||||
}
|
||||
public Access getAccess() {
|
||||
return access;
|
||||
}
|
||||
public void setAccess(Access access) {
|
||||
this.access = access;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.accouting;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class User {
|
||||
|
||||
public static final String USERNAME="_username";
|
||||
|
||||
@JsonProperty(USERNAME)
|
||||
private String username;
|
||||
|
||||
@JsonIgnore
|
||||
private Set<String> roles;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof User)) return false;
|
||||
User user = (User) o;
|
||||
return Objects.equals(getUsername(), user.getUsername());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getUsername());
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public Set<String> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(Set<String> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.identification;
|
||||
|
||||
public class CentroidRecordReference extends IdentificationReference{
|
||||
|
||||
public static final String CENTROID_RECORD_REFERENCE="CENTROID_RECORD_TYPE";
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.identification;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
import com.google.gwt.json.client.JSONString;
|
||||
|
||||
|
||||
public class IdentificationReference extends JSONObject {
|
||||
|
||||
public static final String TYPE="_type";
|
||||
|
||||
public IdentificationReference(String type) {
|
||||
setType(type);
|
||||
}
|
||||
|
||||
public IdentificationReference() {}
|
||||
|
||||
@JsonIgnore
|
||||
public String getType(){return super.get(TYPE).toString();}
|
||||
@JsonIgnore
|
||||
public void setType(String type){super.put(TYPE, new JSONString(type));}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.identification;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
|
||||
public class SpatialReference extends IdentificationReference{
|
||||
|
||||
public static final String SPATIAL_REFERENCE_TYPE="SPATIAL REFERENCE";
|
||||
public static final String GEO_JSON="geoJSON";
|
||||
|
||||
|
||||
public SpatialReference(Object geoJSON) {
|
||||
// setGeoJson(geoJSON);
|
||||
setType(SPATIAL_REFERENCE_TYPE);
|
||||
}
|
||||
|
||||
public SpatialReference() {}
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
public Object getGeoJson(){return super.get(GEO_JSON);}
|
||||
// @JsonIgnore
|
||||
// public Object setGeoJson(Object geoJSON){return super.put(GEO_JSON,JSONObject.geoJSON);}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.identification;
|
||||
|
||||
public class TemporalReference extends IdentificationReference {
|
||||
|
||||
public static final String TEMPORAL_REFERENCE_TYPE="TEMPORAL_REFERENCE_TYPE";
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.lifecycle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class LifecycleInformation {
|
||||
|
||||
public static final class CommonPhases{
|
||||
public static final String DRAFT_PHASE="DRAFT";
|
||||
}
|
||||
|
||||
//COMMON PHASES
|
||||
|
||||
|
||||
public static final String PHASE="_phase";
|
||||
public static final String LAST_INVOKED_STEP="_lastInvokedStep";
|
||||
public static final String LAST_OPERATION_STATUS="_lastOperationStatus";
|
||||
public static final String ERROR_MESSAGES="_errorMessages";
|
||||
public static final String WARNING_MESSAGES="_warningMessages";
|
||||
public static final String TRIGGERED_EVENTS="_triggeredEvents";
|
||||
public static final String NOTES="_notes";
|
||||
|
||||
public static enum Status{
|
||||
OK,ERROR,WARNING
|
||||
}
|
||||
|
||||
@JsonProperty(PHASE)
|
||||
private String phase;
|
||||
@JsonProperty(LAST_INVOKED_STEP)
|
||||
private String lastInvokedStep;
|
||||
@JsonProperty(LAST_OPERATION_STATUS)
|
||||
private Status lastOperationStatus;
|
||||
@JsonProperty(ERROR_MESSAGES)
|
||||
private List<String> errorMessages;
|
||||
@JsonProperty(WARNING_MESSAGES)
|
||||
private List<String> warningMessages;
|
||||
@JsonProperty(TRIGGERED_EVENTS)
|
||||
private List<TriggeredEvents> triggeredEvents;
|
||||
@JsonProperty(NOTES)
|
||||
private String notes;
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
public TriggeredEvents getLastEvent(){
|
||||
if(triggeredEvents==null || triggeredEvents.isEmpty()) return null;
|
||||
return triggeredEvents.get(triggeredEvents.size()-1);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public LifecycleInformation addErrorMessage(String msg){
|
||||
if(errorMessages==null)
|
||||
errorMessages=new ArrayList<>();
|
||||
errorMessages.add(msg);
|
||||
return this;
|
||||
}
|
||||
@JsonIgnore
|
||||
public LifecycleInformation addWarningMessage(String msg){
|
||||
if(warningMessages==null)
|
||||
warningMessages=new ArrayList<>();
|
||||
warningMessages.add(msg);
|
||||
return this;
|
||||
}
|
||||
@JsonIgnore
|
||||
public LifecycleInformation addEventReport(TriggeredEvents info){
|
||||
if(triggeredEvents==null) triggeredEvents=new ArrayList<>();
|
||||
triggeredEvents.add(info);
|
||||
return this;
|
||||
}
|
||||
@JsonIgnore
|
||||
public LifecycleInformation cleanState(){
|
||||
setLastOperationStatus(null);
|
||||
setLastInvokedStep(null);
|
||||
setTriggeredEvents(new ArrayList<>());
|
||||
setErrorMessages(new ArrayList<>());
|
||||
setWarningMessages(new ArrayList<>());
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPhase() {
|
||||
return phase;
|
||||
}
|
||||
|
||||
public void setPhase(String phase) {
|
||||
this.phase = phase;
|
||||
}
|
||||
|
||||
public String getLastInvokedStep() {
|
||||
return lastInvokedStep;
|
||||
}
|
||||
|
||||
public void setLastInvokedStep(String lastInvokedStep) {
|
||||
this.lastInvokedStep = lastInvokedStep;
|
||||
}
|
||||
|
||||
public Status getLastOperationStatus() {
|
||||
return lastOperationStatus;
|
||||
}
|
||||
|
||||
public void setLastOperationStatus(Status lastOperationStatus) {
|
||||
this.lastOperationStatus = lastOperationStatus;
|
||||
}
|
||||
|
||||
public List<String> getErrorMessages() {
|
||||
return errorMessages;
|
||||
}
|
||||
|
||||
public void setErrorMessages(List<String> errorMessages) {
|
||||
this.errorMessages = errorMessages;
|
||||
}
|
||||
|
||||
public List<String> getWarningMessages() {
|
||||
return warningMessages;
|
||||
}
|
||||
|
||||
public void setWarningMessages(List<String> warningMessages) {
|
||||
this.warningMessages = warningMessages;
|
||||
}
|
||||
|
||||
public List<TriggeredEvents> getTriggeredEvents() {
|
||||
return triggeredEvents;
|
||||
}
|
||||
|
||||
public void setTriggeredEvents(List<TriggeredEvents> triggeredEvents) {
|
||||
this.triggeredEvents = triggeredEvents;
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.lifecycle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TriggeredEvents {
|
||||
|
||||
public static final String PHASE="_phase";
|
||||
public static final String LAST_INVOKED_STEP="_lastInvokedStep";
|
||||
public static final String LAST_OPERATION_STATUS="_lastOperationStatus";
|
||||
public static final String ERROR_MESSAGES="_errorMessages";
|
||||
public static final String WARNING_MESSAGES="_warningMessages";
|
||||
public static final String TRIGGERED_EVENTS="_triggeredEvents";
|
||||
|
||||
private String event;
|
||||
private LifecycleInformation.Status lastOperationStatus;
|
||||
private List<String> errorMessages;
|
||||
private List<String> warningMessages;
|
||||
|
||||
public void addErrorMessage(String msg){
|
||||
if(errorMessages==null)
|
||||
errorMessages=new ArrayList<>();
|
||||
errorMessages.add(msg);
|
||||
}
|
||||
public void addWarningMessage(String msg){
|
||||
if(warningMessages==null)
|
||||
warningMessages=new ArrayList<>();
|
||||
warningMessages.add(msg);
|
||||
}
|
||||
public String getEvent() {
|
||||
return event;
|
||||
}
|
||||
public void setEvent(String event) {
|
||||
this.event = event;
|
||||
}
|
||||
public LifecycleInformation.Status getLastOperationStatus() {
|
||||
return lastOperationStatus;
|
||||
}
|
||||
public void setLastOperationStatus(LifecycleInformation.Status lastOperationStatus) {
|
||||
this.lastOperationStatus = lastOperationStatus;
|
||||
}
|
||||
public List<String> getErrorMessages() {
|
||||
return errorMessages;
|
||||
}
|
||||
public void setErrorMessages(List<String> errorMessages) {
|
||||
this.errorMessages = errorMessages;
|
||||
}
|
||||
public List<String> getWarningMessages() {
|
||||
return warningMessages;
|
||||
}
|
||||
public void setWarningMessages(List<String> warningMessages) {
|
||||
this.warningMessages = warningMessages;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class BBOXDV extends HashMap<String,Double>{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -160255589938251081L;
|
||||
|
||||
public BBOXDV() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
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()};
|
||||
}
|
||||
|
||||
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 static final BBOXDV WORLD=new BBOXDV(180d,-180d,90d,-90d);
|
||||
|
||||
public static final BBOXDV WORLD_3D=new BBOXDV(180d,-180d,90d,-90d);
|
||||
|
||||
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 BBOXDV(Double maxX,Double minX,Double maxY,Double minY,Double maxZ,Double minZ){
|
||||
this(maxX,minX,maxY,minY);
|
||||
setMaxZ(maxZ);
|
||||
setMinZ(minZ);
|
||||
}
|
||||
public BBOXDV(Double maxX,Double minX,Double maxY,Double minY){
|
||||
setMaxX(maxX);
|
||||
setMinX(minX);
|
||||
setMaxY(maxY);
|
||||
setMinY(minY);
|
||||
}
|
||||
|
||||
|
||||
public BBOXDV setMaxX(Double d){this.put(MAX_X,d);return this;}
|
||||
|
||||
public BBOXDV setMaxY(Double d){this.put(MAX_Y,d);return this;}
|
||||
|
||||
public BBOXDV setMaxZ(Double d){this.put(MAX_Z,d);return this;}
|
||||
|
||||
public BBOXDV setMinX(Double d){this.put(MIN_X,d);return this;}
|
||||
|
||||
public BBOXDV setMinY(Double d){this.put(MIN_Y,d);return this;}
|
||||
|
||||
public BBOXDV setMinZ(Double d){this.put(MIN_Z,d);return this;}
|
||||
|
||||
public Double getMinY(){return (Double) this.getOrDefault(MIN_Y,-90d);}
|
||||
|
||||
public Double getMaxY(){return (Double) this.getOrDefault(MAX_Y,90d);}
|
||||
|
||||
public Double getMinX(){return (Double) this.getOrDefault(MIN_X,-180d);}
|
||||
|
||||
public Double getMaxX(){return (Double) this.getOrDefault(MAX_X,180d);}
|
||||
|
||||
public Double getMinZ(){return (Double) this.getOrDefault(MIN_Z,null);}
|
||||
|
||||
public Double getMaxZ(){return (Double) this.getOrDefault(MAX_Z,null);}
|
||||
|
||||
|
||||
public Boolean is3d(){
|
||||
return getMinZ()!=null && getMaxZ() !=null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class GCubeSDILayerDV {
|
||||
|
||||
|
||||
|
||||
// TODO manage heterogeneus collection
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class GeoServerPlatformInfoDV {
|
||||
|
||||
@JsonProperty(value = "_type")
|
||||
private String type;
|
||||
private String workspace;
|
||||
private String storeName;
|
||||
|
||||
@JsonProperty(value = "_host")
|
||||
private String host;
|
||||
|
||||
private Map<String,String> ogcLinks;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.relationships;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
public class Relationship {
|
||||
|
||||
public static final String RELATIONSHIP_NAME="_relationshipName";
|
||||
public static final String TARGET_ID="_targetID";
|
||||
public static final String TARGET_UCD="_targetUCD";
|
||||
|
||||
@JsonProperty(RELATIONSHIP_NAME)
|
||||
private String relationshipName;
|
||||
@JsonProperty(TARGET_ID)
|
||||
private String targetID;
|
||||
@JsonProperty(TARGET_UCD)
|
||||
private String targetUCD;
|
||||
public String getRelationshipName() {
|
||||
return relationshipName;
|
||||
}
|
||||
public void setRelationshipName(String relationshipName) {
|
||||
this.relationshipName = relationshipName;
|
||||
}
|
||||
public String getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
public void setTargetID(String targetID) {
|
||||
this.targetID = targetID;
|
||||
}
|
||||
public String getTargetUCD() {
|
||||
return targetUCD;
|
||||
}
|
||||
public void setTargetUCD(String targetUCD) {
|
||||
this.targetUCD = targetUCD;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.relationships;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.document.Project;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.NonNull;
|
||||
|
||||
|
||||
public class RelationshipNavigationObject {
|
||||
public static final String CHILDREN="_children";
|
||||
public static final String TARGET="_target";
|
||||
|
||||
@JsonProperty(CHILDREN)
|
||||
List<RelationshipNavigationObject> children;
|
||||
|
||||
@NonNull
|
||||
@JsonProperty(TARGET)
|
||||
Project target;
|
||||
|
||||
public List<RelationshipNavigationObject> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<RelationshipNavigationObject> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public Project getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(Project target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.ucd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.Project;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.accouting.User;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
public class DataAccessPolicy {
|
||||
|
||||
public static final String POLICY = "_policy";
|
||||
public static final String ROLES = "_roles";
|
||||
public static final String ENFORCER = "_enforcer";
|
||||
|
||||
public static class PolicyEnforcer {
|
||||
public static final String FILTER="_filter";
|
||||
@JsonProperty(FILTER)
|
||||
private String filter;
|
||||
|
||||
@JsonIgnore
|
||||
public Object getFilterDocument(){
|
||||
if(filter!=null) return filter;
|
||||
else return new Object();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(POLICY)
|
||||
private Policy policy;
|
||||
@JsonProperty(ROLES)
|
||||
private List<String> roles;
|
||||
@JsonProperty(ENFORCER)
|
||||
private PolicyEnforcer enforcer;
|
||||
|
||||
@JsonIgnore
|
||||
public boolean canRead(Project p, User u){
|
||||
switch(getPolicy().getRead()){
|
||||
case own: return p.getInfo().getCreationInfo().getUser().equals(u);
|
||||
case any: return true;
|
||||
case none:
|
||||
default : return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
public boolean canWrite(Project p, User u){
|
||||
switch(getPolicy().getWrite()){
|
||||
case own: return p.getInfo().getCreationInfo().getUser().equals(u);
|
||||
case any: return true;
|
||||
case none:
|
||||
default : return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Policy getPolicy() {
|
||||
return policy;
|
||||
}
|
||||
|
||||
|
||||
public void setPolicy(Policy policy) {
|
||||
this.policy = policy;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
||||
public void setRoles(List<String> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
|
||||
public PolicyEnforcer getEnforcer() {
|
||||
return enforcer;
|
||||
}
|
||||
|
||||
|
||||
public void setEnforcer(PolicyEnforcer enforcer) {
|
||||
this.enforcer = enforcer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.ucd;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
|
||||
public class Field extends JSONObject {
|
||||
|
||||
public static final String TYPE="_type";
|
||||
public static final String CHILDREN="_children";
|
||||
public static final String MAX_CARDINALITY="_max";
|
||||
public static final String MIN_CARDINALITY="_min";
|
||||
public static final String LABEL="_label";
|
||||
|
||||
@JsonIgnore
|
||||
public String getLabel(){
|
||||
return this.get(LABEL).toString();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getType(){
|
||||
return this.get(TYPE).toString();
|
||||
};
|
||||
|
||||
@JsonIgnore
|
||||
public Boolean isLeaf(){
|
||||
JSONArray children = getChildren();
|
||||
return children == null || children.size()==0 || children.get(0)==null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public JSONArray getChildren(){
|
||||
return (JSONArray)this.get(CHILDREN);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Boolean isCollection() {
|
||||
Integer maxCard=this.getMaxCardinality();
|
||||
return (maxCard>1||maxCard<0); // Negative values for unbounded
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Integer getMaxCardinality(){
|
||||
if(this.containsKey(MAX_CARDINALITY))
|
||||
return Integer.parseInt(get(MAX_CARDINALITY).toString());
|
||||
else return 1;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Integer getMinCardinality(){
|
||||
if(this.containsKey(MIN_CARDINALITY))
|
||||
return Integer.parseInt(get(MIN_CARDINALITY).toString());
|
||||
else return 0;
|
||||
}
|
||||
@JsonIgnore
|
||||
public Boolean isMandatory(){
|
||||
return getMinCardinality()==0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.ucd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
class FieldMap extends ArrayList<FieldMap.MapElement> {
|
||||
|
||||
public static class MapElement extends HashMap<String,Field>{
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.ucd;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
|
||||
|
||||
public class HandlerDeclaration {
|
||||
|
||||
public static final String ID="_id";
|
||||
public static final String TYPE="_type";
|
||||
public static final String CONFIGURATION="_configuration";
|
||||
|
||||
@JsonProperty(ID)
|
||||
private String id;
|
||||
@JsonProperty(TYPE)
|
||||
private String type;
|
||||
@JsonProperty(CONFIGURATION)
|
||||
private JSONObject configuration;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
public JSONObject getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
public void setConfiguration(JSONObject configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.ucd;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
public class Policy {
|
||||
public static final String WRITE="_write";
|
||||
public static final String READ="_read";
|
||||
|
||||
public static enum Type{
|
||||
own, none, any
|
||||
}
|
||||
|
||||
@JsonProperty(WRITE)
|
||||
private Policy.Type write;
|
||||
@JsonProperty(READ)
|
||||
private Policy.Type read;
|
||||
|
||||
|
||||
public Policy.Type getWrite() {
|
||||
return write;
|
||||
}
|
||||
public void setWrite(Policy.Type write) {
|
||||
this.write = write;
|
||||
}
|
||||
public Policy.Type getRead() {
|
||||
return read;
|
||||
}
|
||||
public void setRead(Policy.Type read) {
|
||||
this.read = read;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,142 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.ucd;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.accouting.AccountingInfo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class UCD implements Serializable {
|
||||
|
||||
public static final String MONGO_ID="_mongoId";
|
||||
public static final String ID="_id";
|
||||
public static final String VERSION="_version";
|
||||
public static final String NAME="_name";
|
||||
public static final String DESCRIPTION="_description";
|
||||
public static final String CREATION_INFO="_creationInfo";
|
||||
public static final String SCHEMA="_schema";
|
||||
public static final String HANDLERS="_handlers";
|
||||
public static final String DATA_ACCESS_POLICIES="_dataAccessPolicies";
|
||||
|
||||
|
||||
@JsonProperty(MONGO_ID)
|
||||
private String mongoId;
|
||||
|
||||
@JsonProperty(ID)
|
||||
private String id;
|
||||
@JsonProperty(VERSION)
|
||||
private String version;
|
||||
|
||||
@JsonProperty(NAME)
|
||||
private String name;
|
||||
@JsonProperty(DESCRIPTION)
|
||||
private String description;
|
||||
@JsonProperty(CREATION_INFO)
|
||||
private AccountingInfo creationInfo;
|
||||
|
||||
@JsonProperty(SCHEMA)
|
||||
private Field schema;
|
||||
|
||||
@JsonProperty(HANDLERS)
|
||||
private List<HandlerDeclaration> handlers;
|
||||
|
||||
|
||||
@JsonProperty(DATA_ACCESS_POLICIES)
|
||||
private List<DataAccessPolicy> dataAccessPolicies;
|
||||
|
||||
|
||||
public String getMongoId() {
|
||||
return mongoId;
|
||||
}
|
||||
|
||||
|
||||
public void setMongoId(String mongoId) {
|
||||
this.mongoId = mongoId;
|
||||
}
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public AccountingInfo getCreationInfo() {
|
||||
return creationInfo;
|
||||
}
|
||||
|
||||
|
||||
public void setCreationInfo(AccountingInfo creationInfo) {
|
||||
this.creationInfo = creationInfo;
|
||||
}
|
||||
|
||||
|
||||
public Field getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
|
||||
public void setSchema(Field schema) {
|
||||
this.schema = schema;
|
||||
}
|
||||
|
||||
|
||||
public List<HandlerDeclaration> getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
|
||||
public void setHandlers(List<HandlerDeclaration> handlers) {
|
||||
this.handlers = handlers;
|
||||
}
|
||||
|
||||
|
||||
public List<DataAccessPolicy> getDataAccessPolicies() {
|
||||
return dataAccessPolicies;
|
||||
}
|
||||
|
||||
|
||||
public void setDataAccessPolicies(List<DataAccessPolicy> dataAccessPolicies) {
|
||||
this.dataAccessPolicies = dataAccessPolicies;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +1,52 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization.GCubeSDILayerDV;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class IndexLayer {
|
||||
|
||||
|
||||
@JsonProperty(value = "_type")
|
||||
private String type;
|
||||
private GCubeSDILayerDV layer;
|
||||
private String indexName;
|
||||
private int records;
|
||||
private String flag;
|
||||
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
public GCubeSDILayerDV getLayer() {
|
||||
return layer;
|
||||
}
|
||||
public void setLayer(GCubeSDILayerDV 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue