本文整理汇总了Java中org.safehaus.uuid.UUID类的典型用法代码示例。如果您正苦于以下问题:Java UUID类的具体用法?Java UUID怎么用?Java UUID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UUID类属于org.safehaus.uuid包,在下文中一共展示了UUID类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isGUID
import org.safehaus.uuid.UUID; //导入依赖的package包/类
private boolean isGUID(String guid)
{
try
{
UUID id = new UUID(guid);
// We have a valid guid.
return true;
}
catch (NumberFormatException e)
{
// Not a valid GUID
}
return false;
}
示例2: getMetadataFromShareIdWithInvalidId
import org.safehaus.uuid.UUID; //导入依赖的package包/类
@Test(expected=InvalidSharedIdException.class) public void getMetadataFromShareIdWithInvalidId()
{
UUID uuid = UUIDGenerator.getInstance().generateRandomBasedUUID();
String sharedId = Base64.encodeBase64URLSafeString(uuid.toByteArray()); // => 22 chars (eg. q3bEKPeDQvmJYgt4hJxOjw)
Map<String, Object> metadata = quickShareService.getMetaData(sharedId);
}
示例3: getTransactionId
import org.safehaus.uuid.UUID; //导入依赖的package包/类
/**
* Returns a random-based UUID.
*/
public String getTransactionId(GatekeeperMessage requestMessage, ClientInformation clientInformation)
{
// Generate a UUID based on a random generation.
UUID uuid = UUIDGenerator.getInstance().generateRandomBasedUUID();
return uuid.toString();
}
示例4: getTransactionId
import org.safehaus.uuid.UUID; //导入依赖的package包/类
/**
* If the application property <tt>externalUUID</tt> is available, the value of this property
* is returned as the transaction ID. If the property is not availble a new random-based
* UUID is generated using the JUG library.
*/
public String getTransactionId(GatekeeperMessage requestMessage, ClientInformation clientInformation)
{
// Use the external UUID as a transaction ID, if it's available.
String externalUuid = requestMessage.getApplicationProperties().getProperty("externalUUID");
if (externalUuid != null && externalUuid.length() > 0) {
return externalUuid;
}
// Use a generated UUID based on a random generation as a fallback if the external UUID isn't available.
UUID uuid = UUIDGenerator.getInstance().generateRandomBasedUUID();
return uuid.toString();
}
示例5: addProduct
import org.safehaus.uuid.UUID; //导入依赖的package包/类
public synchronized void addProduct(Product product)
throws CatalogException {
if(product.getProductId()!=null && CATALOG_CACHE.containsKey(product.getProductId())) {
throw new CatalogException(
"Attempt to add a product that already existed: product: ["
+ product.getProductName() + "]");
} else {
// haven't cached this product yet, so let's cache it
CompleteProduct completeProduct = new CompleteProduct();
// NOTE: reuse existing ID if possible
if (product.getProductId() == null) {
synchronized (completeProduct) {
// now generate a unique ID for the product
UUID prodUUID = generator.generateTimeBasedUUID();
product.setProductId(prodUUID.toString());
}
}
completeProduct.setProduct(product);
CATALOG_CACHE.put(product.getProductId(), completeProduct);
}
}
示例6: addWorkflowInstance
import org.safehaus.uuid.UUID; //导入依赖的package包/类
public synchronized void addWorkflowInstance(WorkflowInstance wInst)
throws InstanceRepositoryException {
// generate UUID for inst
UUID uuid = UUIDGenerator.getInstance().generateTimeBasedUUID();
wInst.setId(uuid.toString());
addWorkflowInstanceToCatalog(wInst);
}
示例7: saveSharedLinkExpiryAction
import org.safehaus.uuid.UUID; //导入依赖的package包/类
/**
* Creates and persists the quick share link expiry action and its related schedule.
*/
protected void saveSharedLinkExpiryAction(String sharedId, Date expiryDate)
{
ParameterCheck.mandatory("expiryDate", expiryDate);
// Validate the given expiry date
checkExpiryDate(expiryDate);
if (logger.isDebugEnabled())
{
logger.debug("Creating shared link expiry action for the sharedId:" + sharedId);
}
final NodeRef expiryActionNodeRef = getQuickShareLinkExpiryActionNode(sharedId);
// If an expiry action already exists for the specified shared Id, first remove it, before creating a new one.
if (expiryActionNodeRef != null)
{
deleteQuickShareLinkExpiryAction(expiryActionNodeRef);
}
// Create the expiry action
final QuickShareLinkExpiryAction expiryAction = new QuickShareLinkExpiryActionImpl(java.util.UUID.randomUUID().toString(), sharedId,
"QuickShare link expiry action");
// Create the persisted schedule
final ScheduledPersistedAction schedule = scheduledPersistedActionService.createSchedule(expiryAction);
// first set the scheduledAction so we can set the other information
expiryAction.setSchedule(schedule);
expiryAction.setScheduleStart(expiryDate);
try
{
TenantUtil.runAsDefaultTenant((TenantRunAsWork<Void>) () -> {
quickShareLinkExpiryActionPersister.saveQuickShareLinkExpiryAction(expiryAction);
scheduledPersistedActionService.saveSchedule(schedule);
return null;
});
}
catch (Exception ex)
{
throw new QuickShareLinkExpiryActionException("Couldn't create quick share link expiry action.", ex);
}
if (logger.isDebugEnabled())
{
logger.debug("Quick share link expiry action is created for sharedId[" + sharedId + "] and it's scheduled to be executed on: "
+ expiryDate);
}
}
示例8: get
import org.safehaus.uuid.UUID; //导入依赖的package包/类
public String get() {
// UUID uuid = UUIDGenerator.getInstance().generateRandomBasedUUID();
UUID uuid = UUID.randomUUID();
return StringUtils.remove(uuid.toString(), '-');
}
示例9: getUUID
import org.safehaus.uuid.UUID; //导入依赖的package包/类
public static UUID getUUID() {
return ug.generateTimeBasedUUID(eAddr);
}
示例10: get
import org.safehaus.uuid.UUID; //导入依赖的package包/类
public String get() {
UUID uuid = UUIDGenerator.getInstance().generateRandomBasedUUID();
return StringUtils.remove(uuid.toString(), '-');
}
示例11: getUUID
import org.safehaus.uuid.UUID; //导入依赖的package包/类
public static UUID getUUID() {
return ug.generateTimeBasedUUID( eAddr );
}