Esempio n. 1
0
  public Opml export(User user) {
    Opml opml = new Opml();
    opml.setFeedType("opml_1.1");
    opml.setTitle(String.format("%s subscriptions in CommaFeed", user.getName()));
    opml.setCreated(new Date());

    List<FeedCategory> categories = feedCategoryDAO.findAll(user);
    Collections.sort(
        categories,
        (e1, e2) ->
            MoreObjects.firstNonNull(e1.getPosition(), 0)
                - MoreObjects.firstNonNull(e2.getPosition(), 0));

    List<FeedSubscription> subscriptions = feedSubscriptionDAO.findAll(user);
    Collections.sort(
        subscriptions,
        (e1, e2) ->
            MoreObjects.firstNonNull(e1.getPosition(), 0)
                - MoreObjects.firstNonNull(e2.getPosition(), 0));

    // export root categories
    for (FeedCategory cat :
        categories.stream().filter(c -> c.getParent() == null).collect(Collectors.toList())) {
      opml.getOutlines().add(buildCategoryOutline(cat, categories, subscriptions));
    }

    // export root subscriptions
    for (FeedSubscription sub :
        subscriptions.stream().filter(s -> s.getCategory() == null).collect(Collectors.toList())) {
      opml.getOutlines().add(buildSubscriptionOutline(sub));
    }

    return opml;
  }
Esempio n. 2
0
 private static void toStringHelper() {
   System.out.println(
       MoreObjects.toStringHelper(ObjectsDemo.class)
           .add("x", 1)
           .toString()); // Returns "ClassName{x=1}"
   System.out.println(
       MoreObjects.toStringHelper("MyObject").add("x", 1).toString()); // Returns "MyObject{x=1}"
 }
Esempio n. 3
0
 @Override
 public String toString() {
   if (IPV4_LEN == lsAttrLength) {
     return MoreObjects.toStringHelper(getClass())
         .omitNullValues()
         .add("ip4RouterId", ip4RouterId)
         .toString();
   } else {
     return MoreObjects.toStringHelper(getClass())
         .omitNullValues()
         .add("ip6RouterId", ip6RouterId)
         .toString();
   }
 }
  @Override
  public String toString() {
    ToStringHelper stringHelper =
        MoreObjects.toStringHelper(getClass()).add("id", getId()).add("requests", getRequests());

    return stringHelper.toString();
  }
Esempio n. 5
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("frequency", frequency)
       .add("reporters", reporters)
       .toString();
 }
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("equivalenceRatio", equivalenceRatio)
       .add("voltage", voltage)
       .toString();
 }
Esempio n. 7
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(getClass().getSimpleName() + "." + name())
       .add("annualRate", annualRate)
       .add("duration", duration())
       .toString();
 }
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("channelId", channelId)
       .add("securityPolicy", securityPolicy)
       .toString();
 }
Esempio n. 9
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(getClass())
       .omitNullValues()
       .add("ip6RouterId", ip6RouterId)
       .toString();
 }
Esempio n. 10
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("hostname", hostname)
       .add("domainname", domainname)
       .add("username", user)
       .add("attachStdin", attachStdin)
       .add("attachStdout", attachStdout)
       .add("attachStderr", attachStderr)
       .add("portSpecs", portSpecs)
       .add("exposedPorts", exposedPorts)
       .add("tty", tty)
       .add("openStdin", openStdin)
       .add("stdinOnce", stdinOnce)
       .add("env", env)
       .add("cmd", cmd)
       .add("image", image)
       .add("volumes", volumes)
       .add("workingDir", workingDir)
       .add("entrypoint", entrypoint)
       .add("networkDisabled", networkDisabled)
       .add("onBuild", onBuild)
       .add("labels", labels)
       .add("macAddress", macAddress)
       .add("hostConfig", hostConfig)
       .add("stopSignal", stopSignal)
       .toString();
 }
Esempio n. 11
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("code", getStatusCode())
       .add("message", getStatusMessage())
       .toString();
 }
Esempio n. 12
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(Attribute.class)
       .add("name", name)
       .add("value", value)
       .toString();
 }
Esempio n. 13
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this.getClass())
       .add("propertiesOne", propertiesOne)
       .add("propertiesTwo", propertiesTwo)
       .toString();
 }
Esempio n. 14
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(getClass())
       .omitNullValues()
       .add("linkStateRequests", linkStateRequests)
       .toString();
 }
Esempio n. 15
0
 @Override
 public final String toString() {
   return MoreObjects.toStringHelper(this)
       .add("indexName", indexName)
       .add("documentType", documentType)
       .toString();
 }
  private <T> void evaluateBundle(
      final AppliedPTransform<?, ?, ?> transform,
      final CommittedBundle<T> bundle,
      final CompletionCallback onComplete) {
    TransformExecutorService transformExecutor;

    if (isKeyed(bundle.getPCollection())) {
      final StepAndKey stepAndKey = StepAndKey.of(transform, bundle.getKey());
      // This executor will remain reachable until it has executed all scheduled transforms.
      // The TransformExecutors keep a strong reference to the Executor, the ExecutorService keeps
      // a reference to the scheduled TransformExecutor callable. Follow-up TransformExecutors
      // (scheduled due to the completion of another TransformExecutor) are provided to the
      // ExecutorService before the Earlier TransformExecutor callable completes.
      transformExecutor = executorServices.getUnchecked(stepAndKey);
    } else {
      transformExecutor = parallelExecutorService;
    }

    Collection<ModelEnforcementFactory> enforcements =
        MoreObjects.firstNonNull(
            transformEnforcements.get(transform.getTransform().getClass()),
            Collections.<ModelEnforcementFactory>emptyList());

    TransformExecutor<T> callable =
        TransformExecutor.create(
            evaluationContext,
            registry,
            enforcements,
            bundle,
            transform,
            onComplete,
            transformExecutor);
    outstandingWork.incrementAndGet();
    transformExecutor.schedule(callable);
  }
Esempio n. 17
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("types", Arrays.toString(types))
       .add("alpha", Arrays.toString(alpha))
       .toString();
 }
Esempio n. 18
0
 public final String toString() {
   return MoreObjects.toStringHelper(this)
       .add("docID", docID())
       .add("responseSets", responseSets())
       .add("incomplete", incompleteResponses())
       .toString();
 }
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(UntargettedBinding.class)
       .add("key", getKey())
       .add("source", getSource())
       .toString();
 }
Esempio n. 20
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("relations", relations)
       .add("distinct", distinct)
       .toString();
 }
Esempio n. 21
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper("TestObject")
       .add("group", group)
       .add("item", item)
       .toString();
 }
Esempio n. 22
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("accountSid", accountSid)
       .add("addressRequirements", addressRequirements)
       .add("apiVersion", apiVersion)
       .add("beta", beta)
       .add("capabilities", capabilities)
       .add("dateCreated", dateCreated)
       .add("dateUpdated", dateUpdated)
       .add("friendlyName", friendlyName)
       .add("phoneNumber", phoneNumber)
       .add("sid", sid)
       .add("smsApplicationSid", smsApplicationSid)
       .add("smsFallbackMethod", smsFallbackMethod)
       .add("smsFallbackUrl", smsFallbackUrl)
       .add("smsMethod", smsMethod)
       .add("smsUrl", smsUrl)
       .add("statusCallback", statusCallback)
       .add("statusCallbackMethod", statusCallbackMethod)
       .add("trunkSid", trunkSid)
       .add("uri", uri)
       .add("voiceApplicationSid", voiceApplicationSid)
       .add("voiceCallerIdLookup", voiceCallerIdLookup)
       .add("voiceFallbackMethod", voiceFallbackMethod)
       .add("voiceFallbackUrl", voiceFallbackUrl)
       .add("voiceMethod", voiceMethod)
       .add("voiceUrl", voiceUrl)
       .toString();
 }
Esempio n. 23
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("currentTerm", currentTerm)
       .add("votedFor", votedFor)
       .toString();
 }
Esempio n. 24
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(getClass())
       .add("schedule", schedule)
       .add("state", state)
       .toString();
 }
 public long calculate(
     DefaultIssue issue, Collection<IssueChangeDto> debtChangelog, Period period) {
   if (issue.creationDate().getTime() > period.getSnapshotDate() + 1000L) {
     return MoreObjects.firstNonNull(issue.effortInMinutes(), 0L);
   }
   return calculateFromChangelog(issue, debtChangelog, period.getSnapshotDate());
 }
Esempio n. 26
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("tokens", tokens)
       .add("super", super.toString())
       .toString();
 }
Esempio n. 27
0
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("descripcion", descripcion)
       .add("valor", valor)
       .toString();
 }
Esempio n. 28
0
  @Override
  public List<Record> apply(RevisionResource rsrc, Input input) throws AuthException, OrmException {
    if (input == null) {
      input = new Input();
    }
    if (input.rule != null && !rules.isProjectRulesEnabled()) {
      throw new AuthException("project rules are disabled");
    }
    input.filters = MoreObjects.firstNonNull(input.filters, filters);
    SubmitRuleEvaluator evaluator =
        new SubmitRuleEvaluator(changeDataFactory.create(db.get(), rsrc.getControl()));

    List<SubmitRecord> records =
        evaluator
            .setPatchSet(rsrc.getPatchSet())
            .setLogErrors(false)
            .setSkipSubmitFilters(input.filters == Filters.SKIP)
            .setRule(input.rule)
            .evaluate();
    List<Record> out = Lists.newArrayListWithCapacity(records.size());
    AccountLoader accounts = accountInfoFactory.create(true);
    for (SubmitRecord r : records) {
      out.add(new Record(r, accounts));
    }
    if (!out.isEmpty()) {
      out.get(0).prologReductionCount = evaluator.getReductionsConsumed();
    }
    accounts.fill();
    return out;
  }
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(this)
       .add("logTime", this.logTime)
       .add("logDesc", this.logDescription)
       .toString();
 }
 @Override
 public String toString() {
   return MoreObjects.toStringHelper(getClass())
       .add("sender", sender)
       .add("totalEntries", digest.size())
       .toString();
 }