Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IPerson


  /**
   * Tests {@link MergeUtils#merge(org.rssowl.core.persist.MergeCapable, org.rssowl.core.persist.MergeCapable)}.
   */
  @Test
  public void testSingleItemMergeWithNullDestination() {
    IPerson person = new Person(null);
    ComplexMergeResult<IPerson> mergeResult = MergeUtils.merge(null, person);
    assertEquals(person, mergeResult.getMergedObject());
    assertEquals(true, mergeResult.isStructuralChange());
  }
View Full Code Here


  /**
   * Tests {@link MergeUtils#merge(org.rssowl.core.persist.MergeCapable, org.rssowl.core.persist.MergeCapable)}.
   */
  @Test
  public void testSingleItemMergeWithNonNullDestinationAndNullOrigin() {
    IPerson person = new Person(null);
    ComplexMergeResult<IPerson> mergeResult = MergeUtils.merge(person, null);
    assertNull(mergeResult.getMergedObject());
    assertEquals(true, mergeResult.isStructuralChange());
  }
View Full Code Here

      }

      else if ("reporter".equals(name)) { //$NON-NLS-1$
        URI uri = URIUtils.createURI(child.getText());
        if (uri != null) {
          IPerson person = Owl.getModelFactory().createPerson(null, feed);
          person.setEmail(uri);
        }
      }

      /* Bug-ID */
      else if ("bug_id".equals(name)) { //$NON-NLS-1$
View Full Code Here

      /* Who */
      else if ("who".equals(name)) { //$NON-NLS-1$
        URI uri = URIUtils.createURI(child.getText());
        if (uri != null) {
          IPerson person = Owl.getModelFactory().createPerson(null, news);
          person.setEmail(uri);
        }
        news.setTitle("Comment from " + child.getText());
      }

      /* Date of the comment */
 
View Full Code Here

      source.getName();
      source.getLink();
    }

    else if (type instanceof IPerson) {
      IPerson person = (IPerson) type;
      person.getEmail();
      person.getName();
      person.getUri();
    }

    else if (type instanceof IImage) {
      IImage image = (IImage) type;
      image.getDescription();
View Full Code Here

        category.setName(attribute.getValue());
    }
  }

  private void processAuthor(Element element, IPersistable type) {
    IPerson person = Owl.getModelFactory().createPerson(null, type);

    /* Check wether the Attributes are to be processed by a Contribution */
    processNamespaceAttributes(element, person);

    /* Interpret Children */
    List< ? > personChilds = element.getChildren();
    for (Iterator< ? > iter = personChilds.iterator(); iter.hasNext();) {
      Element child = (Element) iter.next();
      String name = child.getName().toLowerCase();

      /* Check wether this Element is to be processed by a Contribution */
      if (processElementExtern(child, person))
        continue;

      /* Name */
      else if ("name".equals(name)) { //$NON-NLS-1$
        person.setName(child.getText());
        processNamespaceAttributes(child, person);
      }

      /* EMail */
      else if ("email".equals(name)) { //$NON-NLS-1$
        URI uri = URIUtils.createURI(child.getText());
        if (uri != null)
          person.setEmail(uri);
        processNamespaceAttributes(child, person);
      }

      /* URI */
      else if ("uri".equals(name)) { //$NON-NLS-1$
        URI uri = URIUtils.createURI(child.getText());
        if (uri != null)
          person.setUri(uri);
        processNamespaceAttributes(child, person);
      }
    }
  }
View Full Code Here

        ((INews) type).setPublishDate(DateUtils.parseDate(element.getText()));
    }

    /* Creator / Publisher */
    else if ("creator".equals(name) || "publisher".equals(name)) { //$NON-NLS-1$ //$NON-NLS-2$
      IPerson person = Owl.getModelFactory().createPerson(null, type);
      person.setName(element.getText());
    }

    /* Language */
    else if ("language".equals(name) && type instanceof IFeed) //$NON-NLS-1$
      ((IFeed) type).setLanguage(element.getText());
View Full Code Here

    /* Group Input */
    int nextId = Group.UNKNOWN_AUTHOR.ordinal() + AUTHOR_ID_BEGIN;
    for (Object object : input) {
      if (object instanceof INews) {
        INews news = (INews) object;
        IPerson author = news.getAuthor();
        EntityGroup group = gDefault;

        if (author != null) {
          String name = author.getName();
          if (!StringUtils.isSet(name))
            name = Group.UNKNOWN_AUTHOR.getName();

          group = groupCache.get(name);
          if (group == null) {
View Full Code Here

  public static boolean isAuthorChange(Set< ? extends ModelEvent> events) {
    for (ModelEvent modelEvent : events) {
      if (modelEvent instanceof NewsEvent) {
        NewsEvent event = (NewsEvent) modelEvent;

        IPerson oldAuthor = event.getOldNews() != null ? event.getOldNews().getAuthor() : null;
        IPerson newAuthor = event.getEntity().getAuthor();

        if (newAuthor != null && !newAuthor.equals(oldAuthor))
          return true;
        else if (oldAuthor != null && !oldAuthor.equals(newAuthor))
          return true;
      }
    }
View Full Code Here

          Date date = DateUtils.getRecentDate(news);
          text = fDateFormat.format(date);
          break;

        case NewsTableControl.COL_AUTHOR:
          IPerson author = news.getAuthor();
          if (author != null) {
            if (author.getName() != null)
              text = author.getName();
            else if (author.getEmail() != null)
              text = author.getEmail().toString();
          }
          break;

        case NewsTableControl.COL_CATEGORY:
          List<ICategory> categories = news.getCategories();
View Full Code Here

TOP

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

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.