Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IFilterAction


    ISearchFilter filter = fFactory.createSearchFilter(null, search, "All News in BM2");
    filter.setMatchAllNews(true);
    filter.setEnabled(true);

    IFilterAction action = fFactory.createFilterAction(MARK_READ_ID);
    filter.addAction(action);

    DynamicDAO.save(filter);

    fAppService.handleFeedReload(bm1, feed, null, false, true, new NullProgressMonitor());
View Full Code Here


    ISearchFilter filter = fFactory.createSearchFilter(null, null, "All News");
    filter.setMatchAllNews(true);
    filter.setEnabled(true);

    IFilterAction action = fFactory.createFilterAction(MOVE_NEWS_ID);
    action.setData(new Long[] { bin.getId() + 1 });
    filter.addAction(action);

    DynamicDAO.save(filter);

    fAppService.handleFeedReload(bm, feed, null, false, true, new NullProgressMonitor());
View Full Code Here

  }

  IFilterAction createFilterAction(boolean ignoreEmpty) {
    IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();
    NewsActionDescriptor descriptor = (NewsActionDescriptor) selection.getFirstElement();
    IFilterAction filterAction = fFactory.createFilterAction(descriptor.getActionId());
    if (fShowingPresentation != null) {
      Object data = fShowingPresentation.getData();
      if (data != null)
        filterAction.setData(data);
      else if (ignoreEmpty) //Action was not fully specified
        return null;
    }

    return filterAction;
View Full Code Here

    for (int i = 0; i < actions.size(); i++) {
      Element action = (Element) actions.get(i);
      String id = action.getAttributeValue(Attributes.ID.get());
      String data = action.getAttributeValue(Attributes.DATA.get());

      IFilterAction filterAction = factory.createFilterAction(id);
      if (data != null) {

        /* Special case Label Action */
        if (LabelNewsAction.ID.equals(id)) {
          Long labelId = Long.parseLong(data);
          filterAction.setData(labelId);
        }

        /* Special case Move/Copy Action */
        else if (MoveNewsAction.ID.equals(id) || CopyNewsAction.ID.equals(id)) {
          String[] binIds = data.split(OPMLConstants.SEPARATOR);
          Long[] binIdsLong = new Long[binIds.length];
          for (int j = 0; j < binIds.length; j++) {
            binIdsLong[j] = Long.parseLong(binIds[j]);
          }

          filterAction.setData(binIdsLong);
        }

        /* Any other Action */
        else {
          filterAction.setData(data);
        }
      }

      /* Look for Action Properties */
      else {
        List<?> actionProperties = action.getChildren(Tag.ACTION_PROPERTY.get(), RSSOWL_NS);
        if (!actionProperties.isEmpty()) {
          Properties properties = new Properties();
          for (Object actionProperty : actionProperties) {
            Element actionPropertyElement = (Element) actionProperty;
            String key = actionPropertyElement.getAttributeValue(Attributes.ID.get());
            String value = actionPropertyElement.getAttributeValue(Attributes.VALUE.get());

            properties.setProperty(key, value);
          }

          filterAction.setData(properties);
        }
      }

      filter.addAction(filterAction);
    }
View Full Code Here

    /* 6) Match All News - Enabled - Label News */
    filter = fFactory.createSearchFilter(null, null, "Filter 6");
    filter.setMatchAllNews(true);
    filter.setOrder(5);
    IFilterAction action = fFactory.createFilterAction(LabelNewsAction.ID);
    action.setData(fImportantLabel.getId());
    filter.addAction(action);
    DynamicDAO.save(filter);

    /* 7) Match All News - Enabled - Label News + Move News + Play Sound */
    filter = fFactory.createSearchFilter(null, null, "Filter 7");
    filter.setMatchAllNews(true);
    filter.setOrder(5);
    action = fFactory.createFilterAction(LabelNewsAction.ID);
    action.setData(fImportantLabel.getId());
    filter.addAction(action);

    action = fFactory.createFilterAction(MoveNewsAction.ID);
    action.setData(new Long[] { fNewsBin.getId() });
    filter.addAction(action);

    action = fFactory.createFilterAction("org.rssowl.ui.PlaySoundAction");
    action.setData("C:\\ProgramData\\Microsoft\\Windows & Help\\Start Menu");
    filter.addAction(action);

    DynamicDAO.save(filter);

    /* 8) Filter with Properties as Data */
    filter = fFactory.createSearchFilter(null, null, "Filter 8");
    filter.setMatchAllNews(true);
    filter.setOrder(5);

    action = fFactory.createFilterAction("org.rssowl.ui.PlaySoundAction");
    Properties props = new Properties();
    props.setProperty("foo", "bar");
    props.setProperty("hello world", " world hello ");
    props.setProperty("<some xml>tags</a>", "foo & bar");
    action.setData(props);
    filter.addAction(action);

    DynamicDAO.save(filter);

    /* 9) Location is DELETED - Enabled - Mark Read */
 
View Full Code Here

TOP

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

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.