Examples of IEntity


Examples of org.rssowl.core.persist.IEntity

  public boolean performOk(Set<IEntity> entitiesToSave) {

    /* Update this Entity */
    for (IPreferenceScope scope : fEntityPreferences) {
      if (updatePreferences(scope)) {
        IEntity entityToSave = fEntities.get(fEntityPreferences.indexOf(scope));
        entitiesToSave.add(entityToSave);
        fSettingsChanged = true;
      }
    }

View Full Code Here

Examples of org.rssowl.core.persist.IEntity

    return feeds;
  }

  private void accessAllFields(IPersistable type) {
    if (type instanceof IEntity) {
      IEntity entity = (IEntity) type;
      entity.getId();
      Map<String, ?> properties = entity.getProperties();
      if (properties != null) {
        Set<String> keys = properties.keySet();
        for (String string : keys)
          properties.get(string);
      }
View Full Code Here

Examples of org.rssowl.core.persist.IEntity

      else if (obj instanceof INews || obj instanceof NewsReference)
        news.add(getId(obj));
      else if (obj instanceof EntityGroup) {
        List<EntityGroupItem> items = ((EntityGroup) obj).getItems();
        for (EntityGroupItem item : items) {
          IEntity entity = item.getEntity();
          if (entity instanceof INews)
            news.add(getId(entity));
        }
      }
    }
View Full Code Here

Examples of org.rssowl.core.persist.IEntity

   */
  public Object getParent(Object element) {

    /* Handle Grouping specially */
    if (fBookmarkGrouping.isActive() && element instanceof IEntity) {
      IEntity entity = (IEntity) element;
      EntityGroup[] groups = fBookmarkGrouping.group(Collections.singletonList(entity));
      if (groups.length == 1)
        return groups[0];
    }

View Full Code Here

Examples of org.rssowl.core.persist.IEntity

    return value;
  }

  private void processOutline(Element outline, IPersistable parent, List<IEntity> importedEntities, DateFormat dateFormat) {
    IEntity type = null;
    Long id = null;
    String title = null;
    String link = null;
    String homepage = null;
    String description = null;

    /* Interpret Attributes */
    List<?> attributes = outline.getAttributes();
    for (Iterator<?> iter = attributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName();

      /* Link */
      if (name.toLowerCase().equals(Attributes.XML_URL.get().toLowerCase()))
        link = attribute.getValue();

      /* Title */
      else if (name.toLowerCase().equals(Attributes.TITLE.get()))
        title = attribute.getValue();

      /* Text */
      else if (title == null && name.toLowerCase().equals(Attributes.TEXT.get()))
        title = attribute.getValue();

      /* Homepage */
      else if (name.toLowerCase().equals(Attributes.HTML_URL.get().toLowerCase()))
        homepage = attribute.getValue();

      /* Description */
      else if (name.toLowerCase().equals(Attributes.DESCRIPTION.get()))
        description = attribute.getValue();
    }

    /* RSSOwl Namespace Attributes */
    Attribute idAttribute = outline.getAttribute(Attributes.ID.get(), RSSOWL_NS);
    if (idAttribute != null)
      id = Long.valueOf(idAttribute.getValue());

    boolean isSet = Boolean.parseBoolean(outline.getAttributeValue(Attributes.IS_SET.get(), RSSOWL_NS));

    /* Outline is a Folder */
    if (link == null && title != null) {
      type = Owl.getModelFactory().createFolder(null, isSet ? null : (IFolder) parent, title);

      /* Assign old ID value */
      if (id != null)
        type.setProperty(ID_KEY, id);

      if (isSet)
        importedEntities.add(type);
    }

    /* Outline is a BookMark */
    else {
      URI uri = link != null ? URIUtils.createURI(link) : null;
      if (uri != null) {

        /* If no Scheme is Provided, use HTTP as default */
        if (uri.getScheme() == null)
          uri = URIUtils.createURI(URIUtils.HTTP + link);

        /* Create the BookMark */
        FeedLinkReference feedLinkRef = new FeedLinkReference(uri);
        type = Owl.getModelFactory().createBookMark(null, (IFolder) parent, feedLinkRef, title != null ? title : link);

        /* Assign old ID value */
        if (id != null)
          type.setProperty(ID_KEY, id);

        /* Store Description if set */
        if (StringUtils.isSet(description))
          type.setProperty(ITypeImporter.DESCRIPTION_KEY, description);

        /* Store Homepage if set */
        if (StringUtils.isSet(homepage))
          type.setProperty(ITypeImporter.HOMEPAGE_KEY, homepage);
      }
    }

    /* In case this Outline Element did not represent a Entity */
    if (type == null)
View Full Code Here

Examples of org.rssowl.core.persist.IEntity

    return getEntity(fIds.get(index));
  }

  public int indexOf(Object o) {
    if (o instanceof IEntity) {
      IEntity entity = (IEntity) o;
      if (entity.getId() != null)
        return fIds.indexOf(entity.getId());
    }
    return -1;
  }
View Full Code Here

Examples of org.rssowl.core.persist.IEntity

    return -1;
  }

  public int lastIndexOf(Object o) {
    if (o instanceof IEntity) {
      IEntity entity = (IEntity) o;
      if (entity.getId() != null)
        return fIds.lastIndexOf(entity.getId());
    }
    return -1;
  }
View Full Code Here

Examples of org.rssowl.core.persist.IEntity

      return true;

    if ((obj == null) || (obj.getClass() != getClass()))
      return false;

    IEntity type = (IEntity) obj;
    if (fId == null || type.getId() == null)
      return false;

    return fId.equals(type.getId());
  }
View Full Code Here

Examples of org.rssowl.core.persist.IEntity

    eventRegistry.deleting().addListener(deletingListener);
    eventRegistry.deleted().addListener(deletedListener);
  }

  private void processActivated(EventArgs args) {
    IEntity entity = getEntity(args);
    if (entity == null)
      return;

    if (entity instanceof News)
      ((News) entity).init();
View Full Code Here

Examples of org.rssowl.core.persist.IEntity

  private void initBookMark(BookMark entity) {
    entity.setNewsCounter(getNewsCounterDAO().load());
  }

  private void processUpdatedEvent(EventArgs args) {
    IEntity entity = getEntity(args);
    if (entity == null)
      return;

    ModelEvent event = createModelEvent(entity);
    if (event != null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.