Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.workplace.wcm.api.query
Class Disjunction

    java.lang.Object
      com.ibm.workplace.wcm.api.query.CompoundSelector
          com.ibm.workplace.wcm.api.query.Association
              com.ibm.workplace.wcm.api.query.Disjunction

All Implemented Interfaces:
  QueryElement, Selector, java.io.Serializable

    public final class Disjunction

extends Association

`Disjunction` associates `Selectors` together with `Operator.OR`. Here is an example of how to use create a query with 'AND' and 'OR' conditions by using `Conjunction` and `Disjunction`. The example will process all content whose name starts with 'news', or whose name starts with 'article' and has a keyword 'news'.

      QueryService queryService = workspace.getQueryService();
      Query query = queryService.createQuery(Content.class);
      Disjunction or = new Disjunction();
      or.add(Selectors.nameLike("news%"));
      Conjunction and = new Conjunction();
      and.add(Selectors.nameLike("article%"));
      and.add(ProfileSelectors.keywordsContain("news"));
      or.add(and);
      query.addSelector(or);
      try
      {
         ResultIterator resultIterator = queryService.execute(query);
         while (resultIterator.hasNext())
         {
            Content childContent = (Content) resultIterator.next();
            if (childContent.hasComponent("myElement"))
            {
               contentWithMyElement = childContent;
               break;
            }
         }
      }
      catch (QueryServiceException e)
      {
         // Handle exception
      }

Since:
  7.0
See Also:
  Serialized Form

Field Summary

Fields inherited from interface com.ibm.workplace.wcm.api.query.Selector
`NULL_SELECTOR`

Constructor Summary
`Disjunction()` Constructor
`Disjunction(java.util.Collection<Selector> selectors)` Constructor

Method Summary
`void` | `add(Selector selector)` Adds a selector

Methods inherited from class com.ibm.workplace.wcm.api.query.Association
`add, add, createAssociation, getOperator, getSelectors, toString`

Methods inherited from class com.ibm.workplace.wcm.api.query.CompoundSelector
`getElements, hasElements`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Disjunction

    public Disjunction()

  Constructor

### Disjunction

    public Disjunction(java.util.Collection<Selector> selectors)

  Constructor

  Parameters:
    `selectors` - associated selectors

Method Detail

### add

    public void add(Selector selector)

  Adds a selector

  Overrides:
    `add` in class `Association`
  Parameters:
    `selector` - the selector to add

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD