Revert "Revert "Switching to formal XML body construction via GS*Encoder classes. #199""
This reverts commit cd511983c0.
This commit is contained in:
parent
9c5fd05b43
commit
f251419bd1
@ -3264,7 +3264,7 @@ public class GeoServerRESTPublisher {
|
|||||||
* @param enabled
|
* @param enabled
|
||||||
* @return true if recalculation succeeded, false otherwise.
|
* @return true if recalculation succeeded, false otherwise.
|
||||||
*/
|
*/
|
||||||
private boolean recalculateBBox(StoreType type, String xmlElementName, String workspace, String storeName, String layerName, BBoxRecalculationMode calculationMode, boolean enabled){
|
private boolean recalculateBBox(StoreType type, GSResourceEncoder renc, String workspace, String storeName, String layerName, BBoxRecalculationMode calculationMode){
|
||||||
|
|
||||||
String baseUrl = restURL + "/rest/workspaces/" + workspace + "/" +
|
String baseUrl = restURL + "/rest/workspaces/" + workspace + "/" +
|
||||||
type.getType().toLowerCase() +"s/" + storeName + "/" +
|
type.getType().toLowerCase() +"s/" + storeName + "/" +
|
||||||
@ -3274,14 +3274,14 @@ public class GeoServerRESTPublisher {
|
|||||||
String sUrl = baseUrl + "?recalculate=" + calculationMode.getParamValue();
|
String sUrl = baseUrl + "?recalculate=" + calculationMode.getParamValue();
|
||||||
LOGGER.debug("Constructed the following url for bounding box recalculation: " + sUrl);
|
LOGGER.debug("Constructed the following url for bounding box recalculation: " + sUrl);
|
||||||
|
|
||||||
/*
|
|
||||||
* If the 'enabled' element is not specified in the request body, it will be set to 'false' by GeoServer.
|
// String body = wsenc.toString();
|
||||||
* To avoid unintentional disabling of layers, this method and its callers
|
// String body = "<" + xmlElementName +"><name>" + layerName + "</name>" +
|
||||||
* require that users specify whether the layer should be enabled.
|
// "<enabled>" + enabled + "</enabled></" + xmlElementName + ">";
|
||||||
*/
|
renc.remove(GSResourceEncoder.KEYWORDS);
|
||||||
String body = "<" + xmlElementName +"><name>" + layerName + "</name>" +
|
renc.remove(GSResourceEncoder.METADATA);
|
||||||
"<enabled>" + enabled + "</enabled></" + xmlElementName + ">";
|
renc.remove(GSResourceEncoder.METADATALINKS);
|
||||||
|
String body = renc.toString();
|
||||||
String sendResult = HTTPUtils.putXml(sUrl, body, gsuser, gspass);
|
String sendResult = HTTPUtils.putXml(sUrl, body, gsuser, gspass);
|
||||||
boolean success = sendResult != null;
|
boolean success = sendResult != null;
|
||||||
return success;
|
return success;
|
||||||
@ -3297,7 +3297,11 @@ public class GeoServerRESTPublisher {
|
|||||||
* @return true if successful, false otherwise
|
* @return true if successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean recalculateFeatureTypeBBox(String workspace, String storeName, String layerName, BBoxRecalculationMode calculationMode, boolean enabled){
|
public boolean recalculateFeatureTypeBBox(String workspace, String storeName, String layerName, BBoxRecalculationMode calculationMode, boolean enabled){
|
||||||
return recalculateBBox(StoreType.DATASTORES, "featureType", workspace, storeName, layerName, calculationMode, enabled);
|
GSFeatureTypeEncoder fenc = new GSFeatureTypeEncoder();
|
||||||
|
fenc.remove(GSFeatureTypeEncoder.ATTRIBUTES);
|
||||||
|
fenc.setName(layerName);
|
||||||
|
fenc.setEnabled(enabled);
|
||||||
|
return recalculateBBox(StoreType.DATASTORES, fenc, workspace, storeName, layerName, calculationMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3310,6 +3314,10 @@ public class GeoServerRESTPublisher {
|
|||||||
* @return true if successful, false otherwise
|
* @return true if successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean recalculateCoverageBBox(String workspace, String storeName, String layerName, BBoxRecalculationMode calculationMode, boolean enabled){
|
public boolean recalculateCoverageBBox(String workspace, String storeName, String layerName, BBoxRecalculationMode calculationMode, boolean enabled){
|
||||||
return recalculateBBox(StoreType.COVERAGESTORES, "coverage", workspace, storeName, layerName, calculationMode, enabled);
|
GSCoverageEncoder cenc = new GSCoverageEncoder();
|
||||||
|
cenc.remove(GSCoverageEncoder.SUPPORTED_FORMATS);
|
||||||
|
cenc.setName(layerName);
|
||||||
|
cenc.setEnabled(enabled);
|
||||||
|
return recalculateBBox(StoreType.COVERAGESTORES, cenc, workspace, storeName, layerName, calculationMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public class GSCoverageEncoder extends GSResourceEncoder {
|
|||||||
public final static String NATIVECOVERAGENAME = "nativeCoverageName";
|
public final static String NATIVECOVERAGENAME = "nativeCoverageName";
|
||||||
|
|
||||||
private final static String NATIVE_FORMAT="nativeFormat";
|
private final static String NATIVE_FORMAT="nativeFormat";
|
||||||
private final static String SUPPORTED_FORMATS="supportedFormats";
|
public final static String SUPPORTED_FORMATS="supportedFormats";
|
||||||
|
|
||||||
private final static String REQUEST_SRS="requestSRS";
|
private final static String REQUEST_SRS="requestSRS";
|
||||||
private final static String RESPONSE_SRS="responseSRS";
|
private final static String RESPONSE_SRS="responseSRS";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user