Refine search
@Override public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(UUID.nameUUIDFromBytes(globalTransactionId).toString()); stringBuilder.append(":").append(UUID.nameUUIDFromBytes(branchQualifier).toString()); return stringBuilder.toString(); }
private String getIdentifier(final String counterContext, final String name) { final String contextId = UUID.nameUUIDFromBytes(counterContext.getBytes(StandardCharsets.UTF_8)).toString(); final String nameId = UUID.nameUUIDFromBytes(name.getBytes(StandardCharsets.UTF_8)).toString(); final String contextAndName = contextId + "-" + nameId; return UUID.nameUUIDFromBytes(contextAndName.getBytes(StandardCharsets.UTF_8)).toString(); }
public static String createUniqueName(String group) { if(group == null) group = DEFAULT_GROUP; String n1 = UUID.randomUUID().toString(); String n2 = UUID.nameUUIDFromBytes(group.getBytes()).toString(); return String.format("%s-%s", n2.substring(24), n1); } }
public static String createUniqueName(String group) { if(group == null) group = DEFAULT_GROUP; String n1 = UUID.randomUUID().toString(); String n2 = UUID.nameUUIDFromBytes(group.getBytes()).toString(); return String.format("%s-%s", n2.substring(24), n1); } }
private String getId(final Optional<String> currentVersionedId, final String componentId) { final String versionedId; if (currentVersionedId.isPresent()) { versionedId = currentVersionedId.get(); } else { versionedId = UUID.nameUUIDFromBytes(componentId.getBytes(StandardCharsets.UTF_8)).toString(); } versionedComponentIds.put(componentId, versionedId); return versionedId; }
private long generateMsb(String id) { final UUID temp; if (convertedUuids.contains(id)) { temp = UUID.fromString(id); } else { temp = UUID.nameUUIDFromBytes(id.getBytes(StandardCharsets.UTF_8)); // record what the converted uuid will be so we do not re-convert a previously converted uuid convertedUuids.add(new UUID(temp.getMostSignificantBits(), LSB).toString()); } return temp.getMostSignificantBits(); }
private String generateUuid(final String propposedId, final String destinationGroupId, final String seed) { long msb = UUID.nameUUIDFromBytes((propposedId + destinationGroupId).getBytes(StandardCharsets.UTF_8)).getMostSignificantBits(); UUID uuid; if (StringUtils.isBlank(seed)) { long lsb = randomGenerator.nextLong(); // since msb is extracted from type-one UUID, the type-one semantics will be preserved uuid = new UUID(msb, lsb); } else { UUID seedId = UUID.nameUUIDFromBytes((propposedId + destinationGroupId + seed).getBytes(StandardCharsets.UTF_8)); uuid = new UUID(msb, seedId.getLeastSignificantBits()); } LOG.debug("Generating UUID {} from currentId={}, seed={}", uuid, propposedId, seed); return uuid.toString(); }
/** * Sets the identifier of the builder with a UUID generated from the specified seed string. * * @return the builder * @throws IllegalStateException if this method is called when this builder was constructed from an existing User */ public Builder identifierGenerateFromSeed(final String seed) { if (fromUser) { throw new IllegalStateException( "Identifier can not be changed when initialized from an existing user"); } if (seed == null) { throw new IllegalArgumentException("Cannot seed the user identifier with a null value."); } this.identifier = UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).toString(); return this; }
/** * Sets the identifier of the builder with a UUID generated from the specified seed string. * * @return the builder * @throws IllegalStateException if this method is called when this builder was constructed from an existing Group */ public Builder identifierGenerateFromSeed(final String seed) { if (fromGroup) { throw new IllegalStateException( "Identifier can not be changed when initialized from an existing group"); } if (seed == null) { throw new IllegalArgumentException("Cannot seed the group identifier with a null value."); } this.identifier = UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).toString(); return this; }
/** * Sets the identifier of the builder with a UUID generated from the specified seed string. * * @return the builder * @throws IllegalStateException if this method is called when this builder was constructed from an existing Policy */ public Builder identifierGenerateFromSeed(final String seed) { if (fromPolicy) { throw new IllegalStateException( "Identifier can not be changed when initialized from an existing policy"); } if (seed == null) { throw new IllegalArgumentException("Cannot seed the policy identifier with a null value."); } this.identifier = UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).toString(); return this; }
static String getIdentifier(final String seed) { if (StringUtils.isBlank(seed)) { return null; } return UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).toString(); }
public String buildCacheKey() { return UUID.nameUUIDFromBytes( Bytes.concat(kind.getBytes(), identifier, password)).toString(); }
uuid = UUID.nameUUIDFromBytes(androidId .getBytes("utf8")); } else { .getDeviceId(); uuid = deviceId != null ? UUID .nameUUIDFromBytes(deviceId .getBytes("utf8")) : UUID .randomUUID(); .putString(PREFS_DEVICE_ID, uuid.toString()) .commit();
protected String generateUuid() { final Optional<String> seed = getIdGenerationSeed(); UUID uuid; if (seed.isPresent()) { try { UUID seedId = UUID.fromString(seed.get()); uuid = new UUID(seedId.getMostSignificantBits(), seed.get().hashCode()); } catch (Exception e) { logger.warn("Provided 'seed' does not represent UUID. Will not be able to extract most significant bits for ID generation."); uuid = UUID.nameUUIDFromBytes(seed.get().getBytes(StandardCharsets.UTF_8)); } } else { uuid = ComponentIdGenerator.generateId(); } return uuid.toString(); }
public DefaultRequest(String hitType, String trackingId, String appName, String appVersion) { String cId; hitType(isEmpty(hitType)?"pageview":hitType); trackingId(trackingId); applicationName(appName); applicationVersion(appVersion); try { // Use MAC addr and user id to hash into a UUID cId = UUID.nameUUIDFromBytes((InetAddress.getLocalHost().getHostAddress().toString()+System.getProperty("user.name")).getBytes()).toString(); } catch (UnknownHostException e) { cId = UUID.nameUUIDFromBytes(System.getProperty("user.name").getBytes()).toString(); } clientId(cId); }
private void mapToConnectableId(final Collection<? extends Connectable> connectables, final Map<String, List<Connectable>> destination) { for (final Connectable connectable : connectables) { final Optional<String> versionedIdOption = connectable.getVersionedComponentId(); // Determine the Versioned ID by using the ID that is assigned, if one is. Otherwise, // we will calculate the Versioned ID. This allows us to map connectables that currently are not under // version control. We have to do this so that if we are changing flow versions and have a component that is running and it does not exist // in the Versioned Flow, we still need to be able to create an AffectedComponentDTO for it. final String versionedId; if (versionedIdOption.isPresent()) { versionedId = versionedIdOption.get(); } else { versionedId = UUID.nameUUIDFromBytes(connectable.getIdentifier().getBytes(StandardCharsets.UTF_8)).toString(); } final List<Connectable> byVersionedId = destination.computeIfAbsent(versionedId, key -> new ArrayList<>()); byVersionedId.add(connectable); } }
uuid = UUID.nameUUIDFromBytes(androidId.getBytes("utf8")); } else { final String deviceId = ((TelephonyManager) context.getSystemService( Context.TELEPHONY_SERVICE )).getDeviceId(); uuid = deviceId!=null ? UUID.nameUUIDFromBytes(deviceId.getBytes("utf8")) : UUID.randomUUID(); prefs.edit().putString(PREFS_DEVICE_ID, uuid.toString() ).commit();
uuid = UUID.nameUUIDFromBytes(androidId .getBytes("utf8")); } else { .getDeviceId(); uuid = deviceId != null ? UUID .nameUUIDFromBytes(deviceId .getBytes("utf8")) : UUID .randomUUID(); .putString(PREFS_DEVICE_ID, uuid.toString()) .commit();
private Set<String> getAncestorGroupServiceIds() { final Set<String> ancestorServiceIds; ProcessGroup parentGroup = getParent(); if (parentGroup == null) { ancestorServiceIds = Collections.emptySet(); } else { ancestorServiceIds = parentGroup.getControllerServices(true).stream() .map(cs -> { // We want to map the Controller Service to its Versioned Component ID, if it has one. // If it does not have one, we want to generate it in the same way that our Flow Mapper does // because this allows us to find the Controller Service when doing a Flow Diff. final Optional<String> versionedId = cs.getVersionedComponentId(); if (versionedId.isPresent()) { return versionedId.get(); } return UUID.nameUUIDFromBytes(cs.getIdentifier().getBytes(StandardCharsets.UTF_8)).toString(); }) .collect(Collectors.toSet()); } return ancestorServiceIds; }
private Set<String> getAncestorGroupServiceIds(final ProcessGroup group) { final Set<String> ancestorServiceIds; ProcessGroup parentGroup = group.getParent(); if (parentGroup == null) { ancestorServiceIds = Collections.emptySet(); } else { ancestorServiceIds = parentGroup.getControllerServices(true).stream() .map(cs -> { // We want to map the Controller Service to its Versioned Component ID, if it has one. // If it does not have one, we want to generate it in the same way that our Flow Mapper does // because this allows us to find the Controller Service when doing a Flow Diff. final Optional<String> versionedId = cs.getVersionedComponentId(); if (versionedId.isPresent()) { return versionedId.get(); } return UUID.nameUUIDFromBytes(cs.getIdentifier().getBytes(StandardCharsets.UTF_8)).toString(); }) .collect(Collectors.toSet()); } return ancestorServiceIds; }