Package org.rssowl.core.persist

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


  /*
   * @see java.util.List#indexOf(java.lang.Object)
   */
  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

  /*
   * @see java.util.List#lastIndexOf(java.lang.Object)
   */
  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

    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

    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

   */
  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

      else if (selection instanceof EntityGroup) {
        EntityGroup group = (EntityGroup) selection;
        List<EntityGroupItem> items = group.getItems();
        for (EntityGroupItem item : items) {
          IEntity entity = item.getEntity();
          if (entity instanceof IBookMark) {
            IBookMark bookMark = (IBookMark) entity;
            selectedBookMarks.add(bookMark);
          } else if (entity instanceof INews) {
            INews news = (INews) entity;
View Full Code Here

    /* Separate News */
    final List<INews> newsToDelete = new ArrayList<INews>();

    /* Extract News */
    for (Iterator<IEntity> it = entities.iterator(); it.hasNext();) {
      IEntity element = it.next();

      /* Separate News */
      if (element instanceof INews) {
        it.remove();
        newsToDelete.add((INews) element);
View Full Code Here

TOP

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

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.