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:org.ovirt.engine.sdk.decorators.ClusterAffinityGroups.java

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

From source file:com.modwiz.sponge.statue.utils.skins.SkinResolverService.java

public SkinResolverService(final File cacheDir) {
    checkNotNull(cacheDir);/*from www  . ja  va2 s .c  o m*/

    if (!cacheDir.exists()) {
        cacheDir.mkdirs();
    } else {
        File[] cachedSkins = cacheDir.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                return name.endsWith(".json");
            }
        });
        JsonParser parser = new JsonParser();
        for (File file : cachedSkins) {
            try {
                JsonObject element = parser.parse(new FileReader(file)).getAsJsonObject();
                long now = new Date().getTime();
                long timestamp = element.get("timestamp").getAsLong();
                if (new Date(now - timestamp).getMinutes() <= 45) {
                    // Less than 45 minutes old
                    UUID uuid = UUID.fromString(element.get("uuid").getAsString());
                    BufferedImage texture = ImageIO.read(new File(String.format("%s.png", uuid.toString())));
                    MinecraftSkin.Type skinType = MinecraftSkin.Type.valueOf(element.get("type").getAsString());
                    MinecraftSkin skin = new MinecraftSkin(skinType, uuid, texture, timestamp);
                    skinCache.put(uuid, skin);
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    this.cacheDir = cacheDir;

    skinCache = new HashMap<UUID, MinecraftSkin>(100);
    skinLoader = new SkinLoader();
}

From source file:nl.knaw.huygens.alexandria.markup.client.AlexandriaMarkupClient.java

private WebTarget documentTarget(UUID documentUUID) {
    return documentsTarget()//
            .path(documentUUID.toString());
}

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

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

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

/**
 * Fetches NetworkLabel object by id./*from  ww w.  jav a2 s .c om*/
 *
 * @return
 *     {@link NetworkLabel }
 *
 * @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 NetworkLabel 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.Label.class, NetworkLabel.class);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_2.CFAstMssCF.CFAstMssCFBindSecUserEMailConfirmationUuid.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFAstMssCFBindSecUserEMailConfirmationUuid.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//from w w w  .j  ava2  s  .  c o m

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFAstSecUserObj) {
        UUID eMailConfirmationUuid = ((ICFAstSecUserObj) genDef).getOptionalEMailConfirmationUuid();
        if (eMailConfirmationUuid == null) {
            ret = null;
        } else {
            ret = eMailConfirmationUuid.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFAstSecUserObj");
    }

    return (ret);
}

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

/**
 * Fetches DataCenterNetworkLabel object by id.
 *
 * @return//from   w w  w  . j av  a 2  s  . com
 *     {@link DataCenterNetworkLabel }
 *
 * @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 DataCenterNetworkLabel 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.Label.class, DataCenterNetworkLabel.class);
}

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

/**
 * Fetches Job object by id./*from ww  w. j  a  v a 2  s.  c om*/
 *
 * @return {@link Job }
 *
 * @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 Job get(UUID id) throws ClientProtocolException, ServerException, IOException {
    String url = SLASH + getName() + SLASH + id.toString();
    return getProxy().get(url, org.ovirt.engine.sdk.entities.Job.class, Job.class);
}

From source file:com.intellectualcrafters.plot.commands.Info.java

private String getPlayerName(final UUID uuid) {
    if (uuid == null) {
        return "unknown";
    }/*from   www  . j a v  a2 s. c  o  m*/
    if (uuid.equals(DBFunc.everyone) || uuid.toString().equalsIgnoreCase(DBFunc.everyone.toString())) {
        return "everyone";
    }
    /*
     * OfflinePlayer plr = Bukkit.getOfflinePlayer(uuid); if (plr.getName()
     * == null) { return "unknown"; } return plr.getName();
     */
    return UUIDHandler.getName(uuid);
}