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.sqewd.open.dal.core.persistence.db.H2DbPersister.java

@Override
protected Object getSequenceValue(Entity entity, StructAttributeReflect attr, Connection conn)
        throws Exception {
    if (EnumPrimitives.isPrimitiveType(attr.Field.getType())) {
        EnumPrimitives prim = EnumPrimitives.type(attr.Field.getType());
        if (prim == EnumPrimitives.ELong || prim == EnumPrimitives.EInteger) {
            String seqname = SimpleDbQuery.getSequenceName(entity, attr);

            String sql = "select NEXT VALUE FOR " + seqname;
            Statement stmnt = conn.createStatement();

            try {
                ResultSet rs = stmnt.executeQuery(sql);
                while (rs.next()) {
                    return rs.getLong(1);
                }// ww w .  j av  a2 s .  c o m
                if (rs != null)
                    rs.close();
            } finally {
                if (stmnt != null && !stmnt.isClosed())
                    stmnt.close();
            }
        }
    } else if (attr.Field.getType().equals(String.class)) {
        UUID uuid = UUID.randomUUID();
        return uuid.toString();
    }
    throw new Exception("Cannot generate sequence for type [" + attr.Field.getType().getCanonicalName() + "]");
}

From source file:net.daboross.bukkitdev.skywars.score.JSONScoreStorage.java

private int getScore(final UUID uuid) {
    JSONObject playerObj = uuidToStoredPlayer.optJSONObject(uuid.toString());
    return playerObj == null ? 0 : playerObj.getInt("score");
}

From source file:se.vgregion.urlservice.controllers.AdminGuiControllerTest.java

@Test
public void deleteRedirectRule() throws IOException {
    UrlServiceService urlServiceService = mock(UrlServiceService.class);
    controller.setUrlServiceService(urlServiceService);

    UUID id = UUID.randomUUID();

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter("delete-" + id.toString(), "any value");

    controller.updateRedirectRules(request);

    verify(urlServiceService).removeRedirectRule(id);
}

From source file:se.vgregion.urlservice.controllers.AdminGuiControllerTest.java

@Test
public void deleteApplication() throws IOException {
    UrlServiceService urlServiceService = mock(UrlServiceService.class);
    controller.setUrlServiceService(urlServiceService);

    UUID id = UUID.randomUUID();

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter("delete-" + id.toString(), "any value");

    controller.updateApplications(request);

    verify(urlServiceService).removeApplication(id);
}

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

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

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

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

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

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

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

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

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

/**
 * Fetches HostNICStatistic object by id.
 *
 * @return//w  ww  .  jav  a2s.  c o m
 *     {@link HostNICStatistic }
 *
 * @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 HostNICStatistic 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.Statistic.class, HostNICStatistic.class);
}

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

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