Java Code Examples for com.datastax.driver.core.Row#getMap()
The following examples show how to use
com.datastax.driver.core.Row#getMap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpdateSecurityQuestions.java From arcusplatform with Apache License 2.0 | 6 votes |
@Override public void execute(ExecutionContext context, boolean autoRollback) throws CommandExecutionException { Session session = context.getSession(); PreparedStatement update = session.prepare(UPDATE); ResultSet rs = context.getSession().execute(SELECT); for(Row row: rs) { UUID id = row.getUUID("id"); Map<String, String> oldQuestions = row.getMap("securityAnswers", String.class, String.class); Map<String, String> newQuestions = rewrite(oldQuestions); logger.debug("Remapping security answers for [{}]...", id); BoundStatement bs = update.bind(newQuestions, id); session.execute(bs); } }
Example 2
Source File: MapTest.java From jmeter-cassandra with Apache License 2.0 | 6 votes |
@Test public void testInsertPreparedthemap() { CassandraSampler cs = new CassandraSampler(); cs.setProperty("sessionName",TESTSESSION); cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE); cs.setProperty("resultVariable","rv"); cs.setProperty("queryType", AbstractCassandaTestElement.PREPARED); cs.setProperty("queryArguments", "\"" + EXPECTED + "\""); cs.setProperty("query", "INSERT INTO " + TABLE + " (key,themap) VALUES (2, ?)"); TestBeanHelper.prepare(cs); SampleResult res = cs.sample(new Entry()); assertTrue(res.isSuccessful(), res.getResponseMessage()); // See if the value matches Row row = session.execute("select themap from " + KEYSPACE + "." + TABLE + " where key = 2").one(); Map<Integer, String> themap = row.getMap(0, Integer.class, String.class); assertTrue(themap.get(1).contentEquals("one")); assertTrue(themap.get(2).contentEquals("two")); assertTrue(themap.get(3).contentEquals("three")); assertEquals(3, themap.size()); }
Example 3
Source File: PreferencesDAOImpl.java From arcusplatform with Apache License 2.0 | 6 votes |
@Override public Map<String, Object> findById(UUID personId, UUID placeId) { BoundStatement boundStatement = new BoundStatement(findByIdStatement) .setUUID(Cols.PERSON_ID, personId) .setUUID(Cols.PLACE_ID, placeId); Row row; try (Context context = findByIdTimer.time()) { row = session.execute(boundStatement).one(); } if (row == null) { return null; } Map<String, String> prefsEncoded = row.getMap(Cols.PREFS, String.class, String.class); return decodeAttributesFromJson(prefsEncoded, Preferences.TYPE); }
Example 4
Source File: CassandraSubsystemDao.java From arcusplatform with Apache License 2.0 | 5 votes |
protected ModelEntity toModel(Row row) { Map<String, String> attributes = row.getMap(Columns.ATTRIBUTES, String.class, String.class); ModelEntity model = new ModelEntity( decode( attributes ) ); model.setCreated( row.getTimestamp(Columns.CREATED) ); model.setModified( row.getTimestamp(Columns.MODIFIED) ); return model; }
Example 5
Source File: DeviceDAOImpl.java From arcusplatform with Apache License 2.0 | 5 votes |
@Override public DeviceDriverStateHolder loadDriverState(Device device) { Preconditions.checkNotNull(device, "device cannot be null"); Preconditions.checkNotNull(device.getId(), "device must have an id"); BoundStatement bound = new BoundStatement(loadState); Row r; try(Context ctxt = loadDriverStateTimer.time()) { r = session.execute(bound.bind(device.getId())).one(); } if(r == null) { return null; } Map<String,String> encoded = r.getMap(NonEntityColumns.ATTRIBUTES, String.class, String.class); AttributeMap attributes = AttributeMap.newMap(); for(Map.Entry<String, String> entry: encoded.entrySet()) { AttributeKey<?> key = key(entry.getKey()); if(key == null) { continue; } Object value = deserialize(key, entry.getValue()); // this shouldn't be necessary... attributes.add(key.coerceToValue(value)); } Map<String,Object> variables = new HashMap<>(); ByteBuffer buf = r.getBytes(NonEntityColumns.VARIABLES); if (buf != null) { variables = SerializationUtils.deserialize(Bytes.getArray(buf)); } return new DeviceDriverStateHolder(attributes, variables); }
Example 6
Source File: AccountDAOImpl.java From arcusplatform with Apache License 2.0 | 5 votes |
@Override protected void populateEntity(Row row, Account entity) { entity.setBillable(row.getBool(AccountEntityColumns.BILLABLE)); entity.setState(row.getString(AccountEntityColumns.STATE)); entity.setTaxExempt(row.getBool(AccountEntityColumns.TAX_EXEMPT)); entity.setBillingFirstName(row.getString(AccountEntityColumns.BILLING_FIRST_NAME)); entity.setBillingLastName(row.getString(AccountEntityColumns.BILLING_LAST_NAME)); entity.setBillingCCType(row.getString(AccountEntityColumns.BILLING_CC_TYPE)); entity.setBillingCCLast4(row.getString(AccountEntityColumns.BILLING_CC_LAST4)); entity.setBillingStreet1(row.getString(AccountEntityColumns.BILLING_STREET1)); entity.setBillingStreet2(row.getString(AccountEntityColumns.BILLING_STREET2)); entity.setBillingCity(row.getString(AccountEntityColumns.BILLING_CITY)); entity.setBillingState(row.getString(AccountEntityColumns.BILLING_STATE)); entity.setBillingZip(row.getString(AccountEntityColumns.BILLING_ZIP)); entity.setBillingZipPlusFour(row.getString(AccountEntityColumns.BILLING_ZIP_PLUS4)); Set<UUID> placeIDs = row.getSet(AccountEntityColumns.PLACE_IDS, UUID.class); entity.setPlaceIDs(placeIDs == null || placeIDs.isEmpty() ? null : placeIDs); // Convert Subscription ID's to Map<ServiceLevel, String> if not empty Map<ServiceLevel, String> subIDs = null; Map<String, String> rowMap = row.getMap(AccountEntityColumns.SUBSCRIPTION_ID_MAP, String.class, String.class); if (rowMap != null && !rowMap.isEmpty()) { subIDs = new HashMap<ServiceLevel, String>(); for (Map.Entry<String, String> item : rowMap.entrySet()) { subIDs.put(ServiceLevel.valueOf(item.getKey()), item.getValue()); } } entity.setSubscriptionIDs(subIDs); entity.setOwner(row.getUUID(AccountEntityColumns.OWNER)); entity.setTrialEnd(row.getTimestamp(AccountEntityColumns.TRIAL_END)); }
Example 7
Source File: CassandraOAuthDAO.java From arcusplatform with Apache License 2.0 | 5 votes |
@Override public Map<String, String> getAttrs(String appId, UUID person) { Preconditions.checkNotNull(appId, "appId is required"); Preconditions.checkNotNull(person, "person is required"); BoundStatement stmt = bindPersonWhere(getAttrs, appId, person); Row r = session.execute(stmt).one(); if(r == null) { return Collections.emptyMap(); } return r.getMap(PersonOAuthCols.attrs.name(), String.class, String.class); }
Example 8
Source File: CassandraMailRepositoryMailDAO.java From james-project with Apache License 2.0 | 5 votes |
private MailDTO toMail(Row row) { MaybeSender sender = Optional.ofNullable(row.getString(SENDER)) .map(MaybeSender::getMailSender) .orElse(MaybeSender.nullSender()); List<MailAddress> recipients = row.getList(RECIPIENTS, String.class) .stream() .map(Throwing.function(MailAddress::new)) .collect(Guavate.toImmutableList()); String state = row.getString(STATE); String remoteAddr = row.getString(REMOTE_ADDR); String remoteHost = row.getString(REMOTE_HOST); String errorMessage = row.getString(ERROR_MESSAGE); String name = row.getString(MAIL_KEY); Date lastUpdated = row.getTimestamp(LAST_UPDATED); Map<String, ByteBuffer> rawAttributes = row.getMap(ATTRIBUTES, String.class, ByteBuffer.class); PerRecipientHeaders perRecipientHeaders = fromHeaderMap(row.getMap(PER_RECIPIENT_SPECIFIC_HEADERS, String.class, UDTValue.class)); MailImpl.Builder mailBuilder = MailImpl.builder() .name(name) .sender(sender) .addRecipients(recipients) .lastUpdated(lastUpdated) .errorMessage(errorMessage) .remoteHost(remoteHost) .remoteAddr(remoteAddr) .state(state) .addAllHeadersForRecipients(perRecipientHeaders) .addAttributes(toAttributes(rawAttributes)); return new MailDTO(mailBuilder, blobIdFactory.from(row.getString(HEADER_BLOB_ID)), blobIdFactory.from(row.getString(BODY_BLOB_ID))); }
Example 9
Source File: CassandraMailRepositoryMailDaoV2.java From james-project with Apache License 2.0 | 5 votes |
private MailDTO toMail(Row row) { MaybeSender sender = MaybeSender.getMailSender(row.getString(SENDER)); List<MailAddress> recipients = row.getList(RECIPIENTS, String.class) .stream() .map(Throwing.function(MailAddress::new)) .collect(Guavate.toImmutableList()); String state = row.getString(STATE); String remoteAddr = row.getString(REMOTE_ADDR); String remoteHost = row.getString(REMOTE_HOST); String errorMessage = row.getString(ERROR_MESSAGE); String name = row.getString(MAIL_KEY); Date lastUpdated = row.getTimestamp(LAST_UPDATED); Map<String, String> rawAttributes = row.getMap(ATTRIBUTES, String.class, String.class); PerRecipientHeaders perRecipientHeaders = fromList(row.getList(PER_RECIPIENT_SPECIFIC_HEADERS, TupleValue.class)); MailImpl.Builder mailBuilder = MailImpl.builder() .name(name) .sender(sender) .addRecipients(recipients) .lastUpdated(lastUpdated) .errorMessage(errorMessage) .remoteHost(remoteHost) .remoteAddr(remoteAddr) .state(state) .addAllHeadersForRecipients(perRecipientHeaders) .addAttributes(toAttributes(rawAttributes)); return new MailDTO(mailBuilder, blobIdFactory.from(row.getString(HEADER_BLOB_ID)), blobIdFactory.from(row.getString(BODY_BLOB_ID))); }
Example 10
Source File: Functions.java From hawkular-metrics with Apache License 2.0 | 4 votes |
public static DataPoint<Long> getTempCounterDataPoint(Row row) { return new DataPoint<>( row.getTimestamp(COUNTER_COLS.TIME.ordinal()).toInstant().toEpochMilli(), row.getLong(COUNTER_COLS.VALUE.ordinal()), row.getMap(COUNTER_COLS.TAGS.ordinal(), String.class, String.class)); }
Example 11
Source File: Functions.java From hawkular-metrics with Apache License 2.0 | 4 votes |
public static DataPoint<String> getStringDataPoint(Row row) { return new DataPoint<>( UUIDs.unixTimestamp(row.getUUID(STRING_COLS.TIME.ordinal())), row.getString(STRING_COLS.VALUE.ordinal()), row.getMap(STRING_COLS.TAGS.ordinal(), String.class, String.class)); }
Example 12
Source File: Functions.java From hawkular-metrics with Apache License 2.0 | 4 votes |
public static DataPoint<Long> getCounterDataPoint(Row row) { return new DataPoint<>( UUIDs.unixTimestamp(row.getUUID(COUNTER_COLS.TIME.ordinal())), row.getLong(COUNTER_COLS.VALUE.ordinal()), row.getMap(COUNTER_COLS.TAGS.ordinal(), String.class, String.class)); }
Example 13
Source File: Functions.java From hawkular-metrics with Apache License 2.0 | 4 votes |
public static DataPoint<Double> getTempGaugeDataPoint(Row row) { return new DataPoint<>( row.getTimestamp(GAUGE_COLS.TIME.ordinal()).toInstant().toEpochMilli(), row.getDouble(GAUGE_COLS.VALUE.ordinal()), row.getMap(GAUGE_COLS.TAGS.ordinal(), String.class, String.class)); }
Example 14
Source File: Functions.java From hawkular-metrics with Apache License 2.0 | 4 votes |
public static DataPoint<Double> getGaugeDataPoint(Row row) { return new DataPoint<>( UUIDs.unixTimestamp(row.getUUID(GAUGE_COLS.TIME.ordinal())), row.getDouble(GAUGE_COLS.VALUE.ordinal()), row.getMap(GAUGE_COLS.TAGS.ordinal(), String.class, String.class)); }
Example 15
Source File: EnqueuedMailsDaoUtil.java From james-project with Apache License 2.0 | 4 votes |
static EnqueuedItemWithSlicingContext toEnqueuedMail(Row row, BlobId.Factory blobFactory) { MailQueueName queueName = MailQueueName.fromString(row.getString(QUEUE_NAME)); EnqueueId enqueueId = EnqueueId.of(row.getUUID(ENQUEUE_ID)); Instant timeRangeStart = row.getTimestamp(TIME_RANGE_START).toInstant(); BucketedSlices.BucketId bucketId = BucketedSlices.BucketId.of(row.getInt(BUCKET_ID)); Instant enqueuedTime = row.getTimestamp(ENQUEUED_TIME).toInstant(); BlobId headerBlobId = blobFactory.from(row.getString(HEADER_BLOB_ID)); BlobId bodyBlobId = blobFactory.from(row.getString(BODY_BLOB_ID)); MimeMessagePartsId mimeMessagePartsId = MimeMessagePartsId .builder() .headerBlobId(headerBlobId) .bodyBlobId(bodyBlobId) .build(); MailAddress sender = Optional.ofNullable(row.getString(SENDER)) .map(Throwing.function(MailAddress::new)) .orElse(null); List<MailAddress> recipients = row.getList(RECIPIENTS, String.class) .stream() .map(Throwing.function(MailAddress::new)) .collect(ImmutableList.toImmutableList()); String state = row.getString(STATE); String remoteAddr = row.getString(REMOTE_ADDR); String remoteHost = row.getString(REMOTE_HOST); String errorMessage = row.getString(ERROR_MESSAGE); String name = row.getString(NAME); Date lastUpdated = row.getTimestamp(LAST_UPDATED); Map<String, ByteBuffer> rawAttributes = row.getMap(ATTRIBUTES, String.class, ByteBuffer.class); PerRecipientHeaders perRecipientHeaders = fromList(row.getList(PER_RECIPIENT_SPECIFIC_HEADERS, TupleValue.class)); MailImpl mail = MailImpl.builder() .name(name) .sender(sender) .addRecipients(recipients) .lastUpdated(lastUpdated) .errorMessage(errorMessage) .remoteHost(remoteHost) .remoteAddr(remoteAddr) .state(state) .addAllHeadersForRecipients(perRecipientHeaders) .addAttributes(toAttributes(rawAttributes)) .build(); EnqueuedItem enqueuedItem = EnqueuedItem.builder() .enqueueId(enqueueId) .mailQueueName(queueName) .mail(mail) .enqueuedTime(enqueuedTime) .mimeMessagePartsId(mimeMessagePartsId) .build(); return EnqueuedItemWithSlicingContext.builder() .enqueuedItem(enqueuedItem) .slicingContext(EnqueuedItemWithSlicingContext.SlicingContext.of(bucketId, timeRangeStart)) .build(); }
Example 16
Source File: AbstractCassandraProcessor.java From nifi with Apache License 2.0 | 4 votes |
protected static Object getCassandraObject(Row row, int i, DataType dataType) { if (dataType.equals(DataType.blob())) { return row.getBytes(i); } else if (dataType.equals(DataType.varint()) || dataType.equals(DataType.decimal())) { // Avro can't handle BigDecimal and BigInteger as numbers - it will throw an // AvroRuntimeException such as: "Unknown datum type: java.math.BigDecimal: 38" return row.getObject(i).toString(); } else if (dataType.equals(DataType.cboolean())) { return row.getBool(i); } else if (dataType.equals(DataType.cint())) { return row.getInt(i); } else if (dataType.equals(DataType.bigint()) || dataType.equals(DataType.counter())) { return row.getLong(i); } else if (dataType.equals(DataType.ascii()) || dataType.equals(DataType.text()) || dataType.equals(DataType.varchar())) { return row.getString(i); } else if (dataType.equals(DataType.cfloat())) { return row.getFloat(i); } else if (dataType.equals(DataType.cdouble())) { return row.getDouble(i); } else if (dataType.equals(DataType.timestamp())) { return row.getTimestamp(i); } else if (dataType.equals(DataType.date())) { return row.getDate(i); } else if (dataType.equals(DataType.time())) { return row.getTime(i); } else if (dataType.isCollection()) { List<DataType> typeArguments = dataType.getTypeArguments(); if (typeArguments == null || typeArguments.size() == 0) { throw new IllegalArgumentException("Column[" + i + "] " + dataType.getName() + " is a collection but no type arguments were specified!"); } // Get the first type argument, to be used for lists and sets (and the first in a map) DataType firstArg = typeArguments.get(0); TypeCodec firstCodec = codecRegistry.codecFor(firstArg); if (dataType.equals(DataType.set(firstArg))) { return row.getSet(i, firstCodec.getJavaType()); } else if (dataType.equals(DataType.list(firstArg))) { return row.getList(i, firstCodec.getJavaType()); } else { // Must be an n-arg collection like map DataType secondArg = typeArguments.get(1); TypeCodec secondCodec = codecRegistry.codecFor(secondArg); if (dataType.equals(DataType.map(firstArg, secondArg))) { return row.getMap(i, firstCodec.getJavaType(), secondCodec.getJavaType()); } } } else { // The different types that we support are numbers (int, long, double, float), // as well as boolean values and Strings. Since Avro doesn't provide // timestamp types, we want to convert those to Strings. So we will cast anything other // than numbers or booleans to strings by using the toString() method. return row.getObject(i).toString(); } return null; }
Example 17
Source File: AbstractCassandraProcessor.java From localization_nifi with Apache License 2.0 | 4 votes |
protected static Object getCassandraObject(Row row, int i, DataType dataType) { if (dataType.equals(DataType.blob())) { return row.getBytes(i); } else if (dataType.equals(DataType.varint()) || dataType.equals(DataType.decimal())) { // Avro can't handle BigDecimal and BigInteger as numbers - it will throw an // AvroRuntimeException such as: "Unknown datum type: java.math.BigDecimal: 38" return row.getObject(i).toString(); } else if (dataType.equals(DataType.cboolean())) { return row.getBool(i); } else if (dataType.equals(DataType.cint())) { return row.getInt(i); } else if (dataType.equals(DataType.bigint()) || dataType.equals(DataType.counter())) { return row.getLong(i); } else if (dataType.equals(DataType.ascii()) || dataType.equals(DataType.text()) || dataType.equals(DataType.varchar())) { return row.getString(i); } else if (dataType.equals(DataType.cfloat())) { return row.getFloat(i); } else if (dataType.equals(DataType.cdouble())) { return row.getDouble(i); } else if (dataType.equals(DataType.timestamp())) { return row.getTimestamp(i); } else if (dataType.equals(DataType.date())) { return row.getDate(i); } else if (dataType.equals(DataType.time())) { return row.getTime(i); } else if (dataType.isCollection()) { List<DataType> typeArguments = dataType.getTypeArguments(); if (typeArguments == null || typeArguments.size() == 0) { throw new IllegalArgumentException("Column[" + i + "] " + dataType.getName() + " is a collection but no type arguments were specified!"); } // Get the first type argument, to be used for lists and sets (and the first in a map) DataType firstArg = typeArguments.get(0); TypeCodec firstCodec = codecRegistry.codecFor(firstArg); if (dataType.equals(DataType.set(firstArg))) { return row.getSet(i, firstCodec.getJavaType()); } else if (dataType.equals(DataType.list(firstArg))) { return row.getList(i, firstCodec.getJavaType()); } else { // Must be an n-arg collection like map DataType secondArg = typeArguments.get(1); TypeCodec secondCodec = codecRegistry.codecFor(secondArg); if (dataType.equals(DataType.map(firstArg, secondArg))) { return row.getMap(i, firstCodec.getJavaType(), secondCodec.getJavaType()); } } } else { // The different types that we support are numbers (int, long, double, float), // as well as boolean values and Strings. Since Avro doesn't provide // timestamp types, we want to convert those to Strings. So we will cast anything other // than numbers or booleans to strings by using the toString() method. return row.getObject(i).toString(); } return null; }
Example 18
Source File: GuicedCassandraSessionDAO.java From arcusplatform with Apache License 2.0 | 4 votes |
private Session hydrateSession(UUID id, Row row) { UUID rowId = row.getUUID(Columns.ID); if (id.equals(rowId)) { Date start = row.getTimestamp(Columns.START); // If this is null, then the row is a tombstone. if (start != null) { ByteBuffer buffer = row.getBytes(Columns.SERIALIZED); // If the buffer has anything, then it is an old style serialized session. if (buffer != null && buffer.remaining() > 0) { byte[] bytes = new byte[buffer.remaining()]; buffer.get(bytes); return serializer.deserialize(bytes); } else { // New style session. Read the fields and create a session. Date stop = row.getTimestamp(Columns.STOP); Date lastAccess = row.getTimestamp(Columns.LAST_ACCESS); long timeout = row.getLong(Columns.TIMEOUT); boolean expired = row.getBool(Columns.EXPIRED); String host = row.getString(Columns.HOST); // Read the attributes Map<String, String> serialized_attrs = row.getMap(Columns.ATTRIBUTES, String.class, String.class); Map<Object, Object> attributes = new HashMap<>(); for (Map.Entry<String, String> entry : serialized_attrs.entrySet()) { String json = entry.getValue(); if (json != null && !json.isEmpty()) { attributes.put(entry.getKey(), deserializeAttribute(entry.getKey(), json)); } } // Create and populate the session. SimpleSession session = new SimpleSession(); session.setId(rowId); session.setStartTimestamp(start); session.setStopTimestamp(stop); session.setLastAccessTime(lastAccess); session.setTimeout(timeout); session.setExpired(expired); session.setHost(host); session.setAttributes(attributes); return session; } } } return null; }
Example 19
Source File: HubDAOImpl.java From arcusplatform with Apache License 2.0 | 4 votes |
private Map<String,Object> toAttributes(Row r) { Map<String, String> encoded = r.getMap(NonEntityColumns.ATTRIBUTES, String.class, String.class); AttributeMap attributes = AttributeMap.newMap(); for(Map.Entry<String, String> entry: encoded.entrySet()) { AttributeKey<?> key = key(entry.getKey()); if(key == null) { continue; } Object value = deserialize(key, entry.getValue()); attributes.add(key.coerceToValue(value)); } Map<String, Object> model = attributes.toMap(); // base attributes String id = r.getString(HubEntityColumns.ID); Utils.setIf(Capability.ATTR_TYPE, HubCapability.NAMESPACE, model); Utils.setIf(Capability.ATTR_ID, id, model); Utils.setIf(Capability.ATTR_ADDRESS, Address.hubService(id, PlatformConstants.SERVICE_HUB).getRepresentation(), model); setOrDefault(Capability.ATTR_TAGS, r.getSet(BaseEntityColumns.TAGS, String.class), ImmutableSet.of(), model); setOrDefault(Capability.ATTR_CAPS, r.getSet(HubEntityColumns.CAPS, String.class), ImmutableSet.of(Capability.NAMESPACE, HubCapability.NAMESPACE), model); // hub attributes Utils.setIf(HubCapability.ATTR_ID, id, model); Utils.setIf(HubCapability.ATTR_ACCOUNT, Utils.coerceToString(r.getUUID(HubEntityColumns.ACCOUNT_ID)), model); Utils.setIf(HubCapability.ATTR_PLACE, Utils.coerceToString(r.getUUID(HubEntityColumns.PLACE_ID)), model); setOrDefault(HubCapability.ATTR_NAME, r.getString(HubEntityColumns.NAME), "My Hub", model); Utils.setIf(HubCapability.ATTR_VENDOR, r.getString(HubEntityColumns.VENDOR), model); Utils.setIf(HubCapability.ATTR_MODEL, r.getString(HubEntityColumns.MODEL), model); Utils.setIf(HubCapability.ATTR_STATE, r.getString(HubEntityColumns.STATE), model); Utils.setIf(HubCapability.ATTR_REGISTRATIONSTATE, r.getString(HubEntityColumns.REGISTRATIONSTATE), model); // hub advanced attributes Utils.setIf(HubAdvancedCapability.ATTR_MAC, r.getString(HubEntityColumns.MAC_ADDRESS), model); Utils.setIf(HubAdvancedCapability.ATTR_HARDWAREVER, r.getString(HubEntityColumns.HARDWARE_VER), model); Utils.setIf(HubAdvancedCapability.ATTR_OSVER, r.getString(HubEntityColumns.OS_VER), model); Utils.setIf(HubAdvancedCapability.ATTR_AGENTVER, r.getString(HubEntityColumns.AGENT_VER), model); Utils.setIf(HubAdvancedCapability.ATTR_SERIALNUM, r.getString(HubEntityColumns.SERIAL_NUM), model); Utils.setIf(HubAdvancedCapability.ATTR_MFGINFO, r.getString(HubEntityColumns.MFG_INFO), model); Utils.setIf(HubAdvancedCapability.ATTR_BOOTLOADERVER, r.getString(HubEntityColumns.BOOTLOADER_VER), model); Utils.setIf(HubAdvancedCapability.ATTR_FIRMWAREGROUP, r.getString(HubEntityColumns.FIRMWARE_GROUP), model); Utils.setIf(HubAdvancedCapability.ATTR_LASTRESET, Utils.coerceToString(r.getUUID(HubEntityColumns.LAST_RESET)), model); Utils.setIf(HubAdvancedCapability.ATTR_LASTDEVICEADDREMOVE, Utils.coerceToString(r.getUUID(HubEntityColumns.LAST_DEVICE_ADD_REMOVE)), model); return model; }
Example 20
Source File: Functions.java From hawkular-metrics with Apache License 2.0 | 4 votes |
public static DataPoint<AvailabilityType> getAvailabilityDataPoint(Row row) { return new DataPoint<>( UUIDs.unixTimestamp(row.getUUID(AVAILABILITY_COLS.TIME.ordinal())), AvailabilityType.fromBytes(row.getBytes(AVAILABILITY_COLS.AVAILABILITY.ordinal())), row.getMap(COUNTER_COLS.TAGS.ordinal(), String.class, String.class)); }