public ClientMapInfo securityClone(ClientMapInfo original) {
// the data is explicitly copied as this assures the security is considered when copying.
if (null == original) {
return null;
}
ClientMapInfo client = new ClientMapInfo();
client.setBackgroundColor(original.getBackgroundColor());
client.setCrs(original.getCrs());
client.setDisplayUnitType(original.getDisplayUnitType());
client.setId(original.getId());
client.setInitialBounds(original.getInitialBounds());
client.setPreferredPixelsPerTile(original.getPreferredPixelsPerTile());
List<ClientLayerInfo> layers = new ArrayList<ClientLayerInfo>();
client.setLayers(layers);
for (ClientLayerInfo layer : original.getLayers()) {
ClientLayerInfo clientLayer = securityClone(layer);
if (null != clientLayer) {
layers.add(clientLayer);
}
}
client.setLayerTree(securityClone(original.getLayerTree()));
client.setLineSelectStyle(original.getLineSelectStyle());
client.setMaxBounds(original.getMaxBounds());
client.setScaleConfiguration(original.getScaleConfiguration());
client.setPanButtonsEnabled(original.isPanButtonsEnabled());
client.setPixelLength(original.getPixelLength());
client.setPointSelectStyle(original.getPointSelectStyle());
client.setPolygonSelectStyle(original.getPolygonSelectStyle());
client.setPrecision(original.getPrecision());
client.setScaleBarEnabled(original.isScaleBarEnabled());
client.setToolbar(securityClone(original.getToolbar()));
client.setUnitLength(original.getUnitLength());
client.setUserData(original.getUserData());
client.setWidgetInfo(original.getWidgetInfo());
return client;
}