Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,36 @@ public boolean publishDBLayer(final String workspace, final String storename,

return published && configured;
}

public boolean updateDBLayer(final String workspace, final String storename,final GSFeatureTypeEncoder fte){
/*
* This is the equivalent call with cUrl:
*
* {@code curl -u admin:geoserver -XPUT -H 'Content-type: text/xml' \ -d
* "<featureType><name>easia_gaul_1_aggr</name><nativeCRS>EPSG:4326</nativeCRS><enabled>true</enabled></featureType>" \
* http://localhost:8080/geoserver/rest/workspaces/it.geosolutions/ datastores/pg_kids/featuretypes/easia_gaul_1_aggr }
*
*/

String ftypeXml = fte.toString();
String layername = fte.getName();
StringBuilder putUrl = new StringBuilder(restURL)
.append("/rest/workspaces/").append(workspace)
.append("/datastores/").append(storename)
.append("/featuretypes").append("/"+layername);

if (layername == null || layername.isEmpty()) {
if (LOGGER.isErrorEnabled())
LOGGER.error("GSFeatureTypeEncoder has no valid name associated, try using GSFeatureTypeEncoder.setName(String)");
return false;
}

String configuredResult = HTTPUtils.putXml(putUrl.toString(), ftypeXml, this.gsuser,this.gspass);
boolean published = configuredResult != null;

return published;
}


// ==========================================================================
// === SHAPEFILES
Expand Down