use of eu.esdihumboldt.hale.io.wfs.capabilities.WFSOperation in project hale by halestudio.
the class WFSDescribeFeatureWizard method addPages.
@Override
public void addPages() {
super.addPages();
/**
* Page for specifying the WFS capabilities URL.
*/
AbstractWFSCapabilitiesPage<WFSDescribeFeatureConfig> capPage = new AbstractWFSCapabilitiesPage<WFSDescribeFeatureConfig>(this) {
@Override
protected boolean updateConfiguration(WFSDescribeFeatureConfig configuration, URL capabilitiesUrl, WFSCapabilities capabilities) {
if (capabilities != null && capabilities.getDescribeFeatureOp() != null) {
WFSOperation op = capabilities.getDescribeFeatureOp();
configuration.setDescribeFeatureUri(URI.create(op.getHttpGetUrl()));
configuration.setVersion(capabilities.getVersion());
return true;
}
setErrorMessage("Invalid capabilities or WFS does not support DescribeFeatureType KVP");
return false;
}
};
addPage(capPage);
addPage(new AbstractFeatureTypesPage<WFSDescribeFeatureConfig>(this, capPage, "Optionally request schema for specific feature types only") {
@Override
protected void updateState(Set<QName> selected) {
// any selection allowed
setPageComplete(true);
}
@Override
protected boolean updateConfiguration(WFSDescribeFeatureConfig configuration, Set<QName> selected) {
configuration.getTypeNames().clear();
configuration.getTypeNames().addAll(selected);
return true;
}
});
}
use of eu.esdihumboldt.hale.io.wfs.capabilities.WFSOperation in project hale by halestudio.
the class WFSGetFeatureWizard method addPages.
@Override
public void addPages() {
super.addPages();
/**
* Page for specifying the WFS capabilities URL.
*/
AbstractWFSCapabilitiesPage<WFSGetFeatureConfig> capPage = new AbstractWFSCapabilitiesPage<WFSGetFeatureConfig>(this) {
@Override
protected boolean updateConfiguration(WFSGetFeatureConfig configuration, URL capabilitiesUrl, WFSCapabilities capabilities) {
if (capabilities != null && capabilities.getGetFeatureOp() != null) {
WFSOperation op = capabilities.getGetFeatureOp();
configuration.setGetFeatureUri(URI.create(op.getHttpGetUrl()));
configuration.setVersion(capabilities.getVersion());
return true;
}
setErrorMessage("Invalid capabilities or WFS does not support GetFeature KVP");
return false;
}
};
addPage(capPage);
addPage(new AbstractFeatureTypesPage<WFSGetFeatureConfig>(this, capPage, "Please specify the feature types to request") {
private boolean selectAll = false;
@Override
protected void updateState(Set<QName> selected) {
// at least one type must be specified
setPageComplete(!selected.isEmpty());
}
@Override
protected Collection<? extends QName> initialSelection(Set<QName> types) {
// select all by default
if (selectAll) {
return types;
}
return super.initialSelection(types);
}
@Override
protected Set<QName> filterTypes(Set<QName> types) {
// relevant types
if (schemaSpaceID != null) {
SchemaService ss = PlatformUI.getWorkbench().getService(SchemaService.class);
if (ss != null) {
Set<QName> relevantElements = new HashSet<>();
SchemaSpace schemas = ss.getSchemas(schemaSpaceID);
for (TypeDefinition type : schemas.getMappingRelevantTypes()) {
XmlElements elms = type.getConstraint(XmlElements.class);
for (XmlElement elm : elms.getElements()) {
relevantElements.add(elm.getName());
}
}
Set<QName> selection = new HashSet<>(types);
selection.retainAll(relevantElements);
// don't filter if we have no match at all
if (!selection.isEmpty()) {
selectAll = true;
return selection;
}
}
}
selectAll = false;
return super.filterTypes(types);
}
@Override
protected boolean updateConfiguration(WFSGetFeatureConfig configuration, Set<QName> selected) {
configuration.getTypeNames().clear();
configuration.getTypeNames().addAll(selected);
return true;
}
});
// bounding box
addPage(new BBOXPage(this, capPage));
// additional params
addPage(new GetFeatureParamsPage(this));
}
Aggregations