Added WMS Link
This commit is contained in:
parent
f722449403
commit
42baf0633c
|
@ -165,14 +165,15 @@ public class ProjectsCaller {
|
|||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @param relationID the relation ID
|
||||
* @return the relationship chain
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public Iterator<RelationshipNavigationObject> getRelationshipChain(String profileID, String projectID)
|
||||
public Iterator<RelationshipNavigationObject> getRelationshipChain(String profileID, String projectID, String relationID)
|
||||
throws Exception {
|
||||
LOG.info("getRelationshipChain called for profileID: {}, projectID: {}", profileID, projectID);
|
||||
LOG.info("getRelationshipChain called for projectID: {}, relationID: {}", projectID, projectID);
|
||||
Projects<Project> client = (Projects<Project>) getClient(profileID);
|
||||
return client.getRelationshipChain(profileID, projectID);
|
||||
return client.getRelationshipChain(projectID, relationID);
|
||||
|
||||
}
|
||||
|
||||
|
@ -347,7 +348,7 @@ public class ProjectsCaller {
|
|||
*
|
||||
* @param fromProfileID the from profile ID
|
||||
* @param fromProjectID the from project ID
|
||||
* @param relationshipName the relationship name
|
||||
* @param relationshipId the relationship id
|
||||
* @param toProfileID the to profile ID
|
||||
* @param toProjectID the to project ID
|
||||
* @throws RemoteException the remote exception
|
||||
|
@ -389,6 +390,30 @@ public class ProjectsCaller {
|
|||
client.deleteRelation(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple query.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param filter the filter
|
||||
* @return the iterator
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public Iterator<Project> simpleQuery(String profileID, Document filter) throws Exception {
|
||||
LOG.info("simpleQuery called for profileID {} and filter {}", profileID, filter);
|
||||
try {
|
||||
|
||||
Projects<Project> geoportalClient = getClient(profileID);
|
||||
QueryRequest request = new QueryRequest();
|
||||
request.setFilter(filter);
|
||||
return geoportalClient.query(request);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error on performing query: " + filter, e);
|
||||
throw new Exception("Error occurred on performing query " + filter + ". Error: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Query on mongo.
|
||||
*
|
||||
|
|
|
@ -11,6 +11,7 @@ public class GCubeSDIViewerLayerDV implements Serializable {
|
|||
private String type;
|
||||
private BBOXDV bbox;
|
||||
private HashMap<String, String> ogcLinks;
|
||||
private String layerName;
|
||||
|
||||
public GCubeSDIViewerLayerDV() {
|
||||
|
||||
|
@ -28,6 +29,14 @@ public class GCubeSDIViewerLayerDV implements Serializable {
|
|||
return ogcLinks;
|
||||
}
|
||||
|
||||
public String getWMSLink() {
|
||||
if (ogcLinks != null) {
|
||||
return ogcLinks.get("wms");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -40,6 +49,14 @@ public class GCubeSDIViewerLayerDV implements Serializable {
|
|||
this.ogcLinks = ogcLinks;
|
||||
}
|
||||
|
||||
public void setLayerName(String layerName) {
|
||||
this.layerName = layerName;
|
||||
}
|
||||
|
||||
public String getLayerName() {
|
||||
return layerName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
@ -49,6 +66,8 @@ public class GCubeSDIViewerLayerDV implements Serializable {
|
|||
builder.append(bbox);
|
||||
builder.append(", ogcLinks=");
|
||||
builder.append(ogcLinks);
|
||||
builder.append(", layerName=");
|
||||
builder.append(layerName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Map;
|
|||
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.model.document.relationships.Relationship;
|
||||
import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject;
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
|
||||
|
@ -196,27 +197,40 @@ public class Project_Tests {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void getRelationshipsChain() throws Exception {
|
||||
System.out.println("getRelationshipsChain test");
|
||||
Project project = client.getProjectByID(PROFILE_ID, PROJECT_ID);
|
||||
|
||||
Iterator<RelationshipNavigationObject> iterator = client.getRelationshipChain(PROFILE_ID, PROJECT_ID);
|
||||
List<Relationship> relations = project.getRelationships();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
RelationshipNavigationObject nav = (RelationshipNavigationObject) iterator.next();
|
||||
visitRelationshipsChain(nav);
|
||||
for (Relationship relationship : relations) {
|
||||
System.out.println("\n\ngetRelationshipsChain for "+relationship);
|
||||
Iterator<RelationshipNavigationObject> iterator = client.getRelationshipChain(PROFILE_ID, PROJECT_ID,
|
||||
relationship.getRelationshipName());
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
RelationshipNavigationObject nav = (RelationshipNavigationObject) iterator.next();
|
||||
visitRelationshipsChain(nav, relationship.getRelationshipName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void visitRelationshipsChain(RelationshipNavigationObject nav) {
|
||||
|
||||
public void visitRelationshipsChain(RelationshipNavigationObject nav, String relationshipName) {
|
||||
System.out.println("visitRelationshipsChain of target: "+nav.getTarget().getId() +", relationshipName: "+relationshipName+", doc: "+nav.getTarget().getTheDocument());
|
||||
System.out.println("visitRelationshipsChain children "+nav.getChildren());
|
||||
|
||||
if (nav == null)
|
||||
return;
|
||||
|
||||
printObject(nav.getTarget());
|
||||
|
||||
for (RelationshipNavigationObject relationship : nav.getChildren()) {
|
||||
visitRelationshipsChain(relationship);
|
||||
if (nav.getChildren() != null) {
|
||||
|
||||
for (RelationshipNavigationObject relationship : nav.getChildren()) {
|
||||
visitRelationshipsChain(relationship, relationshipName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue