本文整理了Java中io.gravitee.common.utils.UUID.random()
方法的一些代码示例,展示了UUID.random()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUID.random()
方法的具体详情如下:
包路径:io.gravitee.common.utils.UUID
类名称:UUID
方法名:random
暂无
代码示例来源: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: gravitee-io/graviteeio-access-management
@Override
public Object generate() {
return UUID.random().toString();
}
}
代码示例来源: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/graviteeio-access-management
/**
* Store refresh token
* @param client oauth2 client
* @param endUser oauth2 resource owner
* @return refresh token
*/
private Single<io.gravitee.am.repository.oauth2.model.RefreshToken> storeRefreshToken(Client client, User endUser) {
io.gravitee.am.repository.oauth2.model.RefreshToken refreshToken = new io.gravitee.am.repository.oauth2.model.RefreshToken();
refreshToken.setId(UUID.random().toString());
refreshToken.setToken(UUID.random().toString());
refreshToken.setDomain(client.getDomain());
refreshToken.setClient(client.getClientId());
refreshToken.setSubject(endUser != null ? endUser.getId() : null);
refreshToken.setCreatedAt(new Date());
refreshToken.setExpireAt(new Date(System.currentTimeMillis() + (getRefreshTokenValiditySeconds(client) * 1000L)));
return refreshTokenRepository.create(refreshToken);
}
代码示例来源: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: io.gravitee.am.gateway.handlers/gravitee-am-gateway-handler
@Override
public Single<AuthorizationCode> create(AuthorizationRequest authorizationRequest, User user) {
AuthorizationCode authorizationCode = new AuthorizationCode();
authorizationCode.setCode(UUID.random().toString());
authorizationCode.setClientId(authorizationRequest.getClientId());
authorizationCode.setSubject(user.getId());
authorizationCode.setScopes(authorizationRequest.getScopes());
authorizationCode.setRequestParameters(authorizationRequest.getRequestParameters());
authorizationCode.setExpireAt(new Date(System.currentTimeMillis() + authorizationCodeValidity));
authorizationCode.setCreatedAt(new Date());
return authorizationCodeRepository.create(authorizationCode);
}
代码示例来源: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/graviteeio-access-management
@Override
public Single<AuthorizationCode> create(AuthorizationRequest authorizationRequest, User user) {
AuthorizationCode authorizationCode = new AuthorizationCode();
authorizationCode.setCode(UUID.random().toString());
authorizationCode.setClientId(authorizationRequest.getClientId());
authorizationCode.setSubject(user.getId());
authorizationCode.setScopes(authorizationRequest.getScopes());
authorizationCode.setRequestParameters(authorizationRequest.getRequestParameters());
authorizationCode.setExpireAt(new Date(System.currentTimeMillis() + authorizationCodeValidity));
authorizationCode.setCreatedAt(new Date());
return authorizationCodeRepository.create(authorizationCode);
}
代码示例来源: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: io.gravitee.am.gateway.handlers/gravitee-am-gateway-handler
private void csrfHandler(Router router) {
CSRFHandler csrfHandler = CSRFHandler.create(UUID.random().toString());
// override cookie path
csrfHandler.setCookiePath("/" + domain.getPath());
io.gravitee.am.gateway.handler.vertx.handler.CSRFHandler csrfHandler1 = io.gravitee.am.gateway.handler.vertx.handler.CSRFHandler.create();
router.route("/login").handler(csrfHandler).handler(csrfHandler1);
router.route("/oauth/confirm_access").handler(csrfHandler).handler(csrfHandler1);
}
代码示例来源:origin: gravitee-io/graviteeio-access-management
private void csrfHandler(Router router) {
CSRFHandler csrfHandler = CSRFHandler.create(UUID.random().toString());
// override cookie path
csrfHandler.setCookiePath("/" + domain.getPath());
io.gravitee.am.gateway.handler.vertx.handler.CSRFHandler csrfHandler1 = io.gravitee.am.gateway.handler.vertx.handler.CSRFHandler.create();
router.route("/login").handler(csrfHandler).handler(csrfHandler1);
router.route("/oauth/confirm_access").handler(csrfHandler).handler(csrfHandler1);
}
代码示例来源: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;
}
}
内容来源于网络,如有侵权,请联系作者删除!