Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 120735 Details for
Bug 256696
[presence] Support XMPP Search (XEP-0055)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Search Interfaces API
patch.txt (text/plain), 27.55 KB, created by
Marcelo Mayworm
on 2008-12-17 13:31:50 EST
(
hide
)
Description:
Search Interfaces API
Filename:
MIME Type:
Creator:
Marcelo Mayworm
Created:
2008-12-17 13:31:50 EST
Size:
27.55 KB
patch
obsolete
>Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.ecf/framework/bundles/org.eclipse.ecf.presence/META-INF/MANIFEST.MF,v >retrieving revision 1.89 >diff -u -r1.89 MANIFEST.MF >--- META-INF/MANIFEST.MF 8 Sep 2008 23:11:30 -0000 1.89 >+++ META-INF/MANIFEST.MF 17 Dec 2008 18:22:26 -0000 >@@ -12,6 +12,7 @@ > org.eclipse.ecf.presence.history, > org.eclipse.ecf.presence.im, > org.eclipse.ecf.presence.roster, >+ org.eclipse.ecf.presence.search, > org.eclipse.ecf.presence.service > Bundle-ManifestVersion: 2 > Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0, >Index: src/org/eclipse/ecf/presence/roster/IRosterManager.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.ecf/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IRosterManager.java,v >retrieving revision 1.8 >diff -u -r1.8 IRosterManager.java >--- src/org/eclipse/ecf/presence/roster/IRosterManager.java 17 Apr 2007 05:28:36 -0000 1.8 >+++ src/org/eclipse/ecf/presence/roster/IRosterManager.java 17 Dec 2008 18:22:26 -0000 >@@ -13,6 +13,7 @@ > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.ecf.presence.IPresenceListener; > import org.eclipse.ecf.presence.IPresenceSender; >+import org.eclipse.ecf.presence.search.IUserSearchManager; > > /** > * Roster manager for getting access to and changing roster. >@@ -53,8 +54,7 @@ > * for receiving subscription requests. Must not be > * <code>null</code>. > */ >- public void addRosterSubscriptionListener( >- IRosterSubscriptionListener listener); >+ public void addRosterSubscriptionListener(IRosterSubscriptionListener listener); > > /** > * Remove listener for roster subscription requests. >@@ -62,8 +62,7 @@ > * @param listener > * the listener to remove. Will not be <code>null</code>. > */ >- public void removeRosterSubscriptionListener( >- IRosterSubscriptionListener listener); >+ public void removeRosterSubscriptionListener(IRosterSubscriptionListener listener); > > /** > * Get roster subscription sender. The roster subscription sender returned >@@ -87,6 +86,16 @@ > public IPresenceSender getPresenceSender(); > > /** >+ * Retrieve interface for search on the provide. The returned >+ * IUserSearchManager (if not <code>null</code>) can be used to search users >+ * related to the same provider. >+ * >+ * @return IUserSearchManager. <code>null</code> if no search >+ * available for this provider. >+ */ >+ public IUserSearchManager getUserSearchManager(); >+ >+ /** > * Setup listener for handling presence updates. The given listener will > * asynchronously be called when a subscription request is received by this > * connected account. >Index: src/org/eclipse/ecf/presence/search/ResultList.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/ResultList.java >diff -N src/org/eclipse/ecf/presence/search/ResultList.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/ResultList.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,98 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+package org.eclipse.ecf.presence.search; >+ >+import java.util.*; >+ >+/** >+ * This Class implements {@link IResultList}. Subclasses may be created as >+ * appropriate. >+ * >+ */ >+public class ResultList implements IResultList { >+ >+ protected List results; >+ >+ /** >+ * Create a new synchronized result list from a existing one >+ * @param existingResults >+ */ >+ public ResultList(Collection /* <IResult> */existingResults) { >+ results = Collections.synchronizedList(new ArrayList()); >+ if (existingResults != null) >+ addAll(existingResults); >+ } >+ >+ /** >+ * Create a new synchronized result list from a existing one >+ * >+ */ >+ public ResultList() { >+ results = Collections.synchronizedList(new ArrayList()); >+ } >+ >+ /** >+ * Add an item for the result list >+ * @param item >+ * @return boolean >+ */ >+ public boolean add(IResult item) { >+ if (item == null) >+ return false; >+ if (results.add(item)) >+ return true; >+ return false; >+ } >+ >+ /** >+ * Add the list for the current result list >+ * @param existingResults >+ */ >+ protected void addAll(Collection /* <IResult> */existingResults) { >+ if (existingResults == null) >+ return; >+ synchronized (results) { >+ for (Iterator i = existingResults.iterator(); i.hasNext();) { >+ add((IResult) i.next()); >+ } >+ } >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ecf.ui.presence.search.IResultList#getEntries() >+ */ >+ public Collection geResults() { >+ return results; >+ } >+ >+ public boolean remove(IResult item) { >+ return results.remove(item); >+ } >+ >+ public String toString() { >+ StringBuffer sb = new StringBuffer("ResultList["); //$NON-NLS-1$ >+ sb.append("results=").append(results).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ >+ sb.append("]"); //$NON-NLS-1$ >+ return sb.toString(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ecf.ui.presence.search.IResultList#getResult >+ */ >+ public IResult getResult(String field, String value) { >+ // TODO >+ return null; >+ } >+ >+} >Index: src/org/eclipse/ecf/presence/search/ISearch.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/ISearch.java >diff -N src/org/eclipse/ecf/presence/search/ISearch.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/ISearch.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+ >+package org.eclipse.ecf.presence.search; >+ >+/** >+ * Provide access for the list of matched query results. This interface can be >+ * extended to supply more features around the result list. >+ * >+ */ >+public interface ISearch { >+ >+ /** >+ * Gets a result list. >+ * Will not return <code>null</code>. >+ * @return IResultList list of {@link IResult} >+ */ >+ IResultList getResultList(); >+ >+} >Index: src/org/eclipse/ecf/presence/search/ICriteria.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/ICriteria.java >diff -N src/org/eclipse/ecf/presence/search/ICriteria.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/ICriteria.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+ >+package org.eclipse.ecf.presence.search; >+ >+import java.util.List; >+ >+/** >+ * Criteria helps for retrieving results from the provider search by composing Criterion objects. >+ * The {@link IUserSearchManager} is a factory for Criteria. Criterion instances are obtained via ISelection methods. >+ * Criteria can deal with different kind of criterion, as logical or just simple expression. >+ * >+ * The typical usage of the Criteria is as >+ * follows: >+ * >+ * <pre> >+ * ISelection selection = ... >+ * ICriterion name = selection.eq("name", "value"); >+ * ICriterion host = selection.eq("host", "value"); >+ * ICriterion and = selection.and(name, host); >+ * ICriteria criteria = ... >+ * criteria.add(and); >+ * </pre> >+ */ >+public interface ICriteria { >+ >+ /** >+ * Add a criterion that composes the criteria >+ * @param criterion >+ */ >+ public void add(ICriterion criterion); >+ >+ /** >+ * A list of all criterion added to the criteria >+ * @return List of {@link ICriterion} >+ */ >+ public List getCriterions(); >+ >+ /** >+ * Notify if there is or not criterion added for this criteria >+ * @return indicate if there are or not criterion >+ */ >+ public boolean isEmpty(); >+ >+} >Index: src/org/eclipse/ecf/presence/search/ISelection.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/ISelection.java >diff -N src/org/eclipse/ecf/presence/search/ISelection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/ISelection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,61 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+package org.eclipse.ecf.presence.search; >+ >+/** >+ * Instances implementing this interface provide methods to compose the corrects operations for each >+ * provide >+ * >+ */ >+public interface ISelection { >+ >+ /** >+ * Apply an "add" constraint to the two criterion >+ * @param left >+ * @param right >+ * @return ICriterion >+ */ >+ public ICriterion and(ICriterion left, ICriterion right); >+ >+ /** >+ * Apply an "equal" constraint to the field, ignoring case >+ * @param field >+ * @param value >+ * @return ICriterion >+ */ >+ public ICriterion eq(String field, String value); >+ >+ /** >+ * Apply an "not equal" constraint to the field ignoring case >+ * @param field >+ * @param value >+ * @return ICriterion >+ */ >+ public ICriterion ne(String field, String value); >+ >+ /** >+ * Apply an "equal" constraint to the field, taking into consideration ignore case >+ * @param field >+ * @param value >+ * @param ignoreCase >+ * @return ICriterion >+ */ >+ public ICriterion eq(String field, String value, boolean ignoreCase); >+ >+ /** >+ * Apply an "not equal" constraint to the field, taking into consideration ignore case >+ * @param field >+ * @param value >+ * @param ignoreCase >+ * @return ICriterion >+ */ >+ public ICriterion ne(String field, String value, boolean ignoreCase); >+ >+} >Index: src/org/eclipse/ecf/presence/search/LogicalCriterion.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/LogicalCriterion.java >diff -N src/org/eclipse/ecf/presence/search/LogicalCriterion.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/LogicalCriterion.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,49 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+package org.eclipse.ecf.presence.search; >+ >+/** >+ * Base class implementation of {@link ICriterion} for logical criterion. >+ * Subclasses may be created as appropriate. It is just a simple >+ * implementation that can be considered for some provider or even used >+ * as base for some implementation. >+ * >+ */ >+public class LogicalCriterion implements ICriterion { >+ >+ final ICriterion left; >+ final ICriterion right; >+ final String operator; >+ >+ /** >+ * Creates a logic operation for compose a {@link ICrteria} >+ * @param left Criterion on the left side of the expression >+ * @param right Criterion on the right side of the expression >+ * @param operator Operator considered on the logical. Ex: And >+ */ >+ public LogicalCriterion(ICriterion left, ICriterion right, String operator) { >+ this.left = left; >+ this.right = right; >+ this.operator = operator; >+ } >+ >+ public String toExpression() { >+ return left.toExpression() + ' ' + operator + ' ' + right.toExpression(); >+ } >+ >+ public String toString() { >+ StringBuffer sb = new StringBuffer("LogicalCriterion["); //$NON-NLS-1$ >+ sb.append("left=").append(left).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ >+ sb.append("right=").append(right).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ >+ sb.append("operator=").append(operator).append("]"); //$NON-NLS-1$ //$NON-NLS-2$ >+ return sb.toString(); >+ } >+ >+} >Index: src/org/eclipse/ecf/presence/search/IResult.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/IResult.java >diff -N src/org/eclipse/ecf/presence/search/IResult.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/IResult.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+package org.eclipse.ecf.presence.search; >+ >+import org.eclipse.ecf.core.user.IUser; >+ >+/** >+ * Each result returned for the search will be reach through this interface. >+ * The result contain the user that match the search. >+ * >+ */ >+public interface IResult { >+ >+ /** >+ * Get user for the search. This is the user that comes from the search. >+ * >+ * @return IUser user associated with the search. >+ */ >+ public IUser getUser(); >+} >Index: src/org/eclipse/ecf/presence/search/SimpleCriterion.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/SimpleCriterion.java >diff -N src/org/eclipse/ecf/presence/search/SimpleCriterion.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/SimpleCriterion.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,70 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+package org.eclipse.ecf.presence.search; >+ >+/** >+ * >+ * Base class implementation of {@link ICriterion} for simple comparisons. Subclasses may be created as >+ * appropriate. >+ * >+ */ >+public class SimpleCriterion implements ICriterion { >+ >+ final String field; >+ final String value; >+ final String operator; >+ final boolean ignoreCase; >+ >+ /** >+ * Constructor for a instance of {@link ICriterion} >+ * @param field Name of the field >+ * @param value Value that match the search >+ * @param operator Operator opportune for the search >+ * @param ignoreCase Consider case or not >+ */ >+ public SimpleCriterion(String field, String value, String operator, boolean ignoreCase) { >+ this.field = field; >+ this.value = value; >+ this.operator = operator; >+ this.ignoreCase = ignoreCase; >+ } >+ >+ /** >+ * Constructor for a instance of {@link ICriterion}. This is >+ * ignore case >+ * @param field Name of the field >+ * @param value Value that match the search >+ * @param operator Operator opportune for the search >+ */ >+ public SimpleCriterion(String field, String value, String operator) { >+ this.field = field; >+ this.value = value; >+ this.operator = operator; >+ this.ignoreCase = false; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.ecf.presence.search.ICriterion#toExpression() >+ */ >+ public String toExpression() { >+ return field + ' ' + operator + ' ' + value; >+ } >+ >+ public String toString() { >+ StringBuffer sb = new StringBuffer("SimpleCriterion["); //$NON-NLS-1$ >+ sb.append("field=").append(field).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ >+ sb.append("value=").append(value).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ >+ sb.append("operator=").append(operator).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ >+ sb.append("ignoreCase=").append(ignoreCase).append("]"); //$NON-NLS-1$ //$NON-NLS-2$ >+ return sb.toString(); >+ } >+ >+} >Index: src/org/eclipse/ecf/presence/search/IUserSearchManager.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/IUserSearchManager.java >diff -N src/org/eclipse/ecf/presence/search/IUserSearchManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/IUserSearchManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,56 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+ >+package org.eclipse.ecf.presence.search; >+ >+/** >+ * Get a search mechanism for an account. >+ * >+ */ >+public interface IUserSearchManager { >+ >+ /** >+ * Execute the search for a specific criteria, blocking until the search returns. >+ * This method can apply search to math the specific criteria in case if the >+ * provider is not able to do it completely >+ * @param criteria >+ * @return ISearch Contain the search results >+ */ >+ public ISearch search(ICriteria criteria); >+ >+ /** >+ * Execute the search for a specific criteria, not blocking until the search returns. >+ * This method can apply search to math the specific criteria in case if the >+ * provider is not able to do it completely >+ * @param criteria >+ * @param listener the listener {@link IUserSearchListener} to search. Must not be <code>null</code>. >+ * >+ */ >+ public void search(ICriteria criteria, IUserSearchListener listener); >+ >+ /** >+ * Create a specific criteria for the provider. Each provider must >+ * implement a specific Criteria in a convenient approach for keep, >+ * organize and deal with the {@link ICriterion}. >+ * @return {@link ICriteria} >+ */ >+ public ICriteria createCriteria(); >+ >+ /** >+ * Create a specific {@link ISelection} implementation for the provider. >+ * This implementation will provide the methods to created and organize >+ * the {@link ICriterion} that composes the search. The {@link Selection} >+ * is a simple implementation of this, but subclasses or new implementation >+ * may be created as appropriate. >+ * >+ * @return {@link ISelection} >+ */ >+ public ISelection createSelection(); >+} >Index: src/org/eclipse/ecf/presence/search/IUserSearchListener.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/IUserSearchListener.java >diff -N src/org/eclipse/ecf/presence/search/IUserSearchListener.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/IUserSearchListener.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+package org.eclipse.ecf.presence.search; >+ >+/** >+ * This Interface allows for implementing classes to execute the search >+ * for users in a non block way. >+ * Note these methods will be called asynchronously not blocking a search action. >+ * The provider is free to call the methods below with an arbitrary thread, so the >+ * implementation of these methods must be appropriately prepared. >+ * >+ */ >+public interface IUserSearchListener { >+ >+ /** >+ * Handle the search asynchronously. Notify that the search was completed >+ * for the specific criteria. >+ * @param criteria the object that contains the composition of {@link ICriterion} >+ */ >+ public void handleSearchComplete(ICriteria criteria); >+ >+} >Index: src/org/eclipse/ecf/presence/search/Selection.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/Selection.java >diff -N src/org/eclipse/ecf/presence/search/Selection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/Selection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,71 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+package org.eclipse.ecf.presence.search; >+ >+/** >+ * This Class implements {@link ISelection}. Subclasses may be created as >+ * appropriate. It is just a simple implementation that can be considered >+ * for some provider or even used as base for some implementation. >+ * >+ */ >+public class Selection implements ISelection { >+ >+ /** Operator Equal */ >+ public static final String OPERATOR_EQ = "="; //$NON-NLS-1$ >+ >+ /** Operator Not Equal */ >+ public static final String OPERATOR_NE = "!="; //$NON-NLS-1$ >+ >+ /** Operator AND */ >+ public static final String OPERATOR_AND = "&&"; //$NON-NLS-1$ >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.ecf.presence.search.ISelection#and(org.eclipse.ecf.presence.search.ICriterion, org.eclipse.ecf.presence.search.ICriterion) >+ */ >+ public ICriterion and(ICriterion left, ICriterion right) { >+ return new LogicalCriterion(left, right, OPERATOR_AND); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.ecf.presence.search.ISelection#eq(java.lang.String, java.lang.String) >+ */ >+ public ICriterion eq(String field, String value) { >+ return new SimpleCriterion(field, value, OPERATOR_EQ); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.ecf.presence.search.ISelection#ne(java.lang.String, java.lang.String) >+ */ >+ public ICriterion ne(String field, String value) { >+ return new SimpleCriterion(field, value, OPERATOR_NE); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.ecf.presence.search.ISelection#eq(java.lang.String, java.lang.String, boolean) >+ */ >+ public ICriterion eq(String field, String value, boolean ignoreCase) { >+ //TODO implement a criterion that supports ignore case approach >+ return new SimpleCriterion(field, value, OPERATOR_EQ); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.ecf.presence.search.ISelection#ne(java.lang.String, java.lang.String, boolean) >+ */ >+ public ICriterion ne(String field, String value, boolean ignoreCase) { >+ //TODO implement a criterion that supports ignore case approach >+ return new SimpleCriterion(field, value, OPERATOR_NE); >+ } >+ >+} >Index: src/org/eclipse/ecf/presence/search/IResultList.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/IResultList.java >diff -N src/org/eclipse/ecf/presence/search/IResultList.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/IResultList.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+ >+package org.eclipse.ecf.presence.search; >+ >+import java.util.Collection; >+ >+/** >+ * This interface provides methods to handle the result list that match the search. >+ * >+ */ >+public interface IResultList { >+ >+ /** >+ * Get results that match the search. Instances of list are of type >+ * {@link IResult} >+ * >+ * @return Collection of IResult. Will not return <code>null</code>. >+ * May return an empty Collection. >+ */ >+ public Collection geResults(); >+ >+ /** >+ * Get the result that math the specific field and value >+ * @param field field's name used as argument to try to match the search >+ * @param value value for the respective field used as argument to try to match the search >+ * @return IResult will be null case it doesn't exist >+ */ >+ public IResult getResult(String field, String value); >+} >Index: src/org/eclipse/ecf/presence/search/ICriterion.java >=================================================================== >RCS file: src/org/eclipse/ecf/presence/search/ICriterion.java >diff -N src/org/eclipse/ecf/presence/search/ICriterion.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/presence/search/ICriterion.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Marcelo Mayworm. All rights reserved. This >+ * program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Marcelo Mayworm - initial API and implementation >+ * >+ ******************************************************************************/ >+ >+package org.eclipse.ecf.presence.search; >+ >+/** >+ * A representation of a query criterion for a restriction in a Criteria. >+ * A Criteria is formed by one or several criterion, >+ * that together are able to compose an entire expression to project >+ * a result that match the criteria. The instances of this should be >+ * created for {@link ISelection} implementations. >+ * >+ */ >+public interface ICriterion { >+ >+ /** >+ * Returns a expression composed for the search. >+ * The String can be something like 'field' + 'operator' + value, >+ * that it will be interpreted for each specific provider. >+ * @return String >+ */ >+ public String toExpression(); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 256696
:
120735
|
122604
|
123016
|
123308