Examples of CompoundKey


Examples of com.antlersoft.odb.CompoundKey

    return result;
  }
 
  static Comparable makeBundleKey( DBAssembly assembly, String name)
  {
    return new CompoundKey( new ObjectRefKey(assembly), name);
  }
View Full Code Here

Examples of com.antlersoft.odb.CompoundKey

  public static FileInclusion get( IndexObjectDB db, IncludeFile included,
                   SourceFile from, int line)
  {
    FileInclusion fi=(FileInclusion)db.findObject( UNIQUE_KEY,
      new CompoundKey( new ObjectRefKey( included),
               new ObjectRefKey( from)));
    if ( fi==null)
      fi=new FileInclusion( included, from, line);
    else
    {
View Full Code Here

Examples of com.antlersoft.odb.CompoundKey

  static class InclusionKeyGenerator implements KeyGenerator
  {
    public Comparable generateKey( Object o)
    {
      FileInclusion fi=(FileInclusion)o;
      return new CompoundKey(
                  new ObjectRefKey( fi.m_included_file),
                  new ObjectRefKey( fi.m_file));
    }
View Full Code Here

Examples of com.antlersoft.odb.CompoundKey

    return m_entry.getReferenced();
  }

  static void update( IndexObjectDB db, TranslationUnit unit, Persistent entry)
  {
    UnitEntry ue=(UnitEntry)db.findObject( COMBINED_INDEX_NAME, new
                  CompoundKey( new ObjectRefKey( unit),
                         new ObjectRefKey( entry)));
    if ( ue==null)
      ue=new UnitEntry( unit, entry);
    else
View Full Code Here

Examples of com.antlersoft.odb.CompoundKey

  static class CombinedGenerator implements KeyGenerator
  {
    public Comparable generateKey( Object o)
    {
      UnitEntry ue=(UnitEntry)o;
      return new CompoundKey( new ObjectRefKey( ue.m_unit),
                  new ObjectRefKey( ue.m_entry));
    }
View Full Code Here

Examples of com.linkedin.restli.common.CompoundKey

  }

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestAssociationsSubBuilderDataProvider")
  public void testGetWithAssociationKey(RootBuilderWrapper<CompoundKey, Message> builders) throws Exception
  {
    CompoundKey key = new CompoundKey();
    key.append("src", key1());
    key.append("dest", key2());

    Request<Message> request = builders.get().id(key).build();
    Message response = REST_CLIENT.sendRequest(request).get().getEntity();
    Assert.assertNotNull(response);
    Assert.assertEquals(response.getId(), key.getPart("src") + " " + key.getPart("dest"), "Message should be key1 + ' ' + key2 for associationKey(key1,key2)");
  }
View Full Code Here

Examples of com.linkedin.restli.common.CompoundKey

  public static int purge(AlbumEntryDatabase db, Long albumId, Long photoId)
  {
    // purge 1 entry
    if (albumId != null && photoId != null)
    {
      CompoundKey key = new CompoundKey().append("photoId", photoId).append("albumId", albumId);
      final boolean isRemoved = (db.getData().remove(key) != null);
      return isRemoved ? 1 : 0;
    }

    // purge all
    if (albumId == null && photoId == null)
    {
      final int numPurged = db.getData().size();
      db.getData().clear();
      return numPurged;
    }

    // purge all matching one of key id, photo id
    Iterator<CompoundKey> it = db.getData().keySet().iterator();
    String partName;
    long compareId;
    if (albumId != null)
    {
      partName = "albumId";
      compareId = albumId;
    }
    else if (photoId != null)
    {
      partName = "photoId";
      compareId = photoId;
    }
    else
      throw new AssertionError();

    int numPurged = 0;
    while (it.hasNext())
    {
      CompoundKey key = it.next();
      if (key.getPart(partName).equals(compareId))
      {
        it.remove();
        numPurged++;
      }
    }
View Full Code Here

Examples of com.linkedin.restli.common.CompoundKey

                                 @Optional @QueryParam("photoId") Long photoId)
  {
    List<AlbumEntry> result = new ArrayList<AlbumEntry>();
    for (Map.Entry<CompoundKey, AlbumEntry> entry : _db.getData().entrySet())
    {
      CompoundKey key = entry.getKey();
      // if the id is null, don't do any filtering by that id
      // (treat all values as a match)
      if (albumId != null && !key.getPart("albumId").equals(albumId))
        continue;
      if (photoId != null && !key.getPart("photoId").equals(photoId))
        continue;
      result.add(entry.getValue());
    }
    return result;
  }
View Full Code Here

Examples of com.linkedin.restli.common.CompoundKey

    for (int i = 0; i < numInitEntries; ++i)
    {
      final long photoId = randPhotoId + i;
      final long albumId = 7;

      final CompoundKey key = new CompoundKey();
      key.append("photoId", photoId);
      key.append("albumId", albumId);
      final AlbumEntry entry = new AlbumEntry();
      entry.setPhotoId(photoId);
      entry.setAlbumId(albumId);
      entry.setAddTime(r.nextInt(Integer.MAX_VALUE));
      _data.put(key, entry);
View Full Code Here

Examples of com.linkedin.restli.common.CompoundKey

            },
            {
                associationResourceParams,
                new Key("myComplexKeyAssociationId", CompoundKey.class, null),
                "myComplexKeyAssociationId",
                new CompoundKey().append("string1", "apples").append("string2", "oranges")
            }
        };
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.