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:ccc.cli.NewDBQueries.java

/**
 * Creates migration user./* w  ww . j a  v a 2  s .  c  o m*/
 *
 * @param username The username for the new user.
 * @param email The email for the new user.
 * @param password The password for the new user.
 *
 * @return UUID of the created user.
 */
public UUID insertMigrationUser(final String username, final String email, final String password) {
    final UUID uid = UUID.randomUUID();
    final byte[] hash = Encryption.hash(password, uid.toString());

    PreparedStatement ps = null;

    try {
        // insert user
        ps = _connection.prepareStatement(
                "INSERT INTO users (id, email, username, vn, hash, name) " + "VALUES (?,?,?,?,?,?)");
        ps.setString(1, uid.toString());
        ps.setString(2, email);
        ps.setString(3, username);
        ps.setInt(4, 0);
        ps.setBytes(5, hash);
        ps.setString(6, username);
        ps.executeUpdate();

        final PreparedStatement gs = _connection.prepareStatement("select id from groups where name in "
                + "('ADMINISTRATOR', 'SITE_BUILDER', 'CONTENT_CREATOR')");
        final ResultSet groups = gs.executeQuery();

        // insert permission
        while (groups.next()) {
            ps = _connection.prepareStatement("INSERT INTO user_roles (user_id, group_id) " + "VALUES (?, ?)");
            ps.setString(1, uid.toString());
            ps.setString(2, groups.getString(1));
            ps.executeUpdate();
        }

        groups.close();
        gs.close();

        _connection.commit();
    } catch (final SQLException e) {
        throw new RuntimeException(e);
    } finally {
        DbUtils.closeQuietly(ps);
    }
    return uid;
}

From source file:org.ovirt.engine.sdk.decorators.InstanceTypeWatchDogs.java

/**
 * Fetches InstanceTypeWatchDog object by id.
 *
 * @return//from   w w w .jav a 2 s.c  om
 *     {@link InstanceTypeWatchDog }
 *
 * @throws ClientProtocolException
 *             Signals that HTTP/S protocol error has occurred.
 * @throws ServerException
 *             Signals that an oVirt api error has occurred.
 * @throws IOException
 *             Signals that an I/O exception of some sort has occurred.
 */
@Override
public InstanceTypeWatchDog get(UUID id) throws ClientProtocolException, ServerException, IOException {
    String url = this.parent.getHref() + SLASH + getName() + SLASH + id.toString();
    return getProxy().get(url, org.ovirt.engine.sdk.entities.WatchDog.class, InstanceTypeWatchDog.class);
}

From source file:org.ovirt.engine.sdk.decorators.SchedulingPolicyBalances.java

/**
 * Fetches SchedulingPolicyBalance object by id.
 *
 * @return/*from  w w  w  . j  a va 2  s .  c  o  m*/
 *     {@link SchedulingPolicyBalance }
 *
 * @throws ClientProtocolException
 *             Signals that HTTP/S protocol error has occurred.
 * @throws ServerException
 *             Signals that an oVirt api error has occurred.
 * @throws IOException
 *             Signals that an I/O exception of some sort has occurred.
 */
@Override
public SchedulingPolicyBalance get(UUID id) throws ClientProtocolException, ServerException, IOException {
    String url = this.parent.getHref() + SLASH + getName() + SLASH + id.toString();
    return getProxy().get(url, org.ovirt.engine.sdk.entities.Balance.class, SchedulingPolicyBalance.class);
}

From source file:org.ovirt.engine.sdk.decorators.SchedulingPolicyFilters.java

/**
 * Fetches SchedulingPolicyFilter object by id.
 *
 * @return/*from  ww w  .  j  av  a  2s .c om*/
 *     {@link SchedulingPolicyFilter }
 *
 * @throws ClientProtocolException
 *             Signals that HTTP/S protocol error has occurred.
 * @throws ServerException
 *             Signals that an oVirt api error has occurred.
 * @throws IOException
 *             Signals that an I/O exception of some sort has occurred.
 */
@Override
public SchedulingPolicyFilter get(UUID id) throws ClientProtocolException, ServerException, IOException {
    String url = this.parent.getHref() + SLASH + getName() + SLASH + id.toString();
    return getProxy().get(url, org.ovirt.engine.sdk.entities.Filter.class, SchedulingPolicyFilter.class);
}

From source file:org.ovirt.engine.sdk.decorators.SchedulingPolicyWeights.java

/**
 * Fetches SchedulingPolicyWeight object by id.
 *
 * @return//  ww  w .j  ava 2  s  . c  om
 *     {@link SchedulingPolicyWeight }
 *
 * @throws ClientProtocolException
 *             Signals that HTTP/S protocol error has occurred.
 * @throws ServerException
 *             Signals that an oVirt api error has occurred.
 * @throws IOException
 *             Signals that an I/O exception of some sort has occurred.
 */
@Override
public SchedulingPolicyWeight get(UUID id) throws ClientProtocolException, ServerException, IOException {
    String url = this.parent.getHref() + SLASH + getName() + SLASH + id.toString();
    return getProxy().get(url, org.ovirt.engine.sdk.entities.Weight.class, SchedulingPolicyWeight.class);
}

From source file:org.ovirt.engine.sdk.decorators.VMDiskPermissions.java

/**
 * Fetches VMDiskPermission object by id.
 *
 * @return/*w  w w  .j  av  a2s.c o  m*/
 *     {@link VMDiskPermission }
 *
 * @throws ClientProtocolException
 *             Signals that HTTP/S protocol error has occurred.
 * @throws ServerException
 *             Signals that an oVirt api error has occurred.
 * @throws IOException
 *             Signals that an I/O exception of some sort has occurred.
 */
@Override
public VMDiskPermission get(UUID id) throws ClientProtocolException, ServerException, IOException {
    String url = this.parent.getHref() + SLASH + getName() + SLASH + id.toString();
    return getProxy().get(url, org.ovirt.engine.sdk.entities.Permission.class, VMDiskPermission.class);
}

From source file:mx.bigdata.cfdi.TFDv1.java

private TimbreFiscalDigital createStamp() {
    ObjectFactory of = new ObjectFactory();
    TimbreFiscalDigital tfd = of.createTimbreFiscalDigital();
    tfd.setVersion("1.0");
    Date date = new Date();
    tfd.setFechaTimbrado(date);//from   ww w . j  a va 2  s . c  om
    tfd.setSelloCFD(cfdSignature);
    UUID uuid = UUID.randomUUID();
    tfd.setUUID(uuid.toString());
    tfd.setNoCertificadoSAT("30001000000100000801");
    return tfd;
}

From source file:net.portalblock.untamedchat.bungee.providers.RedisBungeeProvider.java

@Override
public void setSpying(UUID player, boolean mode) {
    JSONObject msg = new JSONObject();
    msg.put("type", "spy");
    msg.put("uuid", player.toString());
    msg.put("mode", mode);
    api.sendChannelMessage(UntamedChat.TOG_CHANNEL, msg.toString());
}

From source file:org.ovirt.engine.sdk.decorators.DataCenterIscsiBondNetworks.java

/**
 * Fetches DataCenterIscsiBondNetwork object by id.
 *
 * @return/*  www  . j  a v a  2s  . co m*/
 *     {@link DataCenterIscsiBondNetwork }
 *
 * @throws ClientProtocolException
 *             Signals that HTTP/S protocol error has occurred.
 * @throws ServerException
 *             Signals that an oVirt api error has occurred.
 * @throws IOException
 *             Signals that an I/O exception of some sort has occurred.
 */
@Override
public DataCenterIscsiBondNetwork get(UUID id) throws ClientProtocolException, ServerException, IOException {
    String url = this.parent.getHref() + SLASH + getName() + SLASH + id.toString();
    return getProxy().get(url, org.ovirt.engine.sdk.entities.Network.class, DataCenterIscsiBondNetwork.class);
}

From source file:net.portalblock.untamedchat.bungee.providers.RedisBungeeProvider.java

@Override
public void setGlobalMode(UUID player, boolean mode) {
    JSONObject msg = new JSONObject();
    msg.put("type", "chat");
    msg.put("uuid", player.toString());
    msg.put("mode", mode);
    api.sendChannelMessage(UntamedChat.TOG_CHANNEL, msg.toString());
}