Example usage for java.util UUID toString

List of usage examples for java.util UUID toString

Introduction

In this page you can find the example usage for java.util UUID toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this UUID .

Usage

From source file:com.spectralogic.ds3cli.integration.test.helpers.ABMTestHelper.java

/**
 * Deletes a storage domain member with the specified ID, and verifies that said storage
 * domain member was deleted. If the member was not properly deleted, then an error is logged.
 *//*from w w  w  .  jav a 2 s  .c  o  m*/
public static void deleteStorageDomainMember(final UUID memberId, final Ds3Client client) {
    if (memberId == null) {
        //This might not be an error if this function is called as part of cleanup code
        LOG.debug("Member Id was null");
        return;
    }
    //Delete the storage domain member
    try {
        final DeleteStorageDomainMemberSpectraS3Response deleteMember = client
                .deleteStorageDomainMemberSpectraS3(
                        new DeleteStorageDomainMemberSpectraS3Request(memberId.toString()));
        assertThat(deleteMember.getStatusCode(), is(204));
    } catch (final IOException | AssertionError e) {
        LOG.error("Storage domain member was not deleted as expected: {}", memberId.toString());
    }

    //Verify that the storage domain member was deleted
    try {
        client.getStorageDomainMemberSpectraS3(new GetStorageDomainMemberSpectraS3Request(memberId.toString()));
        LOG.error("Storage domain member still exists despite deletion attempt: {}", memberId.toString());
    } catch (final IOException e) {
        //Pass: expected storage domain member to not exist
    }
}

From source file:org.lol.reddit.fragments.PostListingFragment.java

public static PostListingFragment newInstance(final Uri url, final UUID session,
        final CacheRequest.DownloadType downloadType) {

    final PostListingFragment f = new PostListingFragment();

    final Bundle bundle = new Bundle(4);

    bundle.putString("url", url.toString());
    if (session != null)
        bundle.putString("session", session.toString());
    bundle.putString("downloadType", downloadType.name());

    f.setArguments(bundle);// w ww.  j  a v a  2  s .  c o  m

    return f;
}

From source file:com.spectralogic.ds3cli.helpers.ABMTestHelper.java

/**
 * Deletes a data persistence rule with the specified ID, and verifies that said data
 * persistence rule was deleted. If the rule was not properly deleted, then an error is logged.
 *//*www  .j av a 2  s  . com*/
public static void deleteDataPersistenceRule(final UUID dataPersistenceRuleId, final Ds3Client client) {
    if (dataPersistenceRuleId == null) {
        //This might not be an error if this function is called as part of cleanup code
        LOG.debug("Data persistence rule Id was null");
        return;
    }

    //Delete the data persistence rule
    try {
        final DeleteDataPersistenceRuleSpectraS3Response deleteResponse = client
                .deleteDataPersistenceRuleSpectraS3(
                        new DeleteDataPersistenceRuleSpectraS3Request(dataPersistenceRuleId.toString()));
    } catch (final IOException | AssertionError e) {
        LOG.error("Data persistence rule was not deleted as expected: {}", dataPersistenceRuleId.toString());
    }

    //Verify that the data persistence rule was deleted
    try {
        client.getDataPersistenceRuleSpectraS3(
                new GetDataPersistenceRuleSpectraS3Request(dataPersistenceRuleId.toString()));
        LOG.error("Data persistence rule still exists despite deletion attempt: {}",
                dataPersistenceRuleId.toString());
    } catch (final IOException e) {
        //Pass: expected data persistence rule to not exist
    }
}

From source file:Main.java

private static UUID getUuid(Context c) {
    final SharedPreferences prefs = c.getSharedPreferences(ID_PREFS_FILE, Context.MODE_PRIVATE);
    final String id = prefs.getString(ID_PREFS_DEVICE_ID, null);
    final UUID uuid;
    if (id != null) {
        uuid = UUID.fromString(id);
    } else {/*  w ww. j  av a2  s.  c om*/
        final String androidId = Secure.getString(c.getContentResolver(), Secure.ANDROID_ID);
        try {
            if (!BAD_UUID.equals(androidId)) {
                uuid = UUID.nameUUIDFromBytes(androidId.getBytes("utf8"));
            } else {
                final String deviceId = ((TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE))
                        .getDeviceId();
                if (deviceId != null)
                    uuid = UUID.nameUUIDFromBytes(deviceId.getBytes("utf8"));
                else
                    uuid = UUID.randomUUID();
            }
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        prefs.edit().putString(ID_PREFS_DEVICE_ID, uuid.toString()).commit();
    }
    return uuid;
}

From source file:com.spectralogic.ds3cli.integration.test.helpers.ABMTestHelper.java

/**
 * Deletes a data persistence rule with the specified ID, and verifies that said data
 * persistence rule was deleted. If the rule was not properly deleted, then an error is logged.
 *///from  w  ww. j ava2  s .co  m
public static void deleteDataPersistenceRule(final UUID dataPersistenceRuleId, final Ds3Client client) {
    if (dataPersistenceRuleId == null) {
        //This might not be an error if this function is called as part of cleanup code
        LOG.debug("Data persistence rule Id was null");
        return;
    }

    //Delete the data persistence rule
    try {
        final DeleteDataPersistenceRuleSpectraS3Response deleteResponse = client
                .deleteDataPersistenceRuleSpectraS3(
                        new DeleteDataPersistenceRuleSpectraS3Request(dataPersistenceRuleId.toString()));
        assertThat(deleteResponse.getStatusCode(), is(204));
    } catch (final IOException | AssertionError e) {
        LOG.error("Data persistence rule was not deleted as expected: {}", dataPersistenceRuleId.toString());
    }

    //Verify that the data persistence rule was deleted
    try {
        client.getDataPersistenceRuleSpectraS3(
                new GetDataPersistenceRuleSpectraS3Request(dataPersistenceRuleId.toString()));
        LOG.error("Data persistence rule still exists despite deletion attempt: {}",
                dataPersistenceRuleId.toString());
    } catch (final IOException e) {
        //Pass: expected data persistence rule to not exist
    }
}

From source file:org.trustedanalytics.servicecatalog.service.model.ServiceInstanceMetadata.java

public ServiceInstanceMetadata(UUID creatorUUID, String creatorName) {
    this.creatorUUID = creatorUUID.toString();
    this.creatorName = creatorName;
}

From source file:org.noorganization.instalist.comm.message.CategoryInfo.java

public void setUUID(UUID uuid) {
    setUUID(uuid.toString());
}

From source file:org.noorganization.instalist.comm.message.CategoryInfo.java

public CategoryInfo withUUID(UUID uuid) {
    setUUID(uuid.toString());
    return this;
}

From source file:com.moha.demo.utils.Hashsalt.java

public AsUser saveTo(String password) {
    UUID uuid = UUID.randomUUID();
    String salt = uuid.toString().replace("-", "");
    String hashPassword = encrypt(password + salt);
    AsUser u = new AsUser();
    u.setSalt(salt);/*from w  ww .j  a v a 2  s  . c o  m*/
    u.setUserPassword(hashPassword);
    return u;
}

From source file:gov.nih.nci.ncicb.tcga.dcc.dam.web.editor.UUIDEditor.java

@Override
public String getAsText() {
    UUID u = (UUID) getValue();
    logger.debug("Get Converted UUID: " + u);
    return u.toString();
}