📄 metadatacontext.java
字号:
package com.esri.solutions.jitk.common.metadata;
import java.util.HashMap;
import java.util.Map;
import com.esri.adf.web.data.GISResource;
/**
* Basic {@link IMetadataContext} implementation providing minimal lookup capabilities
*/
public class MetadataContext implements IMetadataContext {
/**
* Registry for {@link IMetadataCatalog} instances, keyed by their ID field
*/
private Map<String, IMetadataCatalog> _metadataCatalogs = new HashMap<String, IMetadataCatalog>();
/**
* Registry for {@link IMetadataProfile} instances, keyed by their name
*/
private Map<String, IMetadataProfile> _metadataProfiles = new HashMap<String, IMetadataProfile>();
/**
* {@link IResourceMetadataRegistry} instance that allows lookups of {@link GISResource GISResources} and {@link IMetadataID IMetadataIDs}
*/
private IResourceMetadataRegistry _registry = null;
/*
* (non-Javadoc)
*
* @see com.esri.solutions.jitk.common.metadata.IMetadataContext#getCatalogById(java.lang.String)
*/
public IMetadataCatalog getCatalogById(String catalogID) {
if (catalogID == null) {
throw new NullPointerException("catalogID cannot be null");
}
return _metadataCatalogs.get(catalogID);
}
/**
* Sets a {@link Map} of all metadata catalog values, keyed by their Ids, which should be derived from {@link IMetadataCatalog#getID()}
* @param catalogs The catalog map; cannot be {@code null}
*/
public void setMetadataCatalogs(Map<String, IMetadataCatalog> catalogs) {
if (catalogs == null) {
throw new NullPointerException("catalogs cannot be null");
}
_metadataCatalogs = catalogs;
}
/*
* (non-Javadoc)
*
* @see com.esri.solutions.jitk.common.metadata.IMetadataContext#getMetadataCatalogs()
*/
public Map<String, IMetadataCatalog> getMetadataCatalogs() {
return _metadataCatalogs;
}
/**
* Sets a {@link Map} of all metadata profile values, keyed by their names, which should be derived from {@link IMetadataProfile#getName()}
* @param profiles The profile map; cannot be {@code null}
*/
public void setMetadataProfiles(Map<String, IMetadataProfile> profiles) {
if (profiles == null) {
throw new NullPointerException("profiles cannot be null");
}
_metadataProfiles = profiles;
}
/*
* (non-Javadoc)
*
* @see com.esri.solutions.jitk.common.metadata.IMetadataContext#getMetadataProfiles()
*/
public Map<String, IMetadataProfile> getMetadataProfiles() {
return _metadataProfiles;
}
/*
* (non-Javadoc)
*
* @see com.esri.solutions.jitk.common.metadata.IMetadataContext#getProfileById(java.lang.String)
*/
public IMetadataProfile getProfileById(String name) {
if (name == null) {
throw new NullPointerException("name cannot be null");
}
return _metadataProfiles.get(name);
}
/**
* Sets the {@link IResourceMetadataRegistry} used by this context
* @param registry The {@link IResourceMetadataRegistry}; cannot be {@code null}
*/
public void setResourceMetadataRegistry(IResourceMetadataRegistry registry) {
if (registry == null) {
throw new NullPointerException("registry cannot be null");
}
_registry = registry;
}
/*
* (non-Javadoc)
*
* @see com.esri.solutions.jitk.common.metadata.IMetadataContext#getResourceMetadataRegistry()
*/
public IResourceMetadataRegistry getResourceMetadataRegistry() {
return _registry;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -