Codota Logo
StorableId.toString
Code IndexAdd Codota to your IDE (free)

How to use
toString
method
in
org.eclipse.kapua.service.datastore.model.StorableId

Best Java code snippets using org.eclipse.kapua.service.datastore.model.StorableId.toString (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: org.eclipse.kapua/kapua-datastore-api

@Override
public String marshal(StorableId v) throws Exception {
  return v.toString();
}
origin: eclipse/kapua

@Override
public String marshal(StorableId v) throws Exception {
  return v.toString();
}
origin: eclipse/kapua

/**
 * Stores a new Message under the account of the currently connected user.
 * In this case, the provided message will only be stored in the back-end
 * database and it will not be forwarded to the message broker.
 *
 * @param message The {@link KapuaDataMessage } to be stored
 * @return an {@link InsertResponse} object encapsulating the response from
 * the datastore
 * @throws Exception Whenever something bad happens. See specific
 *                   {@link KapuaService} exceptions.
 */
@POST
@Consumes({ MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_XML })
@ApiOperation(nickname = "dataMessageStore",
    value = "Stores a new KapuaDataMessage", //
    notes = "Stores a new KapuaDataMessage under the account of the currently connected user. In this case, the provided message will only be stored in the back-end database and it will not be forwarded to the message broker.", //
    response = StorableId.class)
public StorableEntityId storeMessage(
    @ApiParam(value = "The ScopeId in which to store the message", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId,//
    @ApiParam(value = "The KapuaDataMessage to be stored") KapuaDataMessage message) throws Exception {
  message.setScopeId(scopeId);
  return new StorableEntityId(MESSAGE_STORE_SERVICE.store(message).toString());
}
origin: eclipse/kapua

private Map<String, Object> marshalClientInfo(ClientInfo clientInfo) throws ParseException {
  Map<String, Object> unmarshalledClientInfo = new HashMap<>();
  unmarshalledClientInfo.put(ClientInfoSchema.CLIENT_ID, clientInfo.getClientId());
  unmarshalledClientInfo.put(ClientInfoSchema.CLIENT_MESSAGE_ID, clientInfo.getFirstMessageId().toString());
  unmarshalledClientInfo.put(ClientInfoSchema.CLIENT_TIMESTAMP, KapuaDateUtils.formatDate(clientInfo.getFirstMessageOn()));
  unmarshalledClientInfo.put(ClientInfoSchema.CLIENT_SCOPE_ID, clientInfo.getScopeId().toStringId());
  return unmarshalledClientInfo;
}
origin: eclipse/kapua

/**
 * Get the client identifier (combining accountName and clientId).<br>
 * <b>If the id is null then it is generated</b>
 * 
 * @param id
 * @param scopeId
 * @param clientId
 * @return
 */
public static String getOrDeriveId(StorableId id, KapuaId scopeId, String clientId) {
  if (id == null) {
    return DatastoreUtils.getHashCode(scopeId.toCompactId(), clientId);
  } else {
    return id.toString();
  }
}
origin: eclipse/kapua

private Map<String, Object> marshalChannelInfo(ChannelInfo channelInfo) throws ParseException {
  Map<String, Object> unmarshalledChannelInfo = new HashMap<>();
  unmarshalledChannelInfo.put(ChannelInfoSchema.CHANNEL_NAME, channelInfo.getName());
  unmarshalledChannelInfo.put(ChannelInfoSchema.CHANNEL_TIMESTAMP, KapuaDateUtils.formatDate(channelInfo.getFirstMessageOn()));
  unmarshalledChannelInfo.put(ChannelInfoSchema.CHANNEL_CLIENT_ID, channelInfo.getClientId());
  unmarshalledChannelInfo.put(ChannelInfoSchema.CHANNEL_SCOPE_ID, channelInfo.getScopeId().toStringId());
  unmarshalledChannelInfo.put(ChannelInfoSchema.CHANNEL_MESSAGE_ID, channelInfo.getFirstMessageId().toString());
  return unmarshalledChannelInfo;
}
origin: eclipse/kapua

/**
 * Get the channel identifier (combining accountName clientId and c).<br>
 * <b>If the id is null then it is generated</b>
 * 
 * @param id
 * @param scopeId
 * @param clientId
 * @param channel
 * @return
 */
private static String getOrDeriveId(StorableId id, KapuaId scopeId, String clientId, String channel) {
  if (id == null) {
    return DatastoreUtils.getHashCode(scopeId.toCompactId(), clientId, channel);
  } else {
    return id.toString();
  }
}
origin: eclipse/kapua

private Map<String, Object> marshalMetricInfo(MetricInfo metricInfo) throws ParseException {
  Map<String, Object> unmarshalledMetricInfo = new HashMap<>();
  unmarshalledMetricInfo.put(MetricInfoSchema.METRIC_SCOPE_ID, metricInfo.getScopeId().toStringId());
  unmarshalledMetricInfo.put(MetricInfoSchema.METRIC_CLIENT_ID, metricInfo.getClientId());
  unmarshalledMetricInfo.put(MetricInfoSchema.METRIC_CHANNEL, metricInfo.getChannel());
  Map<String, Object> unmarshalledMetricValue = new HashMap<>();
  unmarshalledMetricValue.put(MetricInfoSchema.METRIC_MTR_NAME, metricInfo.getName());
  unmarshalledMetricValue.put(MetricInfoSchema.METRIC_MTR_TYPE, DatastoreUtils.convertToClientMetricType(metricInfo.getMetricType()));
  unmarshalledMetricValue.put(MetricInfoSchema.METRIC_MTR_TIMESTAMP, KapuaDateUtils.formatDate(metricInfo.getFirstMessageOn()));
  unmarshalledMetricValue.put(MetricInfoSchema.METRIC_MTR_MSG_ID, metricInfo.getFirstMessageId().toString());
  unmarshalledMetricInfo.put(MetricInfoSchema.METRIC_MTR, unmarshalledMetricValue);
  return unmarshalledMetricInfo;
}
origin: eclipse/kapua

@Override
/**
 * <pre>
 *  {
 *      "query": {
 *          "ids" : {
 *              "type" : "kapua_id",
 *              "values" : ["abcdef1234", "abcdef1235", "zzzyyyy1234"]
 *          }
 *      }
 *  }
 * </pre>
 */
public ObjectNode toSerializedMap() {
  ObjectNode rootNode = SchemaUtil.getObjectNode();
  ObjectNode idsNode = SchemaUtil.getObjectNode();
  ArrayNode idsList = SchemaUtil.getArrayNode();
  for (StorableId id : idSet) {
    idsList.add(id.toString());
  }
  idsNode.set(PredicateConstants.TYPE_KEY, SchemaUtil.getTextNode(type));
  idsNode.set(PredicateConstants.VALUES_KEY, idsList);
  rootNode.set(PredicateConstants.IDS_KEY, idsNode);
  return rootNode;
}
origin: eclipse/kapua

  node.set(name, FACTORY.textNode(((StorableId) value).toString()));
} else {
  throw new DatamodelMappingException(String.format(UNSUPPORTED_OBJECT_TYPE_ERROR_MSG, value != null ? value.getClass() : "null"));
origin: eclipse/kapua

/**
 * Get the metric identifier (return the hash code of the string obtained by combining accountName, clientId, channel and the converted metricName and metricType).<br>
 * <b>If the id is null then it is generated.</b>
 * 
 * @param id
 * @param scopeId
 * @param clientId
 * @param channel
 * @param metricName
 * @param metricType
 * @return
 */
private static String getOrDeriveId(StorableId id, KapuaId scopeId, String clientId, String channel, String metricName, Class<?> metricType) {
  if (id == null) {
    String metricMappedName = DatastoreUtils.getMetricValueQualifier(metricName, DatastoreUtils.convertToClientMetricType(metricType));
    return DatastoreUtils.getHashCode(scopeId.toCompactId(), clientId, channel, metricMappedName);
  } else {
    return id.toString();
  }
}
origin: eclipse/kapua

  String indexName = schemaMetadata.getDataIndexName();
  TypeDescriptor typeDescriptor = new TypeDescriptor(indexName, MessageSchema.MESSAGE_TYPE_NAME);
  client.delete(typeDescriptor, id.toString());
} else {
  logger.warn("Cannot find the message to be deleted. scopeId: '{}' - id: '{}'", scopeId, id);
origin: eclipse/kapua

/**
 * Delete client information by identifier.<br>
 * <b>Be careful using this function since it doesn't guarantee the datastore consistency.<br>
 * It just deletes the client info registry entry by id without checking the consistency of the others registries or the message store.</b>
 * 
 * @param scopeId
 * @param id
 * @throws KapuaIllegalArgumentException
 * @throws ConfigurationException
 * @throws ClientException
 */
public void delete(KapuaId scopeId, StorableId id)
    throws KapuaIllegalArgumentException,
    ConfigurationException, ClientException {
  ArgumentValidator.notNull(scopeId, "scopeId");
  ArgumentValidator.notNull(id, "id");
  MessageStoreConfiguration accountServicePlan = configProvider.getConfiguration(scopeId);
  long ttl = accountServicePlan.getDataTimeToLiveMilliseconds();
  if (!accountServicePlan.getDataStorageEnabled() || ttl == MessageStoreConfiguration.DISABLED) {
    logger.debug("Storage not enabled for account {}, return", scopeId);
    return;
  }
  String indexName = SchemaUtil.getKapuaIndexName(scopeId);
  TypeDescriptor typeDescriptor = new TypeDescriptor(indexName, ClientInfoSchema.CLIENT_TYPE_NAME);
  client.delete(typeDescriptor, id.toString());
}
origin: eclipse/kapua

/**
 * Delete metric information by identifier.<br>
 * <b>Be careful using this function since it doesn't guarantee the datastore consistency.<br>
 * It just deletes the metric info registry entry by id without checking the consistency of the others registries or the message store.</b>
 *
 * @param scopeId
 * @param id
 * @throws KapuaIllegalArgumentException
 * @throws ConfigurationException
 * @throws ClientException
 */
public void delete(KapuaId scopeId, StorableId id)
    throws KapuaIllegalArgumentException,
    ConfigurationException,
    ClientException {
  ArgumentValidator.notNull(scopeId, "scopeId");
  ArgumentValidator.notNull(id, "id");
  MessageStoreConfiguration accountServicePlan = configProvider.getConfiguration(scopeId);
  long ttl = accountServicePlan.getDataTimeToLiveMilliseconds();
  if (!accountServicePlan.getDataStorageEnabled() || ttl == MessageStoreConfiguration.DISABLED) {
    logger.debug("Storage not enabled for account {}, return", scopeId);
    return;
  }
  String indexName = SchemaUtil.getKapuaIndexName(scopeId);
  TypeDescriptor typeDescriptor = new TypeDescriptor(indexName, MetricInfoSchema.METRIC_TYPE_NAME);
  client.delete(typeDescriptor, id.toString());
}
origin: eclipse/kapua

mediator.onBeforeChannelInfoDelete(channelInfo);
TypeDescriptor typeDescriptor = new TypeDescriptor(indexName, ChannelInfoSchema.CHANNEL_TYPE_NAME);
client.delete(typeDescriptor, id.toString());
origin: eclipse/kapua

String kapuaIndexName = metadata.getRegistryIndexName();
UpdateRequest request = new UpdateRequest(metricInfo.getId().toString(), new TypeDescriptor(metadata.getRegistryIndexName(), MetricInfoSchema.METRIC_TYPE_NAME), metricInfo);
response = client.upsert(request);
origin: eclipse/kapua

Metadata metadata = mediator.getMetadata(metricInfo.getScopeId(), metricInfo.getFirstMessageOn().getTime());
bulkRequest.add(
    new UpdateRequest(metricInfo.getId().toString(), new TypeDescriptor(metadata.getRegistryIndexName(), MetricInfoSchema.METRIC_TYPE_NAME), metricInfo));
origin: eclipse/kapua

String registryIndexName = metadata.getRegistryIndexName();
UpdateRequest request = new UpdateRequest(channelInfo.getId().toString(), new TypeDescriptor(metadata.getRegistryIndexName(), ChannelInfoSchema.CHANNEL_TYPE_NAME),
    channelInfo);
response = client.upsert(request);
origin: eclipse/kapua

String kapuaIndexName = metadata.getRegistryIndexName();
UpdateRequest request = new UpdateRequest(clientInfo.getId().toString(), new TypeDescriptor(kapuaIndexName, ClientInfoSchema.CLIENT_TYPE_NAME), clientInfo);
response = client.upsert(request);
origin: eclipse/kapua

private boolean checkThatDatastoreMessagesMatch(DatastoreMessage firstMsg, DatastoreMessage secondMsg) throws KapuaException {
  assertEquals(firstMsg.getDatastoreId().toString(), secondMsg.getDatastoreId().toString());
  assertTrue(areSemanticPartsEqual(firstMsg.getChannel().getSemanticParts(), secondMsg.getChannel().getSemanticParts()));
  if ((firstMsg.getPayload() != null) || (secondMsg.getPayload() != null)) {
    assertArrayEquals(firstMsg.getPayload().getBody(), secondMsg.getPayload().getBody());
    assertTrue(areMetricsEqual(firstMsg.getPayload().getMetrics(), secondMsg.getPayload().getMetrics()));
  }
  assertTrue(arePositionsEqual(firstMsg.getPosition(), secondMsg.getPosition()));
  assertEquals(firstMsg.getTimestamp(), secondMsg.getTimestamp());
  assertEquals(firstMsg.getCapturedOn(), secondMsg.getCapturedOn());
  assertEquals(firstMsg.getSentOn(), secondMsg.getSentOn());
  assertEquals(firstMsg.getReceivedOn(), secondMsg.getReceivedOn());
  return true;
}
org.eclipse.kapua.service.datastore.modelStorableIdtoString

Javadoc

Return the storable identifier as a string

Popular methods of StorableId

    Popular in Java

    • Reading from database using SQL prepared statement
    • requestLocationUpdates (LocationManager)
    • getExternalFilesDir (Context)
    • addToBackStack (FragmentTransaction)
    • Permission (java.security)
      Abstract class for representing access to a system resource. All permissions have a name (whose inte
    • SecureRandom (java.security)
      This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
    • Deque (java.util)
      A linear collection that supports element insertion and removal at both ends. The name deque is shor
    • Map (java.util)
      A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
    • ImageIO (javax.imageio)
    • JList (javax.swing)
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now