Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IModelFactory


    /* In case Article is unavailable */
    if (articleReader == null)
      return;

    IModelFactory factory = Owl.getModelFactory();
    final INews news = factory.createNews(null, feed, new Date());
    final Map<String, StringBuilder> mimeToContent = new HashMap<String, StringBuilder>();

    /* Create parser for this message */
    final MimeStreamParser parser = new MimeStreamParser();
    parser.setContentHandler(new AbstractContentHandler() {
View Full Code Here


  }

  @SuppressWarnings("unused")
  private void createSavedSearches() {
    IFolder folder = Owl.getModelFactory().createFolder(null, null, "Default");
    IModelFactory factory = Owl.getModelFactory();

    /* Create Default SearchMarks */
    String newsEntityName = INews.class.getName();

    /* SearchCondition: New and Updated News */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "New and Updated News");

      ISearchField field1 = factory.createSearchField(INews.STATE, newsEntityName);
      factory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, EnumSet.of(State.NEW));
    }

    /* SearchCondition: Recent News */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "Recent News");

      ISearchField field1 = factory.createSearchField(INews.AGE_IN_DAYS, newsEntityName);
      factory.createSearchCondition(null, mark, field1, SearchSpecifier.IS_LESS_THAN, 2);
    }

    /* SearchCondition: News with Attachments */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "News with Attachments");

      ISearchField field = factory.createSearchField(INews.HAS_ATTACHMENTS, newsEntityName);
      factory.createSearchCondition(null, mark, field, SearchSpecifier.IS, true);
    }

    /* SearchCondition: Sticky News */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "Sticky News");

      ISearchField field = factory.createSearchField(INews.IS_FLAGGED, newsEntityName);
      factory.createSearchCondition(null, mark, field, SearchSpecifier.IS, true);
    }

    /*
     * Condition : +(State IS *new* OR State is *unread* OR State IS *updated*)
     * AND +((Entire News contains "Foo") OR Author is "Benjamin Pasero")
     */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "Complex Search");

      ISearchField field1 = factory.createSearchField(INews.STATE, newsEntityName);
      ISearchCondition cond1 = factory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, State.UNREAD, State.UPDATED));

      ISearchField field4 = factory.createSearchField(IEntity.ALL_FIELDS, newsEntityName);
      ISearchCondition cond4 = factory.createSearchCondition(null, mark, field4, SearchSpecifier.CONTAINS, "Foo");

      ISearchField field5 = factory.createSearchField(INews.AUTHOR, newsEntityName);
      ISearchCondition cond5 = factory.createSearchCondition(null, mark, field5, SearchSpecifier.IS, "Benjamin Pasero");
    }

    /*
     * Condition : +(State IS *new* OR State is *unread* OR State IS *updated*)
     * AND (Entire News contains "Foo") AND (Author is "Benjamin Pasero")
     */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "Complex Search");

      ISearchField field1 = factory.createSearchField(INews.STATE, newsEntityName);
      ISearchCondition cond1 = factory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, State.UNREAD, State.UPDATED));

      ISearchField field4 = factory.createSearchField(IEntity.ALL_FIELDS, newsEntityName);
      ISearchCondition cond4 = factory.createSearchCondition(null, mark, field4, SearchSpecifier.CONTAINS, "Foo");

      ISearchField field5 = factory.createSearchField(INews.AUTHOR, newsEntityName);
      ISearchCondition cond5 = factory.createSearchCondition(null, mark, field5, SearchSpecifier.CONTAINS, "Benjamin Pasero");
    }

    /*
     * Condition : (Entire News contains "Foo") AND (Title contains "Bar") AND
     * (Author is not "Benjamin Pasero")
     */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "Complex Search");

      ISearchField field1 = factory.createSearchField(IEntity.ALL_FIELDS, newsEntityName);
      ISearchCondition cond1 = factory.createSearchCondition(null, mark, field1, SearchSpecifier.CONTAINS, "fafa");

      ISearchField field2 = factory.createSearchField(INews.TITLE, newsEntityName);
      ISearchCondition cond2 = factory.createSearchCondition(null, mark, field2, SearchSpecifier.CONTAINS, "Bar");

      ISearchField field3 = factory.createSearchField(INews.AUTHOR, newsEntityName);
      ISearchCondition cond3 = factory.createSearchCondition(null, mark, field3, SearchSpecifier.IS_NOT, "Benjamin Pasero");
    }

    /*
     * Condition : +(State IS *new* OR State is *unread* OR State IS *updated*)
     * AND (Category IS Windows) AND (Category IS Apple)
     */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "Complex Search");

      ISearchField field1 = factory.createSearchField(INews.STATE, newsEntityName);
      ISearchCondition cond1 = factory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, State.UNREAD, State.UPDATED));

      ISearchField field4 = factory.createSearchField(INews.CATEGORIES, newsEntityName);
      ISearchCondition cond4 = factory.createSearchCondition(null, mark, field4, SearchSpecifier.IS, "windows");

      ISearchField field5 = factory.createSearchField(INews.CATEGORIES, newsEntityName);
      ISearchCondition cond5 = factory.createSearchCondition(null, mark, field5, SearchSpecifier.IS, "apple");
    }

    /*
     * Condition : +(State IS *new* OR State is *unread* OR State IS *updated*)
     * AND (Category IS Windows) AND (Category IS Apple) AND (Category IS NOT
     * Slashdot)
     */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "Complex Search");

      ISearchField field1 = factory.createSearchField(INews.STATE, newsEntityName);
      ISearchCondition cond1 = factory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, State.UNREAD, State.UPDATED));

      ISearchField field4 = factory.createSearchField(INews.CATEGORIES, newsEntityName);
      ISearchCondition cond4 = factory.createSearchCondition(null, mark, field4, SearchSpecifier.IS, "windows");

      ISearchField field5 = factory.createSearchField(INews.CATEGORIES, newsEntityName);
      ISearchCondition cond5 = factory.createSearchCondition(null, mark, field5, SearchSpecifier.IS, "apple");

      ISearchField field6 = factory.createSearchField(INews.CATEGORIES, newsEntityName);
      factory.createSearchCondition(null, mark, field6, SearchSpecifier.IS_NOT, "slashdot");
    }

    /*
     * Condition : +(State IS *new* OR State is *unread* OR State IS *updated*)
     * AND (Category IS NOT Windows)
     */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "Complex Search");

      ISearchField field1 = factory.createSearchField(INews.STATE, newsEntityName);
      ISearchCondition cond1 = factory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, State.UNREAD, State.UPDATED));

      ISearchField field4 = factory.createSearchField(INews.CATEGORIES, newsEntityName);
      ISearchCondition cond4 = factory.createSearchCondition(null, mark, field4, SearchSpecifier.IS_NOT, "windows");
    }

    /*
     * Condition : +(State IS *new* OR State is *unread* OR State IS *updated*)
     * AND (Age is Less than 5 Days)
     */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "Complex Search");

      ISearchField field1 = factory.createSearchField(INews.STATE, newsEntityName);
      ISearchCondition cond1 = factory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, State.UNREAD, State.UPDATED));

      ISearchField field4 = factory.createSearchField(INews.AGE_IN_DAYS, newsEntityName);
      ISearchCondition cond4 = factory.createSearchCondition(null, mark, field4, SearchSpecifier.IS_LESS_THAN, 5);
    }

    /*
     * Condition 5: (State IS *new* OR State is *unread* OR State IS *updated*)
     * AND All_Fields CONTAINS foo
     */
    {
      ISearchMark mark = factory.createSearchMark(null, folder, "Complex Search");

      ISearchField field1 = factory.createSearchField(INews.STATE, newsEntityName);
      ISearchCondition cond1 = factory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, State.UNREAD, State.UPDATED));

      ISearchField field4 = factory.createSearchField(IEntity.ALL_FIELDS, newsEntityName);
      ISearchCondition cond4 = factory.createSearchCondition(null, mark, field4, SearchSpecifier.CONTAINS, "pasero");
    }

    DynamicDAO.save(folder);
  }
View Full Code Here

  @SuppressWarnings("nls")
  @Test
  public void searchNews() throws Exception {
    final List<Exception> ex = new ArrayList<Exception>();
    final int[] results = new int[] { 0 };
    final IModelFactory factory = Owl.getModelFactory();
    List<ITask> tasks = new ArrayList<ITask>();
    fModelSearch.startup();

    /* Save some Feeds first */
    saveFeedsHelper();

    /* Query 1: News is *new*, *unread*, *updated*, *read* */
    ITask task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(INews.STATE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, State.UNREAD, State.UPDATED, State.READ)));

        results[0] = fModelSearch.searchNews(conditions, false).size();

        return Status.OK_STATUS;
      }
    };
    tasks.clear();
    tasks.add(task);
    long l1 = TestUtils.executeAndWait(tasks, 1);
    System.out.println("Searching [States (" + results[0] + " results, Occur.SHOULD, Cold)] in " + FEEDS + " Feeds took: " + l1 + "ms");

    /* Recreate */
    Owl.getPersistenceService().recreateSchema();
    fModelSearch.shutdown();
    fModelSearch.startup();
    saveFeedsHelper();

    /* Query 2: Entire News contains 'news' */
    task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.CONTAINS, "news"));

        results[0] = fModelSearch.searchNews(conditions, false).size();

        return Status.OK_STATUS;
      }
    };
    tasks.clear();
    tasks.add(task);
    System.gc();
    long l2 = TestUtils.executeAndWait(tasks, 1);
    System.out.println("Searching [Entire News (" + results[0] + " results, Occur.SHOULD, Cold)] in " + FEEDS + " Feeds took: " + l2 + "ms");

    /* Recreate */
    Owl.getPersistenceService().recreateSchema();
    fModelSearch.shutdown();
    fModelSearch.startup();
    saveFeedsHelper();

    /*
     * Query 3: Title contains 'news' OR Author contains 's*' OR Category begins
     * with 'e'
     */
    task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(INews.TITLE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.CONTAINS, "news"));

        ISearchField field2 = factory.createSearchField(INews.AUTHOR, INews.class.getName());
        conditions.add(factory.createSearchCondition(field2, SearchSpecifier.CONTAINS, "s*"));

        ISearchField field3 = factory.createSearchField(INews.CATEGORIES, INews.class.getName());
        conditions.add(factory.createSearchCondition(field3, SearchSpecifier.BEGINS_WITH, "e"));

        results[0] = fModelSearch.searchNews(conditions, false).size();

        return Status.OK_STATUS;
      }
    };
    tasks.clear();
    tasks.add(task);
    System.gc();
    long l3 = TestUtils.executeAndWait(tasks, 1);
    System.out.println("Searching [Title, Author, Categories (" + results[0] + " results, Occur.SHOULD, Cold)] in " + FEEDS + " Feeds took: " + l3 + "ms");

    /* Recreate */
    Owl.getPersistenceService().recreateSchema();
    fModelSearch.shutdown();
    fModelSearch.startup();
    saveFeedsHelper();

    /*
     * Query 4: Title contains 'news' AND Author contains 's*' AND Category
     * begins with 'e'
     */
    task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(INews.TITLE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.CONTAINS, "news"));

        ISearchField field2 = factory.createSearchField(INews.AUTHOR, INews.class.getName());
        conditions.add(factory.createSearchCondition(field2, SearchSpecifier.CONTAINS, "s*"));

        ISearchField field3 = factory.createSearchField(INews.CATEGORIES, INews.class.getName());
        conditions.add(factory.createSearchCondition(field3, SearchSpecifier.BEGINS_WITH, "e"));

        results[0] = fModelSearch.searchNews(conditions, true).size();

        return Status.OK_STATUS;
      }
    };
    tasks.clear();
    tasks.add(task);
    System.gc();
    long l4 = TestUtils.executeAndWait(tasks, 1);
    System.out.println("Searching [Title, Author, Categories (" + results[0] + " results, Occur.MUST, Cold)] in " + FEEDS + " Feeds took: " + l4 + "ms");

    /* Recreate */
    Owl.getPersistenceService().recreateSchema();
    fModelSearch.shutdown();
    fModelSearch.startup();
    saveFeedsHelper();

    /* Query 5: Publish Date before Now AND After 2000 */
    task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(INews.PUBLISH_DATE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.IS_BEFORE, new Date()));

        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, 2000);

        ISearchField field2 = factory.createSearchField(INews.PUBLISH_DATE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field2, SearchSpecifier.IS_AFTER, cal.getTime()));

        results[0] = fModelSearch.searchNews(conditions, true).size();

        return Status.OK_STATUS;
      }
    };
    tasks.clear();
    tasks.add(task);
    System.gc();
    long l5 = TestUtils.executeAndWait(tasks, 1);
    System.out.println("Searching [Date Range (" + results[0] + " results, Occur.MUST, Cold)] in " + FEEDS + " Feeds took: " + l5 + "ms");

    /* Recreate */
    Owl.getPersistenceService().recreateSchema();
    fModelSearch.shutdown();
    fModelSearch.startup();
    saveFeedsHelper();

    /* Query 6: News is *new*, *unread*, *updated* and Has Attachments IS TRUE */
    task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(INews.STATE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, INews.State.UNREAD, INews.State.UPDATED)));

        ISearchField field4 = factory.createSearchField(INews.HAS_ATTACHMENTS, INews.class.getName());
        conditions.add(factory.createSearchCondition(field4, SearchSpecifier.IS, true));

        results[0] = fModelSearch.searchNews(conditions, false).size();

        return Status.OK_STATUS;
      }
View Full Code Here

  /*
   * @see org.rssowl.core.interpreter.INamespaceHandler#processElement(org.jdom.Element,
   * org.rssowl.core.model.types.IExtendableType)
   */
  public void processElement(Element element, IPersistable type) {
    IModelFactory factory = Owl.getModelFactory();

    /* Category */
    if ("category".equals(element.getName())) {

      /* Process Top-Category (Level 1) */
      processCategory(element, type);

      /* Look for Subcategories (Level 2) */
      List< ? > children = element.getChildren();
      for (Iterator< ? > iter = children.iterator(); iter.hasNext();) {
        Element child = (Element) iter.next();
        if ("category".equals(child.getName()))
          processCategory(child, type);
      }
    }

    /* Author */
    else if ("author".equals(element.getName())) {
      IPerson person = factory.createPerson(null, type);
      person.setName(element.getText());
    }
  }
View Full Code Here

      person.setName(element.getText());
    }
  }

  private void processCategory(Element element, IPersistable type) {
    IModelFactory factory = Owl.getModelFactory();

    ICategory category = factory.createCategory(null, (IEntity) type);
    List< ? > attributes = element.getAttributes();
    for (Iterator< ? > iter = attributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName();
View Full Code Here

    /* Update Size */
    updateSize();
  }

  private ISearchCondition getDefaultCondition() {
    IModelFactory factory = Owl.getModelFactory();

    ISearchField field = factory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
    ISearchCondition condition = factory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, ""); //$NON-NLS-1$

    return condition;
  }
View Full Code Here

    return item;
  }

  private void createConditionMenu(Menu menu, SearchConditionItem item) {
    IModelFactory factory = Owl.getModelFactory();
    String news = INews.class.getName();

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(IEntity.ALL_FIELDS)) {
      MenuItem mItem = new MenuItem(menu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_ENTIRE_NEWS);
      hookSelectionListener(mItem, item, factory.createSearchField(IEntity.ALL_FIELDS, news));

      new MenuItem(menu, SWT.SEPARATOR);
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.STATE)) {
      MenuItem mItem = new MenuItem(menu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_STATE);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.STATE, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.LOCATION)) {
      MenuItem mItem = new MenuItem(menu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_LOCATION);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.LOCATION, news));

      new MenuItem(menu, SWT.SEPARATOR);
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.TITLE)) {
      MenuItem mItem = new MenuItem(menu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_TITLE);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.TITLE, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.DESCRIPTION)) {
      MenuItem mItem = new MenuItem(menu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_DESCRIPTION);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.DESCRIPTION, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.AUTHOR)) {
      MenuItem mItem = new MenuItem(menu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_AUTHOR);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.AUTHOR, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.CATEGORIES)) {
      MenuItem mItem = new MenuItem(menu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_CATEGORY);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.CATEGORIES, news));
    }

    MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
    mItem.setText(Messages.SearchConditionList_DATE);

    Menu dateMenu = new Menu(mItem);
    mItem.setMenu(dateMenu);

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.AGE_IN_DAYS)) {
      mItem = new MenuItem(dateMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_AGE);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.AGE_IN_DAYS, news));

      new MenuItem(dateMenu, SWT.SEPARATOR);
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.MODIFIED_DATE)) {
      mItem = new MenuItem(dateMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_DATE_MODIFIED);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.MODIFIED_DATE, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.PUBLISH_DATE)) {
      mItem = new MenuItem(dateMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_DATE_PUBLISHED);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.PUBLISH_DATE, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.RECEIVE_DATE)) {
      mItem = new MenuItem(dateMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_DATE_RECEIVED);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.RECEIVE_DATE, news));
    }

    mItem = new MenuItem(menu, SWT.SEPARATOR);

    mItem = new MenuItem(menu, SWT.CASCADE);
    mItem.setText(Messages.SearchConditionList_OTHER);

    Menu otherMenu = new Menu(mItem);
    mItem.setMenu(otherMenu);

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.HAS_ATTACHMENTS)) {
      mItem = new MenuItem(otherMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_HAS_ATTACHMENTS);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.HAS_ATTACHMENTS, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.ATTACHMENTS_CONTENT)) {
      mItem = new MenuItem(otherMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_ATTACHMENT);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.ATTACHMENTS_CONTENT, news));
    }

    new MenuItem(otherMenu, SWT.SEPARATOR);

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.SOURCE)) {
      mItem = new MenuItem(otherMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_SOURCE);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.SOURCE, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.LINK)) {
      mItem = new MenuItem(otherMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_LINK);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.LINK, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.IS_FLAGGED)) {
      mItem = new MenuItem(otherMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_IS_STICKY);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.IS_FLAGGED, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.FEED)) {
      mItem = new MenuItem(otherMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_FEED);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.FEED, news));
    }

    if (fFieldsToExclude == null || !fFieldsToExclude.contains(INews.LABEL)) {
      mItem = new MenuItem(otherMenu, SWT.PUSH);
      mItem.setText(Messages.SearchConditionList_LABEL);
      hookSelectionListener(mItem, item, factory.createSearchField(INews.LABEL, news));
    }
  }
View Full Code Here

    OwlUI.adjustSizeForScrollbar(getShell(), getVerticalBar(), wasScrollbarShowing);
  }

  private ISearchCondition createCondition(ISearchCondition current) {
    IModelFactory factory = Owl.getModelFactory();
    ISearchField field = factory.createSearchField(current.getField().getId(), current.getField().getEntityName());
    return factory.createSearchCondition(field, current.getSpecifier(), ""); //$NON-NLS-1$
  }
View Full Code Here

   */
  public ISearchCondition toScopeCondition() {
    ISearchCondition condition = null;
    Long[][] selection = getSelection();
    if (selection != null) {
      IModelFactory factory = Owl.getModelFactory();
      ISearchField field = factory.createSearchField(INews.LOCATION, INews.class.getName());
      condition = factory.createSearchCondition(field, SearchSpecifier.SCOPE, selection);
    }

    return condition;
  }
View Full Code Here

   * @see org.eclipse.jface.wizard.Wizard#performFinish()
   */
  @Override
  public boolean performFinish() {
    String name = fPage.getFolderName();
    IModelFactory factory = Owl.getModelFactory();

    /* Require Name */
    if (!StringUtils.isSet(name)) {
      fPage.setErrorMessage(Messages.FolderWizard_ENTER_NAME);
      fPage.focusInput();
      return false;
    }

    /* Get the parent Folder */
    IFolder parent = fPage.getFolder();

    /* Create the Folder */
    IFolder folder = factory.createFolder(null, parent, name);

    /* Copy all Properties from Parent into this Mark */
    if (parent != null) {
      Map<String, Serializable> properties = parent.getProperties();
      for (Map.Entry<String, Serializable> property : properties.entrySet())
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.IModelFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.