if (roots.isEmpty())
return;
IFolder root = roots.iterator().next();
IModelFactory factory = Owl.getModelFactory();
String newsEntityName = INews.class.getName();
/* SearchCondition: New and Updated News */
{
ISearchMark mark = factory.createSearchMark(null, root, Messages.ImportWizard_NEW_UPDATED_NEWS);
mark.setMatchAllConditions(true);
ISearchField field1 = factory.createSearchField(INews.STATE, newsEntityName);
factory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, INews.State.UPDATED));
}
/* SearchCondition: Recent News */
{
ISearchMark mark = factory.createSearchMark(null, root, Messages.ImportWizard_RECENT_NEWS);
mark.setMatchAllConditions(true);
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, root, Messages.ImportWizard_NEWS_WITH_ATTACHMENTS);
mark.setMatchAllConditions(true);
ISearchField field = factory.createSearchField(INews.HAS_ATTACHMENTS, newsEntityName);
factory.createSearchCondition(null, mark, field, SearchSpecifier.IS, true);
}
/* SearchCondition: Sticky News */
{
ISearchMark mark = factory.createSearchMark(null, root, Messages.ImportWizard_STICKY_NEWS);
mark.setMatchAllConditions(true);
ISearchField field = factory.createSearchField(INews.IS_FLAGGED, newsEntityName);
factory.createSearchCondition(null, mark, field, SearchSpecifier.IS, true);
}
/* SearchCondition: News is Labeld */
{
ISearchMark mark = factory.createSearchMark(null, root, Messages.ImportWizard_LABELED_NEWS);
IPreferenceScope preferences = Owl.getPreferenceService().getEntityScope(mark);
preferences.putInteger(DefaultPreferences.BM_NEWS_GROUPING, NewsGrouping.Type.GROUP_BY_LABEL.ordinal());
ISearchField field = factory.createSearchField(INews.LABEL, newsEntityName);
factory.createSearchCondition(null, mark, field, SearchSpecifier.IS, "*"); //$NON-NLS-1$
}
DynamicDAO.save(root);
}