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:de.taimos.dvalin.interconnect.core.InterconnectConnector.java

/**
 * @param uuid          Universally unique identifier of the request
 * @param queueName     Queue name//from  w  w  w .j av a  2 s . c o  m
 * @param requestICO    Request Interconnect Object
 * @param customHeaders Headers
 * @return Response Interconnect Object
 * @throws InfrastructureException If an infrastructure error occurs
 * @throws JsonGenerationException if the JSON data could not be generated
 * @throws JsonMappingException    if the object could not be mapped to a JSON string
 * @throws IOException             if an I/O related problem occurred
 */
public static InterconnectObject request(final UUID uuid, final String queueName,
        final InterconnectObject requestICO, final Map<String, Object> customHeaders)
        throws InfrastructureException, IOException {
    Preconditions.checkNotNull(uuid, "Universally unique identifier of the request");
    Preconditions.checkNotNull(queueName, "Queue name");
    Preconditions.checkNotNull(requestICO, "Request Interconnect Object");
    final String body = InterconnectMapper.toJson(requestICO);
    final Map<String, Object> headers;
    if (customHeaders == null) {
        headers = new HashMap<>(2);
    } else {
        headers = new HashMap<>(customHeaders);
    }
    headers.put(InterconnectConnector.HEADER_REQUEST_UUID, uuid.toString());
    headers.put(InterconnectConnector.HEADER_ICO_CLASS, requestICO.getClass().getName());
    final TextMessage response = MessageConnector.request(queueName, body, headers);
    try {
        return InterconnectMapper.fromJson(response.getText());
    } catch (final JMSException e) {
        throw new InfrastructureException("Failed to read message");
    }
}

From source file:eu.dasish.annotation.backend.dao.impl.JdbcPrincipalDao.java

@Override
public Number addPrincipal(Principal principal, String remoteID) throws NotInDataBaseException {

    UUID externalIdentifier = Helpers.generateUUID();
    String newExternalIdentifier = externalIdentifier.toString();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("externalId", newExternalIdentifier);
    params.put("principalName", principal.getDisplayName());
    params.put("email", principal.getEMail());
    params.put("remoteID", remoteID);
    params.put("accountType", "user");
    StringBuilder sql = new StringBuilder("INSERT INTO ");
    sql.append(principalTableName).append("(").append(external_id).append(",").append(principal_name)
            .append(",").append(e_mail).append(",").append(remote_id).append(",").append(account)
            .append(" ) VALUES (:externalId, :principalName, :email, :remoteID, :accountType)");
    final int affectedRows = this.loggedUpdate(sql.toString(), params);
    return getInternalID(externalIdentifier);
}

From source file:org.trustedanalytics.users.orgs.OrgsControllerTest.java

@Test(expected = RuntimeException.class)
public void renameOrg_organization_does_not_exist() {
    UUID orgId = UUID.randomUUID();
    String testName = "test-name";

    OrgNameRequest request = new OrgNameRequest();
    request.setName(testName);/*  w w w  . j a v a2 s .c om*/

    doThrow(new RuntimeException()).when(cfClient).renameOrg(orgId, testName);
    sut.renameOrg(request, orgId.toString());
    verify(cfClient).renameOrg(orgId, testName);
}

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

/**
 * Fetches GroupRole object by id.//from  w ww  .j a va 2s  .  c o m
 *
 * @return
 *     {@link GroupRole }
 *
 * @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 GroupRole 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.Role.class, GroupRole.class);
}

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

/**
 * Fetches GroupTag object by id./*ww w .  ja va 2  s. c  o  m*/
 *
 * @return
 *     {@link GroupTag }
 *
 * @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 GroupTag 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.Tag.class, GroupTag.class);
}

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

/**
 * Fetches HostTag object by id.//  w  ww.  j  a v  a 2 s. c om
 *
 * @return
 *     {@link HostTag }
 *
 * @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 HostTag 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.Tag.class, HostTag.class);
}

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

/**
 * Fetches RolePermit object by id.//from  w w  w  . ja v  a 2  s  .co m
 *
 * @return
 *     {@link RolePermit }
 *
 * @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 RolePermit 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.Permit.class, RolePermit.class);
}

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

/**
 * Fetches TemplateTag object by id./*  w ww .  j av a2  s. co m*/
 *
 * @return
 *     {@link TemplateTag }
 *
 * @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 TemplateTag 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.Tag.class, TemplateTag.class);
}

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

/**
 * Fetches UserRole object by id./*from   w  w  w.j  a  va2s.  c o  m*/
 *
 * @return
 *     {@link UserRole }
 *
 * @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 UserRole 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.Role.class, UserRole.class);
}

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

/**
 * Fetches UserTag object by id./*from  ww w.  j  ava  2  s.  c  om*/
 *
 * @return
 *     {@link UserTag }
 *
 * @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 UserTag 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.Tag.class, UserTag.class);
}