当前位置: 首页>>代码示例>>Java>>正文


Java UUID类代码示例

本文整理汇总了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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:IndexInfo.java

示例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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:QuickShareServiceIntegrationTest.java

示例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();
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:10,代码来源:DefaultTransactionIdProvider.java

示例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();
}
 
开发者ID:guptavishal,项目名称:jets3t-aws-roles,代码行数:17,代码来源:ExternalUuidProvider.java

示例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);

    }

}
 
开发者ID:apache,项目名称:oodt,代码行数:31,代码来源:LuceneCatalog.java

示例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);

}
 
开发者ID:apache,项目名称:oodt,代码行数:10,代码来源:LuceneWorkflowInstanceRepository.java

示例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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:53,代码来源:QuickShareServiceImpl.java

示例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(), '-');
	}
 
开发者ID:huanzhou,项目名称:jeecms6,代码行数:6,代码来源:JugUUIDGenerator.java

示例9: getUUID

import org.safehaus.uuid.UUID; //导入依赖的package包/类
public static UUID getUUID() {
    return ug.generateTimeBasedUUID(eAddr);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:4,代码来源:UUIDUtil.java

示例10: get

import org.safehaus.uuid.UUID; //导入依赖的package包/类
public String get() {
	UUID uuid = UUIDGenerator.getInstance().generateRandomBasedUUID();
	return StringUtils.remove(uuid.toString(), '-');
}
 
开发者ID:caipiao,项目名称:Lottery,代码行数:5,代码来源:JugUUIDGenerator.java

示例11: getUUID

import org.safehaus.uuid.UUID; //导入依赖的package包/类
public static UUID getUUID() {
  return ug.generateTimeBasedUUID( eAddr );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:4,代码来源:UUIDUtil.java


注:本文中的org.safehaus.uuid.UUID类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。