本文整理了Java中io.gravitee.common.utils.UUID.toString()
方法的一些代码示例,展示了UUID.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUID.toString()
方法的具体详情如下:
包路径:io.gravitee.common.utils.UUID
类名称:UUID
方法名:toString
暂无
代码示例来源:origin: gravitee-io/gravitee-gateway
private Event prepareEvent() {
Event event = new Event();
event.setId(UUID.toString(UUID.random()));
event.setType(EventType.GATEWAY_STARTED);
event.setCreatedAt(new Date());
event.setUpdatedAt(event.getCreatedAt());
Map<String, String> properties = new HashMap<>();
properties.put("id", node.id());
properties.put("started_at", Long.toString(event.getCreatedAt().getTime()));
properties.put("last_heartbeat_at", Long.toString(event.getCreatedAt().getTime()));
event.setProperties(properties);
InstanceEventPayload instance = createInstanceInfo();
try {
String payload = objectMapper.writeValueAsString(instance);
event.setPayload(payload);
} catch (JsonProcessingException jsex) {
LOGGER.error("An error occurs while transforming instance information into JSON", jsex);
}
return event;
}
代码示例来源:origin: gravitee-io/gravitee-gateway
VertxHttpServerRequest(HttpServerRequest httpServerRequest) {
this.httpServerRequest = httpServerRequest;
this.timestamp = System.currentTimeMillis();
this.id = UUID.toString(UUID.random());
this.metrics = Metrics.on(timestamp).build();
this.metrics.setRequestId(id());
this.metrics.setHttpMethod(method());
this.metrics.setLocalAddress(localAddress());
this.metrics.setRemoteAddress(remoteAddress());
this.metrics.setHost(httpServerRequest.host());
this.metrics.setUri(uri());
}
代码示例来源:origin: io.gravitee.reporter/gravitee-reporter-api
private EndpointStatus(long timestamp,
String api,
String endpoint,
List<Step> steps) {
super(timestamp);
this.id = UUID.toString(UUID.random());
this.api = api;
this.endpoint = endpoint;
this.steps = steps;
this.success = steps.stream().allMatch(Step::isSuccess);
}
代码示例来源:origin: io.gravitee.management/gravitee-management-api-service
private void create(List<NewPortalNotificationEntity> notificationEntities) {
final Date now = new Date();
List<PortalNotification> notifications = notificationEntities.
stream().
map(this::convert).
collect(Collectors.toList());
notifications.forEach( n -> {
n.setId(UUID.toString(UUID.random()));
n.setCreatedAt(now);
});
try {
portalNotificationRepository.create(notifications);
} catch (TechnicalException ex) {
LOGGER.error("An error occurs while trying to create {}", notifications, ex);
throw new TechnicalManagementException("An error occurs while trying create " + notifications, ex);
}
}
代码示例来源:origin: gravitee-io/gravitee-management-rest-api
private void create(List<NewPortalNotificationEntity> notificationEntities) {
final Date now = new Date();
List<PortalNotification> notifications = notificationEntities.
stream().
map(this::convert).
collect(Collectors.toList());
notifications.forEach( n -> {
n.setId(UUID.toString(UUID.random()));
n.setCreatedAt(now);
});
try {
portalNotificationRepository.create(notifications);
} catch (TechnicalException ex) {
LOGGER.error("An error occurs while trying to create {}", notifications, ex);
throw new TechnicalManagementException("An error occurs while trying create " + notifications, ex);
}
}
代码示例来源:origin: io.gravitee.gateway.services/gravitee-gateway-services-monitoring
private Event prepareEvent() {
Event event = new Event();
event.setId(UUID.toString(UUID.random()));
event.setType(EventType.GATEWAY_STARTED);
event.setCreatedAt(new Date());
event.setUpdatedAt(event.getCreatedAt());
Map<String, String> properties = new HashMap<>();
properties.put("id", node.id());
properties.put("started_at", Long.toString(event.getCreatedAt().getTime()));
properties.put("last_heartbeat_at", Long.toString(event.getCreatedAt().getTime()));
event.setProperties(properties);
InstanceEventPayload instance = createInstanceInfo();
try {
String payload = objectMapper.writeValueAsString(instance);
event.setPayload(payload);
} catch (JsonProcessingException jsex) {
LOGGER.error("An error occurs while transforming instance information into JSON", jsex);
}
return event;
}
代码示例来源:origin: io.gravitee.gateway.services/gravitee-gateway-services-heartbeat
private Event prepareEvent() {
Event event = new Event();
event.setId(UUID.toString(UUID.random()));
event.setType(EventType.GATEWAY_STARTED);
event.setCreatedAt(new Date());
event.setUpdatedAt(event.getCreatedAt());
Map<String, String> properties = new HashMap<>();
properties.put("id", node.id());
properties.put("started_at", Long.toString(event.getCreatedAt().getTime()));
properties.put("last_heartbeat_at", Long.toString(event.getCreatedAt().getTime()));
event.setProperties(properties);
InstanceEventPayload instance = createInstanceInfo();
try {
String payload = objectMapper.writeValueAsString(instance);
event.setPayload(payload);
} catch (JsonProcessingException jsex) {
LOGGER.error("An error occurs while transforming instance information into JSON", jsex);
}
return event;
}
代码示例来源:origin: gravitee-io/gravitee-management-rest-api
@Override
public EventEntity create(NewEventEntity newEventEntity) {
String hostAddress = "";
try {
hostAddress = InetAddress.getLocalHost().getHostAddress();
LOGGER.debug("Create {} for server {}", newEventEntity, hostAddress);
Event event = convert(newEventEntity);
event.setId(UUID.toString(UUID.random()));
// Set origin
event.getProperties().put(Event.EventProperties.ORIGIN.getValue(), hostAddress);
// Set date fields
event.setCreatedAt(new Date());
event.setUpdatedAt(event.getCreatedAt());
Event createdEvent = eventRepository.create(event);
return convert(createdEvent);
} catch (UnknownHostException e) {
LOGGER.error("An error occurs while getting the server IP address", e);
throw new TechnicalManagementException("An error occurs while getting the server IP address", e);
} catch (TechnicalException ex) {
LOGGER.error("An error occurs while trying to create {} for server {}", newEventEntity, hostAddress, ex);
throw new TechnicalManagementException("An error occurs while trying create " + newEventEntity + " for server " + hostAddress, ex);
}
}
代码示例来源:origin: io.gravitee.am.gateway.handlers/gravitee-am-gateway-handler
@Override
public Client create(String domain, DynamicClientRegistrationRequest request) {
Client client = new Client();
client.setClientId(UUID.toString(UUID.random()));
client.setDomain(domain);
return request.patch(client);
}
代码示例来源:origin: io.gravitee.management/gravitee-management-api-service
private Entrypoint convert(final NewEntryPointEntity entrypointEntity) {
final Entrypoint entrypoint = new Entrypoint();
entrypoint.setId(UUID.toString(UUID.random()));
entrypoint.setValue(entrypointEntity.getValue());
entrypoint.setTags(String.join(SEPARATOR, entrypointEntity.getTags()));
return entrypoint;
}
代码示例来源:origin: gravitee-io/graviteeio-access-management
@Override
public Client create(String domain, DynamicClientRegistrationRequest request) {
Client client = new Client();
client.setClientId(UUID.toString(UUID.random()));
client.setDomain(domain);
return request.patch(client);
}
代码示例来源:origin: gravitee-io/gravitee-management-rest-api
private Entrypoint convert(final NewEntryPointEntity entrypointEntity) {
final Entrypoint entrypoint = new Entrypoint();
entrypoint.setId(UUID.toString(UUID.random()));
entrypoint.setValue(entrypointEntity.getValue());
entrypoint.setTags(String.join(SEPARATOR, entrypointEntity.getTags()));
return entrypoint;
}
代码示例来源:origin: gravitee-io/gravitee-management-rest-api
@Override
public GenericNotificationConfigEntity create(GenericNotificationConfigEntity entity) {
if (entity.getNotifier() == null || entity.getNotifier().isEmpty()
|| entity.getName() == null || entity.getName().isEmpty()) {
throw new BadNotificationConfigException("Name or notifier is missing !");
}
try {
GenericNotificationConfig notificationConfig = convert(entity);
notificationConfig.setId(UUID.toString(UUID.random()));
notificationConfig.setCreatedAt(new Date());
notificationConfig.setUpdatedAt(notificationConfig.getCreatedAt());
return convert(genericNotificationConfigRepository.create(notificationConfig));
} catch (TechnicalException te) {
LOGGER.error("An error occurs while trying to save the generic notification settings {}", entity, te);
throw new TechnicalManagementException("An error occurs while trying to save the generic notification settings " + entity, te);
}
}
代码示例来源:origin: io.gravitee.management/gravitee-management-api-service
@Override
public GenericNotificationConfigEntity create(GenericNotificationConfigEntity entity) {
if (entity.getNotifier() == null || entity.getNotifier().isEmpty()
|| entity.getName() == null || entity.getName().isEmpty()) {
throw new BadNotificationConfigException("Name or notifier is missing !");
}
try {
GenericNotificationConfig notificationConfig = convert(entity);
notificationConfig.setId(UUID.toString(UUID.random()));
notificationConfig.setCreatedAt(new Date());
notificationConfig.setUpdatedAt(notificationConfig.getCreatedAt());
return convert(genericNotificationConfigRepository.create(notificationConfig));
} catch (TechnicalException te) {
LOGGER.error("An error occurs while trying to save the generic notification settings {}", entity, te);
throw new TechnicalManagementException("An error occurs while trying to save the generic notification settings " + entity, te);
}
}
代码示例来源:origin: io.gravitee.alert/gravitee-alert-api
public Event build() {
final Event alertEvent = new Event();
alertEvent.setId(UUID.toString(UUID.random()));
alertEvent.setTimestamp(timestamp);
alertEvent.setType(type);
alertEvent.setContext(context);
alertEvent.setProps(props);
return alertEvent;
}
}
代码示例来源:origin: gravitee-io/graviteeio-access-management
@Override
public Single<Client> applyRegistrationAccessToken(String basePath, Client client) {
OpenIDProviderMetadata openIDProviderMetadata = openIDDiscoveryService.getConfiguration(basePath);
JWT jwt = new JWT();
jwt.setIss(openIDProviderMetadata.getIssuer());
jwt.setSub(client.getClientId());
jwt.setAud(client.getClientId());
jwt.setDomain(client.getDomain());
jwt.setIat(new Date().getTime() / 1000l);
jwt.setExp(Date.from(new Date().toInstant().plusSeconds(3600*24*365*2)).getTime() / 1000l);
jwt.setScope(Scope.DCR.getKey());
jwt.setJti(UUID.toString(UUID.random()));
return jwtService.encode(jwt, client)
.map(token -> {
client.setRegistrationAccessToken(token);
client.setRegistrationClientUri(openIDProviderMetadata.getRegistrationEndpoint()+"/"+client.getClientId());
return client;
});
}
代码示例来源:origin: io.gravitee.am.gateway.handlers/gravitee-am-gateway-handler
@Override
public Single<Client> applyRegistrationAccessToken(String basePath, Client client) {
OpenIDProviderMetadata openIDProviderMetadata = openIDDiscoveryService.getConfiguration(basePath);
JWT jwt = new JWT();
jwt.setIss(openIDProviderMetadata.getIssuer());
jwt.setSub(client.getClientId());
jwt.setAud(client.getClientId());
jwt.setDomain(client.getDomain());
jwt.setIat(new Date().getTime() / 1000l);
jwt.setExp(Date.from(new Date().toInstant().plusSeconds(3600*24*365*2)).getTime() / 1000l);
jwt.setScope(Scope.DCR.getKey());
jwt.setJti(UUID.toString(UUID.random()));
return jwtService.encode(jwt, client)
.map(token -> {
client.setRegistrationAccessToken(token);
client.setRegistrationClientUri(openIDProviderMetadata.getRegistrationEndpoint()+"/"+client.getClientId());
return client;
});
}
代码示例来源:origin: io.gravitee.gateway.standalone/gravitee-gateway-standalone-container
VertxHttpServerRequest(HttpServerRequest httpServerRequest) {
this.httpServerRequest = httpServerRequest;
this.timestamp = System.currentTimeMillis();
this.id = UUID.toString(UUID.random());
this.metrics = Metrics.on(timestamp).build();
this.metrics.setRequestId(id());
this.metrics.setHttpMethod(method());
this.metrics.setLocalAddress(localAddress());
this.metrics.setRemoteAddress(remoteAddress());
this.metrics.setHost(httpServerRequest.host());
this.metrics.setUri(uri());
}
代码示例来源:origin: io.gravitee.management/gravitee-management-api-service
private Rating convert(final NewRatingEntity ratingEntity) {
final Rating rating = new Rating();
rating.setId(UUID.toString(UUID.random()));
rating.setApi(ratingEntity.getApi());
rating.setRate(ratingEntity.getRate());
rating.setTitle(ratingEntity.getTitle());
rating.setComment(ratingEntity.getComment());
rating.setUser(getAuthenticatedUsername());
final Date now = new Date();
rating.setCreatedAt(now);
rating.setUpdatedAt(now);
return rating;
}
}
代码示例来源:origin: gravitee-io/gravitee-management-rest-api
private Rating convert(final NewRatingEntity ratingEntity) {
final Rating rating = new Rating();
rating.setId(UUID.toString(UUID.random()));
rating.setApi(ratingEntity.getApi());
rating.setRate(ratingEntity.getRate());
rating.setTitle(ratingEntity.getTitle());
rating.setComment(ratingEntity.getComment());
rating.setUser(getAuthenticatedUsername());
final Date now = new Date();
rating.setCreatedAt(now);
rating.setUpdatedAt(now);
return rating;
}
}
内容来源于网络,如有侵权,请联系作者删除!