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:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMssCF.CFEnSyntaxMssCFBindSecUserEMailConfirmationUuid.java

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//w  w w  . jav  a2  s  . co m

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

    String ret;

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

    return (ret);
}

From source file:com.esri.geoportal.harvester.beans.BrokerDefinitionManagerBean.java

@Override
public Collection<Map.Entry<UUID, EntityDefinition>> list() throws CrudlException {
    HashMap<UUID, EntityDefinition> map = new HashMap<>();
    try (Connection connection = dataSource.getConnection();
            PreparedStatement st = connection.prepareStatement("SELECT * FROM BROKERS");) {
        ResultSet rs = st.executeQuery();
        while (rs.next()) {
            try {
                UUID id = UUID.fromString(rs.getString("id"));
                EntityDefinition td = deserialize(rs.getString("brokerDefinition"), EntityDefinition.class);
                td.setRef(id.toString());
                map.put(id, td);//from   w ww .j  a  v  a2  s.  co  m
            } catch (IOException | SQLException ex) {
                LOG.warn("Error reading broker definition", ex);
            }
        }
    } catch (SQLException ex) {
        throw new CrudlException("Error selecting broker definition", ex);
    }
    return map.entrySet();
}

From source file:uk.ac.imperial.presage2.db.json.JsonStorage.java

@Override
protected void storeTuple(long id, String key, UUID agent, int t, int value) {
    getSim(id).with("agenttransproperties").with(agent.toString()).with(Integer.toString(t)).put(key, value);
}

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

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

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

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }/* w w w  .j a v a 2  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 passwordResetUuid = ((ICFAstSecUserObj) genDef).getOptionalPasswordResetUuid();
        if (passwordResetUuid == null) {
            ret = null;
        } else {
            ret = passwordResetUuid.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFAstSecUserObj");
    }

    return (ret);
}

From source file:uk.ac.imperial.presage2.db.json.JsonStorage.java

@Override
protected void storeTuple(long id, String key, UUID agent, int t, String value) {
    getSim(id).with("agenttransproperties").with(agent.toString()).with(Integer.toString(t)).put(key, value);
}

From source file:uk.ac.imperial.presage2.db.json.JsonStorage.java

@Override
protected void storeTuple(long id, String key, UUID agent, int t, double value) {
    getSim(id).with("agenttransproperties").with(agent.toString()).with(Integer.toString(t)).put(key, value);
}

From source file:org.messic.server.facade.controllers.pages.CaptchaController.java

@ApiMethod(path = "/captcha", verb = ApiVerb.GET, description = "Get a captcha", produces = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
@ApiErrors(apierrors = { @ApiError(code = UnknownMessicRESTException.VALUE, description = "Unknown error") })
@RequestMapping(value = "", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)/*from   w  w w. ja va  2 s.  c  o m*/
@ResponseBody
@ApiResponseObject
public Captcha getCaptcha() throws UnknownMessicRESTException {

    try {
        UUID idOne = UUID.randomUUID();
        // create the image with the text
        BufferedImage bi = service.getImageChallengeForID(idOne.toString());
        BufferedImage bi2 = Util.ImagedeepCopy(bi);
        Graphics2D g2d = (Graphics2D) bi.getGraphics();
        float alpha = 0.25f;
        int type = AlphaComposite.SRC_OVER;
        AlphaComposite composite = AlphaComposite.getInstance(type, alpha);
        g2d.setComposite(composite);

        final int Min = 5;
        final int Max = 30;
        int random1 = Min + (int) (Math.random() * ((Max - Min) + 1));
        int random2 = Min + (int) (Math.random() * ((Max - Min) + 1));

        g2d.drawImage(bi2, random1, random2, null);

        alpha = 0.80f;
        type = AlphaComposite.SRC_OVER;
        composite = AlphaComposite.getInstance(type, alpha);
        g2d.setComposite(composite);

        int MinX = 0;
        int MaxX = bi.getWidth();
        int MinY = 0;
        int MaxY = bi.getHeight();
        g2d.setColor(Color.black);
        for (int i = 0; i < random2; i++) {
            int random3 = MinX + (int) (Math.random() * ((MaxX - MinX) + 1));
            int random4 = MinX + (int) (Math.random() * ((MaxX - MinX) + 1));
            int random5 = MinY + (int) (Math.random() * ((MaxY - MinY) + 1));
            int random6 = MinY + (int) (Math.random() * ((MaxY - MinY) + 1));
            g2d.drawLine(random3, random5, random4, random6);
        }

        Captcha result = new Captcha();
        result.id = idOne.toString();

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ImageIO.write(bi, "jpg", baos);
        byte[] resultb64 = Base64.encode(baos.toByteArray());
        result.captchaImage = new String(resultb64);
        return result;
    } catch (Exception e) {
        throw new UnknownMessicRESTException(e);
    }
}

From source file:de.kaiserpfalzEdv.office.core.security.impl.SecurityServiceImpl.java

public void createAccount(@NotNull final UUID id, @NotNull UUID identityId, @NotNull final String accountName,
        @NotNull final String name, @NotNull final String password) {
    Identity identity = identityRepository.findOne(identityId.toString());

    Account account = new UserAccount(id, identity, accountName, name, password);

    account = accountRepository.save(account);

    LOG.info("Created account: {}", account);
}

From source file:uk.ac.imperial.presage2.db.json.JsonStorage.java

@Override
protected <T> T fetchTuple(long id, String key, UUID agent, Class<T> type) {
    JsonNode n = getSim(id).with("agentproperties").with(agent.toString()).path(key);
    return returnAsType(n, type);
}