Example usage for java.util UUID randomUUID

List of usage examples for java.util UUID randomUUID

Introduction

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

Prototype

public static UUID randomUUID() 

Source Link

Document

Static factory to retrieve a type 4 (pseudo randomly generated) UUID.

Usage

From source file:com.himanshu.poc.springbootsec.service.TokenKeeperService.java

public String generateNewToken(String username) {
    if (!userTokenMap.containsKey(username)) {
        String token = UUID.randomUUID().toString();
        userTokenMap.put(username, token);
    }//from  w w w .  ja  va  2  s  .com
    return userTokenMap.get(username);
}

From source file:com.thoughtworks.go.server.web.TokenManager.java

void create(HttpSession session) {
    synchronized (session) {
        if (null == session.getAttribute(TOKEN)) {
            session.setAttribute(TOKEN, UUID.randomUUID().toString());
        }//from   w w  w  .  j  a  v  a 2 s  . co m
    }
}

From source file:com.delphix.session.module.rmi.RmiTestConnector.java

public RmiTestConnector() {
    super(RmiTestServiceType.getInstance(), RmiTestExchangeType.class, UUID.randomUUID(), "rmi test");
}

From source file:se.vgregion.mobile.types.PrinterQueue.java

public PrinterQueue(String name) {
    Assert.hasText(name);

    this.id = UUID.randomUUID();
    this.name = name;
}

From source file:com.liferay.nativity.modules.contextmenu.model.ContextMenuItem.java

public ContextMenuItem(String title) {
    _title = title;
    _contextMenuItems = new ArrayList<ContextMenuItem>();
    _enabled = true;
    _uuid = UUID.randomUUID().toString();
}

From source file:com.bloatit.framework.utils.Hash.java

public static String generateUniqueToken() {
    UUID.randomUUID().toString();
    try {/*from   w  w  w  . jav a2  s .  c  o m*/
        final byte[] bytes = new byte[RANDOM_SIZE];
        SecureRandom.getInstance(SHA1_PRNG).nextBytes(bytes);
        return DigestUtils.sha512Hex(DigestUtils.sha512Hex(bytes) + UUID.randomUUID().toString());
    } catch (final NoSuchAlgorithmException e) {
        throw new BadProgrammerException(e);
    }
}

From source file:tld.example.resources.UsersResourceImpl.java

@Override
public User getUsers(@PathVariable("userId") String userId) {
    final User user = new User();
    user.setId(UUID.randomUUID());
    return user;//from w ww.  j a  va  2 s  . co m
}

From source file:com.parallax.server.blocklyprop.security.BlocklyPropSessionDao.java

@Override
public Serializable create(Session session) {
    SimpleSession simpleSession = (SimpleSession) session;

    String uuid = UUID.randomUUID().toString();
    simpleSession.setId(uuid);//from  w  ww  . j  a va 2  s  .c om

    //        System.out.println("Create session: " + session.getId());
    SessionServiceImpl.getSessionService().create(convert(simpleSession));

    return uuid;
}

From source file:demo.Store.java

public Store(String name, Address address) {
    this.name = name;
    this.address = address;
    this.id = UUID.randomUUID().toString();
}

From source file:Main.java

/**
 * @return A String[] of length two, [prefix, URI].
 *///  ww w . ja  v a  2  s .  c o  m
public static String[] getNamespaceDeclaration(Element ele, String prefixHint) {
    String[] ns = new String[2]; // prefix, URI
    NamedNodeMap attribs = ele.getAttributes();

    for (int i = 0; i < attribs.getLength(); i++) {
        Attr attr = (Attr) attribs.item(i);
        if (attr.getName().startsWith("xmlns")) {
            if ((prefixHint != null && attr.getName().endsWith(prefixHint)) || attr.getName().equals("xmlns")) {
                ns[0] = attr.getLocalName(); // prefix
                ns[1] = attr.getTextContent(); // URI

                // catch default namespace change
                if (ns[0] == "xmlns") {
                    ns[0] = UUID.randomUUID().toString();
                }
            }
        }
    }

    if (ns[1] == null) {
        return getNamespaceDeclaration((Element) ele.getParentNode(), prefixHint);
    } else {
        return ns;
    }
}