⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 containersearcher.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
////                                   ____.//                       __/\ ______|    |__/\.     _______//            __   .____|    |       \   |    +----+       \//    _______|  /--|    |    |    -   \  _    |    :    -   \_________//   \\______: :---|    :    :           |    :    |         \________>//           |__\---\_____________:______:    :____|____:_____\//                                      /_____|////                 . . . i n   j a h i a   w e   t r u s t . . .////////package org.jahia.services.search;import java.util.Date;import java.util.TimeZone;import java.util.Calendar;import org.jahia.params.*;          		// ParamBeanimport org.jahia.registries.*;     	 		// JahiaRegistriesimport org.jahia.exceptions.*;import org.jahia.data.search.JahiaSearchResult;/** * Handle containers search. * The result for this searcher is an instance of JahiaSearchResult * with a vector of matching container ids. * * @author Khue Nguyen <a href="mailto:khue@jahia.org">khue@jahia.org</a> */public class ContainerSearcher extends JahiaSearcher {    private static final String CLASS_NAME = ContainerSearcher.class.getName();		private int ctnListID = 0;		private long lastSearchTime = -1;	private boolean updated = false;			//--------------------------------------------------------------------------	/**	 * Constructor	 *	 * The expected result is a JahiaSearchResult object containing a vector of matching containers.	 * The vector contained in the JahiaSearchResult is a vector of matching ctn ids, not the containers.	 * No right check on container, only on field.	 *	 * @param int ctnListID, the container list id.	 */ 	public ContainerSearcher(int ctnListID)	{		this.ctnListID = ctnListID;	}		//--------------------------------------------------------------------------	/**	 * Perform the search for a given query as String.	 * The expected result is a JahiaSearchResult object containing a vector of matching containers.	 * The vector contained in the JahiaSearchResult is a vector of matching ctn ids, not the containers.	 * No right check.	 *	 * @param String query, a valid query.	 * @param ParamBean jParams, the param bean.	 * @return JahiaSearchResult result, the expected result as an instance of JahiaSearchResult object	 */	public JahiaSearchResult search(String query, ParamBean jParams)	throws JahiaException	{		JahiaSearchResult result = new JahiaSearchResult();				// Must set the query first.		setQuery(query);				// Perform the search.		ServicesRegistry sReg = ServicesRegistry.getInstance();		result = sReg.getJahiaSearchService().search(this,jParams);				// Store the result.		setResult(result);	 	// Set search time        TimeZone tz = TimeZone.getTimeZone("UTC");        Calendar cal = Calendar.getInstance(tz);	 	Date nowDate = cal.getTime();		this.lastSearchTime = nowDate.getTime();					this.updated = true;					return result;	}	//--------------------------------------------------------------------------	/**	 * Return the searcher name which value is JahiaSearcher.CONTAINER_SEARCHER.	 *	 * The search service must return a result of JahiaSearchResult type for this searcher.	 *	 * @return String name, the searcher name.	 */	public String getName()	{		return this.CONTAINER_SEARCHER;	}	//--------------------------------------------------------------------------	/**	 * Return the container list id.	 *	 * @return int ctnListID, the container list id.	 */	public int getCtnListID()	{		return this.ctnListID;	}	//--------------------------------------------------------------------------	/**	 * Return the last search running time.	 *	 * @return int ctnListID, the container list id. -1 if never performed yet	 */	public long getLastSearchTime()	{		return this.lastSearchTime;	}	//--------------------------------------------------------------------------	/**	 * Return the update status. Each time the doFilter method is called, this update status is set to true.	 *	 * @return boolean, the internal updated status value.	 */	public boolean getUpdateStatus()	{		return this.updated;	}	//--------------------------------------------------------------------------	/**	 * Set the update status to true.	 *	 */	public void setUpdateStatus()	{		this.updated = true;	}	//--------------------------------------------------------------------------	/**	 * You can reset the internal update status by setting it to false	 *	 */	public void resetUpdateStatus()	{		this.updated = false;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -