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.urbancode.ud.client.VersionClient.java

public void deleteVersion(UUID versionId) throws IOException {
    String uri = url + "/rest/deploy/version/" + versionId.toString();

    HttpDelete method = new HttpDelete(uri);
    try {//from  www. j  av a 2s . com
        invokeMethod(method);
    } finally {
        releaseConnection(method);
    }
}

From source file:net.projectmonkey.spring.acl.hbase.repository.AccessControlEntryValue.java

private byte[] createKey(final UUID id, final String authority, final Sid sid, final Permission permission,
        final boolean granting) {
    StringBuilder builder = new StringBuilder(id.toString());
    builder.append(SEPARATOR);//from  w  ww.j  a  v a 2 s.  c  o  m
    builder.append(authority);
    builder.append(SEPARATOR);
    builder.append(SidUtil.isPrincipal(sid));
    builder.append(SEPARATOR);
    builder.append(permission.getMask());
    builder.append(SEPARATOR);
    builder.append(granting);
    return builder.toString().getBytes();
}

From source file:org.ohmage.query.impl.UserImageQueries.java

/**
 * Retrieves the username of the user that created this image.
 * /*from w  ww  . jav a  2s  . c o m*/
 * @param imageId The image's unique identifier.
 * 
 * @return Returns the creator of the image or null if the image doesn't
 *          exist.
 * 
 * @throws DataAccessException Thrown if there is an error.
 */
public String getImageOwner(UUID imageId) throws DataAccessException {
    try {
        return getJdbcTemplate().queryForObject(SQL_GET_IMAGE_OWNER, new Object[] { imageId.toString() },
                String.class);
    } catch (org.springframework.dao.IncorrectResultSizeDataAccessException e) {
        if (e.getActualSize() > 1) {
            throw new DataAccessException("More than one image has the same ID.", e);
        }

        return null;
    } catch (org.springframework.dao.DataAccessException e) {
        throw new DataAccessException(
                "Error executing SQL '" + SQL_GET_IMAGE_OWNER + "' with parameter: " + imageId, e);
    }
}

From source file:lydichris.smashbracket.persistence.EntrantPersistence.java

public Entrant createEntrant(Entrant entrant) {
    UUID uuid = UUID.nameUUIDFromBytes((entrant.getTag() + entrant.getTournamentUuid()).getBytes());
    String SQL = "insert into entrants (uuid, tournament_uuid, user_uuid, tag, seed) values (?, ?, ?, ?, ?)";
    entrant.setUuid(uuid.toString());
    jdbcTemplateObject.update(SQL, entrant.getUuid(), entrant.getTournamentUuid(), entrant.getUserUuid(),
            entrant.getTag(), entrant.getSeed());
    return entrant;
}

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

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

From source file:org.openlmis.fulfillment.util.AuthenticationHelper.java

/**
 * Method returns current user based on Spring context
 * and fetches his data from reference-data service.
 *
 * @return UserDto entity of current user.
 * @throws AuthenticationException if user cannot be found.
 *//*w  ww  . j  a v  a  2s  .  c om*/
public UserDto getCurrentUser() {
    OAuth2Authentication authentication = (OAuth2Authentication) SecurityContextHolder.getContext()
            .getAuthentication();
    UserDto user = null;

    if (!authentication.isClientOnly()) {
        UUID userId = (UUID) authentication.getPrincipal();
        user = userReferenceDataService.findOne(userId);

        if (user == null) {
            throw new AuthenticationException(USER_NOT_FOUND, userId.toString());
        }
    }

    return user;
}

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

/**
 * Fetches StorageDomainTemplate object by id.
 *
 * @return/* w w  w .j a v  a2 s.c o m*/
 *     {@link StorageDomainTemplate }
 *
 * @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 StorageDomainTemplate 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.Template.class, StorageDomainTemplate.class);
}

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

/**
 * Fetches StorageDomainVM object by id.
 *
 * @return/*from   www.  j a v  a 2 s  . c  o m*/
 *     {@link StorageDomainVM }
 *
 * @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 StorageDomainVM 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.VM.class, StorageDomainVM.class);
}

From source file:com.strumsoft.websocket.phonegap.WebSocketFactory.java

public HazardSignal selectHazardSignalByDeviceID(UUID deviceID) {
    for (int i = 0; i < hazardSignalList.size(); i++) {
        if (hazardSignalList.get(i).deviceID.toString().equalsIgnoreCase(deviceID.toString())) {
            return hazardSignalList.get(i);
        }//from  w  ww  . j  a v a 2  s . co m
    }
    return null;
}

From source file:org.trustedanalytics.user.current.AuthorizationController.java

/**
 * Returns permissions for user within specified organizations.
 *
 * @param orgs           UUIDs//from  w  w  w .j  av a  2 s  .co m
 * @param authentication authentication
 * @return permissions
 */
private Collection<CcOrgPermission> resolvePermissions(Collection<UUID> orgs, Authentication authentication) {
    final UUID user = detailsFinder.findUserId(authentication);
    final UserRole role = detailsFinder.getRole(authentication);

    LOGGER.info("Resolving permissions for user: {}", user.toString());
    return UserRole.ADMIN.equals(role) ? resolveAdminPermissions(orgs) : resolveUserPermissions(user, orgs);
}