本文整理了Java中io.gravitee.common.utils.UUID
类的一些代码示例,展示了UUID
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUID
类的具体详情如下:
包路径:io.gravitee.common.utils.UUID
类名称:UUID
暂无
代码示例来源: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/graviteeio-access-management
@Override
public Object generate() {
return UUID.random().toString();
}
}
代码示例来源: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: 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.am.gateway.handlers/gravitee-am-gateway-handler
/**
* 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.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.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: 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
@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 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.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: 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.am.gateway.handlers/gravitee-am-gateway-handler
accessToken.setId(UUID.random().toString());
accessToken.setToken(UUID.random().toString());
accessToken.setDomain(client.getDomain());
accessToken.setClient(client.getClientId());
代码示例来源: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/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.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
accessToken.setId(UUID.random().toString());
accessToken.setToken(UUID.random().toString());
accessToken.setDomain(client.getDomain());
accessToken.setClient(client.getClientId());
代码示例来源: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: 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.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;
}
内容来源于网络,如有侵权,请联系作者删除!