Package net.pterodactylus.sone.database

Examples of net.pterodactylus.sone.database.PostBuilder


          /* TODO - mark Sone as bad. */
          logger.log(Level.WARNING, String.format("Downloaded post for Sone %s with missing data! ID: %s, Time: %s, Text: %s", sone, postId, postTime, postText));
          return null;
        }
        try {
          PostBuilder postBuilder = core.postBuilder();
          /* TODO - parse time correctly. */
          postBuilder.withId(postId).from(sone.getId()).withTime(Long.parseLong(postTime)).withText(postText);
          if ((postRecipientId != null) && (postRecipientId.length() == 43)) {
            postBuilder.to(postRecipientId);
          }
          posts.add(postBuilder.build());
        } catch (NumberFormatException nfe1) {
          /* TODO - mark Sone as bad. */
          logger.log(Level.WARNING, String.format("Downloaded post for Sone %s with invalid time: %s", sone, postTime));
          return null;
        }
View Full Code Here


      String postText = configuration.getStringValue(postPrefix + "/Text").getValue(null);
      if ((postTime == 0) || (postText == null)) {
        logger.log(Level.WARNING, "Invalid post found, aborting load!");
        return;
      }
      PostBuilder postBuilder = postBuilder().withId(postId).from(sone.getId()).withTime(postTime).withText(postText);
      if ((postRecipientId != null) && (postRecipientId.length() == 43)) {
        postBuilder.to(postRecipientId);
      }
      posts.add(postBuilder.build());
    }

    /* load replies. */
    Set<PostReply> replies = new HashSet<PostReply>();
    while (true) {
View Full Code Here

    checkArgument(text.trim().length() > 0, "text must not be empty");
    if (!sone.isLocal()) {
      logger.log(Level.FINE, String.format("Tried to create post for non-local Sone: %s", sone));
      return null;
    }
    PostBuilder postBuilder = database.newPostBuilder();
    postBuilder.from(sone.getId()).randomId().withTime(time).withText(text.trim());
    if (recipient.isPresent()) {
      postBuilder.to(recipient.get().getId());
    }
    final Post post = postBuilder.build();
    database.storePost(post);
    eventBus.post(new NewPostFoundEvent(post));
    sone.addPost(post);
    touchConfiguration();
    localElementTicker.schedule(new Runnable() {
View Full Code Here

TOP

Related Classes of net.pterodactylus.sone.database.PostBuilder

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.