Package org.apache.cassandra.cql3

Examples of org.apache.cassandra.cql3.Relation


    protected Prepared parseAlterKeyspace() {
        AlterKeyspace command = new AlterKeyspace(session);
        command.setKeyspaceName(readUniqueIdentifier());

        KSPropDefs defs = parseKSPropDefs();
        command.setKSPropDefs(defs);
        command.validate();
        return command;
    }
View Full Code Here


                                                                    statement.getBoundsTerms(),
                                                                    queryValues.size()));
                if (!(statement instanceof ModificationStatement))
                    throw new InvalidRequestException("Invalid statement in batch: only UPDATE, INSERT and DELETE statements are allowed.");

                ModificationStatement mst = (ModificationStatement)statement;
                if (mst.isCounter())
                {
                    if (type != BatchStatement.Type.COUNTER)
                        throw new InvalidRequestException("Cannot include counter statement in a non-counter batch");
                }
                else
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public Relation parseRecord(ResultSet resultSet) {
    try {
      return new Relation(
        new CommonEntityData(
          resultSet.getLong("id"),
          resultSet.getInt("version"),
          new Date(resultSet.getTimestamp("tstamp").getTime()),
          buildUser(resultSet),
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public Relation mapRow(ResultSet rs, int rowNumber) throws SQLException {
    return new Relation(mapCommonEntityData(rs));
  }
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void process(RelationContainer relationContainer) {
    Relation relation;
   
    relation = relationContainer.getEntity();
   
    for (RelationMember relationMember : relation.getMembers()) {
      EntityType memberType;
     
      memberType = relationMember.getMemberType();
     
      if (EntityType.Node.equals(memberType)) {
        if (!nodeBitSet.get(relationMember.getMemberId())) {
          initialize();
         
          write("Relation," + relation.getId() + ",Node," + relationMember.getMemberId());
          writeNewLine();
        }
      } else if (EntityType.Way.equals(memberType)) {
        if (!wayBitSet.get(relationMember.getMemberId())) {
          initialize();
         
          write("Relation," + relation.getId() + ",Way," + relationMember.getMemberId());
          writeNewLine();
        }
      }
    }
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public Relation getEntity(long entityId) {
    Relation entity;
   
    entity = super.getEntity(entityId);
   
    loadFeatures(entityId, entity);
   
View Full Code Here

  /**
   * Test writing out a normal Relation element.
   */
  @Test
  public final void testProcessNormalRelation() {
    Relation relation =
      new Relation(new CommonEntityData(1234, 2, timestamp, new OsmUser(23, "someuser"), 0));
    relation.getMembers().add(new RelationMember(2345, EntityType.Node, "noderole"));
    relation.getMembers().add(new RelationMember(3456, EntityType.Way, "wayrole"));
    relation.getMembers().add(new RelationMember(4567, EntityType.Relation, "relationrole"));
    relation.getTags().add(new Tag("relationkey", "relationvalue"));
   
    testRelationWriter.process(relation);
    try {
      testBufferedWriter.flush();
    } catch (IOException e) {
View Full Code Here

  /**
   * Test writing of a Relation element with no user.
   */
  @Test
  public final void testProcessRelationWithNoUser() {
    Relation relation =
      new Relation(new CommonEntityData(1234, 2, timestamp, OsmUser.NONE, 0));
    relation.getMembers().add(new RelationMember(2345, EntityType.Node, "noderole"));
    relation.getMembers().add(new RelationMember(3456, EntityType.Way, "wayrole"));
    relation.getMembers().add(new RelationMember(4567, EntityType.Relation, "relationrole"));
    relation.getTags().add(new Tag("relationkey", "relationvalue"));
   
    testRelationWriter.process(relation);
    try {
      testBufferedWriter.flush();
    } catch (IOException e) {
View Full Code Here

  /**
   * Test writing out a Relation element with no tags.
   */
  @Test
  public final void testProcessRelationNoTags() {
    Relation relation =
      new Relation(new CommonEntityData(1234, 2, timestamp, new OsmUser(23, "someuser"), 0));
    relation.getMembers().add(new RelationMember(2345, EntityType.Node, "noderole"));
    relation.getMembers().add(new RelationMember(3456, EntityType.Way, "wayrole"));
    relation.getMembers().add(new RelationMember(4567, EntityType.Relation, "relationrole"));
   
    testRelationWriter.process(relation);
    try {
      testBufferedWriter.flush();
    } catch (IOException e) {
View Full Code Here

    long id;
    int version;
    TimestampContainer timestamp;
    OsmUser user;
    long changesetId;
    Relation relation;
   
    id = Long.parseLong(reader.getAttributeValue(null, ATTRIBUTE_NAME_ID));
    version = Integer.parseInt(reader.getAttributeValue(null, ATTRIBUTE_NAME_VERSION));
    timestamp = parseTimestamp(reader.getAttributeValue(null, ATTRIBUTE_NAME_TIMESTAMP));
    user = readUser();
    changesetId = readChangesetId();
   
    relation = new Relation(new CommonEntityData(id, version, timestamp, user, changesetId));
   
    reader.nextTag();
    while (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
      if (reader.getLocalName().equals(ELEMENT_NAME_TAG)) {
        relation.getTags().add(readTag());
      } else if (reader.getLocalName().equals(ELEMENT_NAME_MEMBER)) {
        relation.getMembers().add(readRelationMember());
      } else {
        readUnknownElement();
      }
    }
    reader.nextTag();
View Full Code Here

TOP

Related Classes of org.apache.cassandra.cql3.Relation

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.