Esempio n. 1
0
  /** Internal method: add links without updating the count */
  private boolean addLinksNoCount(String dbid, List<Link> links) throws Exception {
    if (links.size() == 0) return false;

    dbid += "assocs";
    for (Link l : links) {
      AssocVisibility av = AssocVisibility.values()[l.visibility];
      String s = "wormhole...";
      if (getAssocClient()
              .TaoAssocPut(
                  dbid.getBytes(),
                  l.link_type,
                  l.id1,
                  l.id2,
                  l.time,
                  av,
                  false,
                  Long.valueOf(l.version),
                  l.data,
                  s.getBytes(),
                  writeOptions)
          == 1) {
        logger.error("addLinksNoCount failed!");
        throw new RuntimeException("addLinksNoCount failed!");
      }
    }
    return true;
  }
Esempio n. 2
0
 private Link[] getLinkListImpl(
     String dbid,
     long id1,
     long link_type,
     long minTimestamp,
     long maxTimestamp,
     int offset,
     int limit)
     throws Exception {
   dbid += "assocs";
   List<TaoAssocGetResult> tr =
       getAssocClient()
           .TaoAssocRangeGet(
               dbid.getBytes(),
               link_type,
               id1,
               maxTimestamp,
               minTimestamp,
               Long.valueOf(offset),
               Long.valueOf(limit));
   Link results[] = new Link[tr.size()];
   int i = 0;
   for (TaoAssocGetResult tar : tr) {
     results[i] =
         new Link(
             id1,
             link_type,
             tar.getId2(),
             LinkStore.VISIBILITY_DEFAULT,
             tar.getData(),
             (int) (tar.getDataVersion()),
             tar.getTime());
     i++;
   }
   return results;
 }
Esempio n. 3
0
  private boolean addLinkImpl(String dbid, Link l, boolean noinverse) throws Exception {

    if (Level.DEBUG.isGreaterOrEqual(debuglevel)) {
      logger.debug("addLink " + l.id1 + "." + l.id2 + "." + l.link_type);
    }
    AssocVisibility av = AssocVisibility.values()[l.visibility];
    String s = "wormhole...";
    dbid += "assocs";
    return getAssocClient()
            .TaoAssocPut(
                dbid.getBytes(),
                l.link_type,
                l.id1,
                l.id2,
                l.time,
                av,
                true,
                Long.valueOf(l.version),
                l.data,
                s.getBytes(),
                writeOptions)
        == 1;
  }