Example usage for java.util UUID fromString

List of usage examples for java.util UUID fromString

Introduction

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

Prototype

public static UUID fromString(String name) 

Source Link

Document

Creates a UUID from the string standard representation as described in the #toString method.

Usage

From source file:ca.watier.echechess.server.UiSessionHandlerInterceptor.java

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
    boolean isAllowed = false;

    String[] uiUuids = request.getParameterValues("uiUuid");

    if (ArrayUtils.isNotEmpty(uiUuids)) { //Authorize only those with an active ui session
        String uiUuid = uiUuids[0];
        isAllowed = uiSessionService.isUiSessionActive(UUID.fromString(uiUuid));

        if (!isAllowed) {
            webSocketService.fireUiEvent(uiUuid, ChessEventMessage.UI_SESSION_EXPIRED,
                    THE_CLIENT_LOST_THE_CONNECTION);
        }/*w  w  w .ja v  a2 s  . co m*/
    }

    return isAllowed;
}

From source file:com.drevelopment.couponcodes.bukkit.BukkitServerModTransformer.java

@Override
public Player getModPlayer(String uuid) {
    org.bukkit.entity.Player bukkitPlayer = Bukkit.getPlayer(UUID.fromString(uuid));

    if (bukkitPlayer == null)
        return null;

    return new BukkitPlayer(plugin, bukkitPlayer);
}

From source file:fm.last.musicbrainz.data.dao.impl.ReleaseDaoImplIT.java

@Test
public void getByNotExistingGidReturnsNull() {
    UUID gid = UUID.fromString("b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d");
    Release release = dao.getByGid(gid);
    assertThat(release, is(nullValue()));
}

From source file:org.trustedanalytics.servicebroker.hdfs.plans.HdfsPlanEncrypted.java

@Override
public void provision(ServiceInstance serviceInstance, Optional<Map<String, Object>> parameters)
        throws ServiceInstanceExistsException, ServiceBrokerException {
    UUID instanceId = UUID.fromString(serviceInstance.getServiceInstanceId());
    UUID orgId = UUID.fromString(serviceInstance.getOrganizationGuid());
    hdfsOperations.provisionDirectory(instanceId, orgId);
    hdfsOperations.createEncryptedZone(instanceId, orgId);
}

From source file:eu.griend.grpf.controller.NodeController.java

@RequestMapping(value = "/nodes/{id}", method = RequestMethod.PUT)
public void updateNode(@PathVariable String id, @RequestBody NodeEntity node) {
    UUID uuid = UUID.fromString(id);

    this.nodeService.updateNode(uuid, node);
}

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

public static UUID getUUIDFromString(String id) {
    return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-"
            + id.substring(16, 20) + "-" + id.substring(20, 32));
}

From source file:org.unidle.social.ConnectionRepositoryFactory.java

public ConnectionRepository getConnectionRepository(final String userId) {
    final User user = userRepository.findOne(UUID.fromString(userId));

    return new ConnectionRepositoryImpl(connectionFactoryLocator, textEncryptor, userConnectionRepository,
            user);/*from   w ww  .  ja va  2  s  .  c o m*/
}

From source file:edu.stanford.junction.provider.bluetooth.JunctionProvider.java

@Override
public Junction newJunction(URI uri, ActivityScript script, JunctionActor actor) throws JunctionException {
    mConfig.setUuid(UUID.fromString(uri.getPath().substring(1)));
    return new edu.stanford.junction.provider.bluetooth.Junction(uri, script, actor, mConfig);
}

From source file:org.unidle.service.UserServiceImpl.java

@Override
@Transactional(readOnly = true)/*from w  ww  . j av  a  2  s . c om*/
public User currentUser() {

    final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

    if (authentication == null) {
        return null;
    }

    final String uuid = authentication.getName();

    return userRepository.findOne(UUID.fromString(uuid));
}

From source file:fm.last.musicbrainz.data.dao.impl.ArtistDaoImplIT.java

@Test
public void getByExistingRedirectedGidReturnsOneArtist() {
    UUID gid = UUID.fromString("a934e33f-b3cb-47dd-9638-f7f1f25fe162");
    Artist artist = dao.getByGid(gid);//from   w  ww.j  a  va 2  s  .  com
    assertThat(artist.getName(), is("Q and Not U"));
}