Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.CounterSuperColumn$CounterSuperColumnStandardSchemeFactory


                            tf.addColumn(col);
                        }

                    } else {
                        if (metadata.isCounterColumnType()) {
                            CounterSuperColumn counterSuperColumn = new CounterSuperColumn();
                            counterSuperColumn.setName(linkName.getBytes());
                            CounterColumn column = populateCounterFkey(linkName, linkValue);
                            counterSuperColumn.addToColumns(column);
                            tf.addCounterSuperColumn(counterSuperColumn);
                        } else {
                            SuperColumn superColumn = new SuperColumn();
                            superColumn.setName(linkName.getBytes());
                            Column column = populateFkey(linkName, linkValue, timestamp);
View Full Code Here


    {
        if (value != null)
        {
            if (m.isCounterColumnType())
            {
                CounterSuperColumn counterSuper = new CounterSuperColumn();
                counterSuper.setName(name);
                CounterColumn counterColumn = prepareCounterColumn((String) value, name);
                List<CounterColumn> subCounterColumn = new ArrayList<CounterColumn>();
                subCounterColumn.add(counterColumn);
                counterSuper.setColumns(subCounterColumn);
                tr.addCounterSuperColumn(counterSuper);
            }
            else
            {
                SuperColumn superCol = new SuperColumn();
View Full Code Here

                    superColumnName = ((AbstractAttribute) embeddableAttrib).getJPAColumnName()
                            + Constants.EMBEDDED_COLUMN_NAME_DELIMITER + count;

                    if (m.isCounterColumnType())
                    {
                        CounterSuperColumn thriftSuperColumn = (CounterSuperColumn) buildThriftCounterSuperColumn(
                                m.getTableName(), superColumnName, superColumn, obj).get(m.getTableName());
                        tr.addCounterSuperColumn(thriftSuperColumn);
                    }
                    else
                    {
                        SuperColumn thriftSuperColumn = (SuperColumn) buildThriftSuperColumn(m.getTableName(),
                                superColumnName, timestamp2, superColumn, obj).get(m.getTableName());
                        tr.addSuperColumn(thriftSuperColumn);
                    }
                    ecCacheHandler.addElementCollectionCacheMapping(id, obj, superColumnName);
                    count++;
                }
            }
            else
            {
                // Updation, Check whether this object is already in cache,
                // which means we already have a super column
                // Otherwise we need to generate a fresh embedded column
                // name
                int lastEmbeddedObjectCount = ecCacheHandler.getLastElementCollectionObjectCount(id);
                for (Object obj : (Collection) superColumnObject)
                {
                    superColumnName = ecCacheHandler.getElementCollectionObjectName(id, obj);
                    if (superColumnName == null)
                    { // Fresh row
                        superColumnName = ((AbstractAttribute) embeddableAttrib).getJPAColumnName()
                                + Constants.EMBEDDED_COLUMN_NAME_DELIMITER + (++lastEmbeddedObjectCount);
                    }
                    Map<String, Object> thriftSuperColumn = buildThriftSuperColumn(timestamp2, m, id, superColumn,
                            superColumnName, obj);
                    if (m.isCounterColumnType())
                    {
                        tr.addCounterSuperColumn((CounterSuperColumn) thriftSuperColumn.get(m.getTableName()));
                    }
                    else
                    {
                        tr.addSuperColumn((SuperColumn) thriftSuperColumn.get(m.getTableName()));
                    }
                    ecCacheHandler.addElementCollectionCacheMapping(id, obj, superColumnName);
                }
            }
        }
View Full Code Here

                    thriftColumn.setValue(Long.parseLong(value));
                    thriftColumns.add(thriftColumn);

                    tableName = ((AbstractAttribute) column).getTableName() != null ? ((AbstractAttribute) column)
                            .getTableName() : tableName;
                    CounterSuperColumn thriftSuperColumn = (CounterSuperColumn) thriftCounterSuperColumns
                            .get(tableName);
                    if (thriftSuperColumn == null)
                    {
                        thriftSuperColumn = new CounterSuperColumn();
                        thriftSuperColumn.setName(PropertyAccessorFactory.STRING.toBytes(superColumnName));
                        thriftCounterSuperColumns.put(tableName, thriftSuperColumn);
                    }
                    thriftSuperColumn.addToColumns(thriftColumn);
                }
                catch (NumberFormatException nfe)
                {
                    log.error("For counter column arguments should be numeric type, Caused by: .", nfe);
                    throw new KunderaException(nfe);
View Full Code Here

  public CounterSuperColumn toThrift() {
    if (superName == null || counterColumns == null) {
      return null;
    }
    return new CounterSuperColumn(superNameSerializer.toByteBuffer(superName), toThriftColumn());
  }
View Full Code Here

            }
            return result;
          } else {
            Map<ByteBuffer, List<CounterSuperColumn>> result = new HashMap<ByteBuffer, List<CounterSuperColumn>>();
            for (Map.Entry<ByteBuffer, List<ColumnOrSuperColumn>> entry : cfmap.entrySet()) {
              CounterSuperColumn spc = new CounterSuperColumn(ByteBuffer.wrap(columnParent.getSuper_column()),
                  getCounterColumnList(entry.getValue()));
              ArrayList<CounterSuperColumn> spclist = new ArrayList<CounterSuperColumn>(1);
              spclist.add(spc);
              result.put(entry.getKey(), spclist);
            }
View Full Code Here

        column.setName(path.getSerializer().toByteBuffer(columnName));
        column.setValue(amount);

        // 2. Create the super column mutation if this is the first call
        if (superColumn == null) {
            superColumn = new CounterSuperColumn().setName(path.get(0));

            Mutation mutation = new Mutation();
            mutation.setColumn_or_supercolumn(new ColumnOrSuperColumn().setCounter_super_column(superColumn));
            mutationList.add(mutation);
        }
View Full Code Here

                else if (column.isSetCounter_column()) {
                    CounterColumn cc = column.getCounter_column();
                    return new ThriftCounterColumnImpl<C>(colSer.fromBytes(cc.getName()), cc);
                }
                else if (column.isSetCounter_super_column()) {
                    CounterSuperColumn cc = column.getCounter_super_column();
                    return new ThriftCounterSuperColumnImpl<C>(colSer.fromBytes(cc.getName()), cc);
                }
                else if (column.isSetColumn()) {
                    org.apache.cassandra.thrift.Column c = column.getColumn();
                    return new ThriftColumnImpl<C>(colSer.fromBytes(c.getName()), c);
                }
View Full Code Here

        else if (column.isSetSuper_column()) {
            SuperColumn sc = column.getSuper_column();
            return new ThriftSuperColumnImpl<C2>(colSer.fromBytes(sc.getName()), sc);
        }
        else if (column.isSetCounter_super_column()) {
            CounterSuperColumn sc = column.getCounter_super_column();
            return new ThriftCounterSuperColumnImpl<C2>(colSer.fromBytes(sc.getName()), sc);
        }
        throw new UnsupportedOperationException("\'" + columnName + "\' is not a composite column");
    }
View Full Code Here

        else if (column.isSetSuper_column()) {
            SuperColumn sc = column.getSuper_column();
            return new ThriftSuperColumnImpl<C2>(colSer.fromBytes(sc.getName()), sc);
        }
        else if (column.isSetCounter_super_column()) {
            CounterSuperColumn sc = column.getCounter_super_column();
            return new ThriftCounterSuperColumnImpl<C2>(colSer.fromBytes(sc.getName()), sc);
        }
        throw new UnsupportedOperationException("\'" + idx + "\' is not a super column");
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.CounterSuperColumn$CounterSuperColumnStandardSchemeFactory

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.