📄 cswsearchresult.java
字号:
package com.esri.solutions.jitk.web.tasks.search.csw;
import com.esri.adf.web.data.WebContext;
import com.esri.adf.web.data.geometry.WebGeometry;
import com.esri.solutions.jitk.common.metadata.IMetadataCatalog;
import com.esri.solutions.jitk.common.metadata.IMetadataDocument;
import com.esri.solutions.jitk.web.tasks.search.csw.actions.IActionHandler;
import com.esri.solutions.jitk.web.tasks.search.csw.actions.IMetadataAwareActionHandler;
import org.apache.log4j.Logger;
import java.util.List;
import java.util.Map;
public class CswSearchResult implements ICswSearchResult {
/**
* {@link Logger} used to log messages for this class.
*/
private static final Logger _logger = Logger.getLogger(CswSearchResult.class);
/**
* Reference to the {@link IMetadataCatalog}.
*/
private IMetadataCatalog m_catalog = null;
/**
* Reference to the {@link IMetadataDocument}.
*/
private IMetadataDocument m_document = null;
/**
* Name of the CS/W search result.
*/
private String m_displayName = null;
/**
* {@link Map} containing the search result's information.
*/
private Map<String, String> m_details = null;
/**
* {@link Boolean} value indicating whether or not the result
* is live data or map.
*/
private boolean m_isLiveDataOrMap = Boolean.FALSE;
/**
* Reference to the ADF's {@link WebContext}.
*/
private WebContext m_context = null;
/**
* Reference to the search result's ADF {@link WebGeometry}.
*/
private WebGeometry m_geometry = null;
/**
* {@link List} of {@link IActionHandler} objects.
*/
private List<IActionHandler> m_actionHandlers = null;
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#setWebContext(com.esri.adf.web.data.WebContext)
*/
public void setWebContext(WebContext webContext) {
if (webContext == null) {
throw new NullPointerException("WebContext cannot be null");
}
m_context = webContext;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#setMetadataCatalog(com.esri.solutions.jitk.common.metadata.IMetadataCatalog)
*/
public void setMetadataCatalog(IMetadataCatalog catalog) {
if (catalog == null) {
throw new NullPointerException("catalog cannot be null");
}
m_catalog = catalog;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#setMetadataDocument(com.esri.solutions.jitk.common.metadata.IMetadataDocument)
*/
public void setMetadataDocument(IMetadataDocument document) {
if (document == null) {
throw new NullPointerException("document cannot be null");
}
m_document = document;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#setActionHandlers(java.util.List)
*/
public void setActionHandlers(List<IActionHandler> actionHandlers) {
m_actionHandlers = actionHandlers;
initActionHandlers();
}
/**
* Name of the CS/W search result.
*
* @return {@link String} name.
*/
public String getDisplayName() {
return m_displayName;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#isLiveDataOrMap()
*/
public boolean isLiveDataOrMap() {
return m_isLiveDataOrMap;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#setLiveDataOrMap(boolean)
*/
public void setLiveDataOrMap(boolean live) {
m_isLiveDataOrMap = live;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#setDisplayName(java.lang.String)
*/
public void setDisplayName(String name) {
m_displayName = name;
}
/**
* Gets the {@link Map} of information for the search result.
* Key/Value pair.
*
* @return {@link Map} of details for the search result.
*/
public Map<String, String> getDetails() {
return m_details;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#setDetails(java.util.Map)
*/
public void setDetails(Map<String, String> details) {
m_details = details;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#setWebGeometry(com.esri.adf.web.data.geometry.WebGeometry)
*/
public void setWebGeometry(WebGeometry geom) {
m_geometry = geom;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#executeAction()
*/
public void executeAction() {
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.web.tasks.search.csw.ICswSearchResult#executeAction(java.lang.String)
*/
public void executeAction(String actionName) {
IActionHandler action = null;
for (IActionHandler ah : m_actionHandlers) {
if (ah.getName().equalsIgnoreCase(actionName)) {
action = ah;
break;
}
}
if (action == null) {
_logger.warn("No action handler found for action: [" + actionName +
"]");
return;
}
action.setWebContext(m_context);
action.setWebGeometry(m_geometry);
if (action instanceof IMetadataAwareActionHandler) {
IMetadataAwareActionHandler mdAwareAction = (IMetadataAwareActionHandler) action;
mdAwareAction.setMetadataCatalog(m_catalog);
mdAwareAction.setMetadataDocument(m_document);
}
action.execute();
}
protected void initActionHandlers() {
for (IActionHandler action : m_actionHandlers) {
action.setWebContext(m_context);
action.setWebGeometry(m_geometry);
if (action instanceof IMetadataAwareActionHandler) {
IMetadataAwareActionHandler mdAwareAction = (IMetadataAwareActionHandler) action;
mdAwareAction.setMetadataCatalog(m_catalog);
mdAwareAction.setMetadataDocument(m_document);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -