private static GeoServerTileLayerInfoImpl load(final MetadataMap metadataMap) { GeoServerTileLayerInfoImpl info = new GeoServerTileLayerInfoImpl(); // whether the config needs to be saved final boolean enabled = metadataMap.get(CONFIG_KEY_ENABLED, Boolean.class).booleanValue(); info.setEnabled(enabled); int gutter = metadataMap.get(CONFIG_KEY_GUTTER, Integer.class).intValue(); info.setGutter(gutter); String gridsets = metadataMap.get(CONFIG_KEY_GRIDSETS, String.class); Set<XMLGridSubset> gridSetIds = unmarshalGridSubsets(gridsets); info.getGridSubsets().addAll(gridSetIds); int metaTilingX = metadataMap.get(CONFIG_KEY_METATILING_X, Integer.class).intValue(); info.setMetaTilingX(metaTilingX); int metaTilingY = metadataMap.get(CONFIG_KEY_METATILING_Y, Integer.class).intValue(); info.setMetaTilingY(metaTilingY); if (metadataMap.containsKey(CONFIG_KEY_FORMATS)) { String mimeFormatsStr = metadataMap.get(CONFIG_KEY_FORMATS, String.class); Set<String> mimeFormats = unmarshalSet(mimeFormatsStr); info.getMimeFormats().addAll(mimeFormats); } if (metadataMap.containsKey(CONFIG_KEY_AUTO_CACHE_STYLES)) { boolean autoCacheStyles = metadataMap.get(CONFIG_KEY_AUTO_CACHE_STYLES, Boolean.class) .booleanValue(); info.setAutoCacheStyles(autoCacheStyles); } return info; }
private static GeoServerTileLayerInfoImpl load(final MetadataMap metadataMap) { GeoServerTileLayerInfoImpl info = new GeoServerTileLayerInfoImpl(); // whether the config needs to be saved final boolean enabled = metadataMap.get(CONFIG_KEY_ENABLED, Boolean.class).booleanValue(); info.setEnabled(enabled); int gutter = metadataMap.get(CONFIG_KEY_GUTTER, Integer.class).intValue(); info.setGutter(gutter); String gridsets = metadataMap.get(CONFIG_KEY_GRIDSETS, String.class); Set<XMLGridSubset> gridSetIds = unmarshalGridSubsets(gridsets); info.getGridSubsets().addAll(gridSetIds); int metaTilingX = metadataMap.get(CONFIG_KEY_METATILING_X, Integer.class).intValue(); info.setMetaTilingX(metaTilingX); int metaTilingY = metadataMap.get(CONFIG_KEY_METATILING_Y, Integer.class).intValue(); info.setMetaTilingY(metaTilingY); if (metadataMap.containsKey(CONFIG_KEY_FORMATS)) { String mimeFormatsStr = metadataMap.get(CONFIG_KEY_FORMATS, String.class); Set<String> mimeFormats = unmarshalSet(mimeFormatsStr); info.getMimeFormats().addAll(mimeFormats); } if (metadataMap.containsKey(CONFIG_KEY_AUTO_CACHE_STYLES)) { boolean autoCacheStyles = metadataMap.get(CONFIG_KEY_AUTO_CACHE_STYLES, Boolean.class).booleanValue(); info.setAutoCacheStyles(autoCacheStyles); } if (metadataMap.containsKey(CONFIG_KEY_IN_MEMORY_CACHED)) { boolean inMemoryCached = metadataMap.get(CONFIG_KEY_IN_MEMORY_CACHED, Boolean.class); info.setInMemoryCached(inMemoryCached); } return info; }
public static GeoServerTileLayerInfoImpl load(final LayerInfo layer) { MetadataMap metadataMap = layer.getMetadata(); if (!hasTileLayerDef(metadataMap)) { return null; } GeoServerTileLayerInfoImpl tileLayerInfo = load(metadataMap); if (metadataMap.containsKey(CONFIG_KEY_CACHED_STYLES)) { final String defaultStyle = layer.getDefaultStyle() == null ? "" : layer .getDefaultStyle().getName(); String cachedStylesStr = metadataMap.get(CONFIG_KEY_CACHED_STYLES, String.class); Set<String> cachedStyles = unmarshalSet(cachedStylesStr); TileLayerInfoUtil.setCachedStyles(tileLayerInfo, defaultStyle, cachedStyles); } else if (tileLayerInfo.isAutoCacheStyles()) { if (layer.getStyles() != null && layer.getStyles().size() > 0) { final String defaultStyle = layer.getDefaultStyle() == null ? "" : layer .getDefaultStyle().getName(); Set<String> cachedStyles = new HashSet<String>(); for (StyleInfo style : layer.getStyles()) { cachedStyles.add(style.getName()); } TileLayerInfoUtil.setCachedStyles(tileLayerInfo, defaultStyle, cachedStyles); } } tileLayerInfo.setName(tileLayerName(layer)); tileLayerInfo.setId(layer.getId()); return tileLayerInfo; }
public static GeoServerTileLayerInfoImpl load(final LayerInfo layer) { MetadataMap metadataMap = layer.getMetadata(); if (!hasTileLayerDef(metadataMap)) { return null; } GeoServerTileLayerInfoImpl tileLayerInfo = load(metadataMap); if (metadataMap.containsKey(CONFIG_KEY_CACHED_STYLES)) { final String defaultStyle = layer.getDefaultStyle() == null ? "" : layer.getDefaultStyle().prefixedName(); String cachedStylesStr = metadataMap.get(CONFIG_KEY_CACHED_STYLES, String.class); Set<String> cachedStyles = unmarshalSet(cachedStylesStr); TileLayerInfoUtil.setCachedStyles(tileLayerInfo, defaultStyle, cachedStyles); } TileLayerInfoUtil.checkAutomaticStyles(layer, tileLayerInfo); tileLayerInfo.setName(tileLayerName(layer)); tileLayerInfo.setId(layer.getId()); return tileLayerInfo; }