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.seventh_root.ld33.common.player.Player.java

public static Player getByUUID(Connection databaseConnection, UUID uuid) throws SQLException {
    if (playersByUUID.containsKey(uuid.toString()))
        return playersByUUID.get(uuid.toString());
    if (databaseConnection != null) {
        PreparedStatement statement = databaseConnection.prepareStatement(
                "SELECT uuid, name, password_hash, password_salt, resources FROM player WHERE uuid = ? LIMIT 1");
        statement.setString(1, uuid.toString());
        ResultSet resultSet = statement.executeQuery();
        if (resultSet.next()) {
            Player player = new Player(databaseConnection, UUID.fromString(resultSet.getString("uuid")),
                    resultSet.getString("name"), resultSet.getString("password_hash"),
                    resultSet.getString("password_salt"), resultSet.getInt("resources"));
            cachePlayer(player);// w w  w  .ja  v  a  2 s.co m
            return player;
        }
    }
    return null;
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsg.CFAccXMsgSchemaMessageFormatter.java

public static String formatRqstLogOut(String separator, UUID secSessionId) {
    String retval = "<RqstLogOut "
            + CFLibXmlUtil.formatRequiredXmlString(null, "SecSessionId", secSessionId.toString()) + " />";
    return (retval);
}

From source file:gov.va.vinci.leo.tools.LeoUtils.java

/**
 * Generate a random UUID string./*from  ww w .j ava  2s .  c o  m*/
 *
 * @return String representation of a UUID
 */
public static String getUUID() {
    UUID id = UUID.randomUUID();
    return id.toString();
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsg.CFAccXMsgSchemaMessageFormatter.java

public static String formatRspnLoggedOut(String separator, UUID secSessionId) {
    String retval = "<RspnLoggedOut "
            + CFLibXmlUtil.formatRequiredXmlString(null, "SecSessionId", secSessionId.toString()) + " />";
    return (retval);
}

From source file:com.scf.utils.UUIDUtilies.java

public static String decodeBase64Uuid(String compressedUuid) {

    byte[] byUuid = Base64.decodeBase64(compressedUuid);

    ByteBuffer bb = ByteBuffer.wrap(byUuid);
    UUID uuid = new UUID(bb.getLong(), bb.getLong());
    return uuid.toString();
}

From source file:com.vangent.hieos.services.xds.bridge.utils.UUIDUtils.java

/**
 * Method description//from w w w.j  a v a2  s .com
 *
 *
 * @param uuid
 * @param prefix
 *
 * @return
 */
public static String toOID(UUID uuid, String prefix) {

    String result = null;

    if ((uuid != null) && StringUtils.isNotBlank(prefix)) {

        String uuidstr = uuid.toString().replaceAll("-", "");
        BigInteger bi = new BigInteger(uuidstr, 16);

        result = String.format("%s.%s", prefix, bi.toString());
    }

    return result;
}

From source file:org.apache.usergrid.android.sdk.utils.JsonUtils.java

public static void setUUIDProperty(Map<String, JsonNode> properties, String name, UUID value) {
    if (value == null) {
        properties.remove(name);/*from w ww. ja  v a  2 s. c om*/
    } else {
        properties.put(name, JsonNodeFactory.instance.textNode(value.toString()));
    }
}

From source file:org.usergrid.services.assets.data.AssetUtils.java

/**
 * Returns the key for the bucket in the following form:
 * [appId]/[{@link org.usergrid.persistence.entities.Asset#getPath()}
 * @param appId/*w  ww. ja va2s .  c om*/
 * @param asset
 * @return
 */
public static String buildAssetKey(UUID appId, Asset asset) {
    Preconditions.checkArgument(asset.getUuid() != null, "The asset provided to buildAssetKey had a null UUID");
    Preconditions.checkArgument(appId != null, "The appId provided to buildAssetKey was null");
    return appId.toString().concat("/").concat(asset.getUuid().toString());
}

From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.ProfileObj.java

public static Obj getLocalProperties(Context c) {
    JSONObject obj = new JSONObject();
    try {/*w  ww  . j a v  a2s .  c  o m*/
        // TODO: Framework.
        BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
        if (btAdapter != null) {
            UUID btUuid = ContentCorral.getLocalBluetoothServiceUuid(c);
            String btMac = btAdapter.getAddress();
            obj.put(Contact.ATTR_BT_MAC, btMac);
            obj.put(Contact.ATTR_BT_CORRAL_UUID, btUuid.toString());
        }
        obj.put(Contact.ATTR_PROTOCOL_VERSION, App.POSI_VERSION);
    } catch (JSONException e) {
    }
    return new MemObj("userAttributes", obj);
}

From source file:de.cubeisland.engine.core.util.McUUID.java

public static NameEntry[] getNameHistory(UUID playerUUID) {
    try {//from  ww  w.  j a  va2s. c  o  m
        HttpURLConnection connection = (HttpURLConnection) new URL(
                String.format(MOJANG_API_URL_UUID_NAMEHISTORY, playerUUID.toString().replace("-", "")))
                        .openConnection();
        return mapper.readValue(connection.getInputStream(), NameEntry[].class);
    } catch (MalformedURLException e) {
        throw new IllegalStateException(e);
    } catch (IOException e) {
        CubeEngine.getLog().error(e, "Could not retrieve NameHistory for given UUID!");
        return emptyHistory;
    }
}