Example usage for java.lang Long toString

List of usage examples for java.lang Long toString

Introduction

In this page you can find the example usage for java.lang Long toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Long 's value.

Usage

From source file:no.dusken.aranea.admin.editor.GenericEditor.java

@Override
public String getAsText() {
    if (log.isDebugEnabled())
        log.debug(getValue().toString());
    @SuppressWarnings({ "unchecked" })
    T entity = (T) getValue();/* www  .j  a v  a2 s.c o m*/
    if (entity == null)
        return " ";
    Long ID = entity.getID();
    if (ID == null)
        return " ";
    if (log.isDebugEnabled())
        log.debug(ID.toString());
    return ID.toString();
}

From source file:no.dusken.barweb.util.PersonEditor.java

@Override
public String getAsText() {
    if (log.isDebugEnabled())
        log.debug(getValue().toString());
    @SuppressWarnings({ "unchecked" })
    BarPerson entity = (BarPerson) getValue();
    if (entity == null)
        return " ";
    Long ID = entity.getId();
    if (ID == null)
        return " ";
    if (log.isDebugEnabled())
        log.debug(ID.toString());
    return ID.toString();
}

From source file:es.pode.administracion.presentacion.adminusuarios.bajaGrupo.BajaControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.adminusuarios.bajaGrupo.BajaController#obtenerIdiomas(org.apache.struts.action.ActionMapping,
 *      es.pode.administracion.presentacion.adminusuarios.bajaGrupo.ObtenerIdiomasForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *///from  w  w w. j a va2 s  .c  o m
public final void obtenerIdiomas(ActionMapping mapping,
        es.pode.administracion.presentacion.adminusuarios.bajaGrupo.ObtenerIdiomasForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    try {

        SrvAdminUsuariosService srvAdminUsuariosService = this.getSrvAdminUsuariosService();

        Iterator iter = (form.getIds()).iterator();
        GrupoVO[] grupos = new GrupoVO[form.getIds().size()];
        int i = 0;
        String listaId = "";
        while (iter.hasNext()) {

            Long id = new Long((String) iter.next());
            listaId = listaId + id.toString() + " ";

            GrupoVO grupoVO = srvAdminUsuariosService.descripcionGrupo(id);
            grupos[i] = grupoVO;
            i = i + 1;
        }
        form.setListaId(listaId.trim());
        form.setGrupos(grupos);
        if ((listaId.length() == 0) || (grupos.length == 0)) {
            saveErrorMessage(request, "errors.borrarGrupo");
        }

    } catch (Exception e) {
        log.error("Error: " + e);
        throw new ValidatorException("{errors.borrarGrupo}");
    }
}

From source file:es.pode.administracion.presentacion.adminusuarios.bajaUsuario.BajaUsuarioControllerImpl.java

/**
 * @see es.pode.admainistracion.presentacion.adminusuarios.bajaUsuario.BajaUsuarioController#obtenerIdiomas(org.apache.struts.action.ActionMapping,
 *      es.pode.administracion.presentacion.adminusuarios.bajaUsuario.ObtenerIdiomasForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *///w ww  . j  a  va  2s . com
public final void obtenerIdiomas(ActionMapping mapping,
        es.pode.administracion.presentacion.adminusuarios.bajaUsuario.ObtenerIdiomasForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    try {

        SrvAdminUsuariosService srvAdminUsuariosService = this.getSrvAdminUsuariosService();
        Iterator iter = (form.getIds()).iterator();
        UsuarioVO[] usuarios = new UsuarioVO[form.getIds().size()];
        int i = 0;
        String listaId = "";
        while (iter.hasNext()) {

            Long id = new Long((String) iter.next());
            listaId = listaId + id.toString() + " ";

            UsuarioVO usuarioVO = srvAdminUsuariosService.descripcionUsuario(id);
            usuarios[i] = usuarioVO;
            i = i + 1;
        }
        form.setListaId(listaId.trim());
        form.setUsuarios(usuarios);

    } catch (Exception e) {
        log.error("Error: " + e);
        throw new ValidatorException("{errors.borrarUsuario}");
    }

}

From source file:cherry.foundation.crypto.SecureLongEncoderTest.java

@Test
public void testEncodeDecode() throws Exception {
    SecureLongEncoder encoder = createSecureLongEncoder();
    for (int i = 0; i < 100; i++) {
        Long plain = Long.valueOf(random.nextInt());
        String crypto = encoder.encode(plain);
        assertThat(crypto, is(not(plain.toString())));
        assertThat(encoder.decode(crypto), is(plain));
    }//from ww  w.  j  av a  2 s .c o  m
}

From source file:com.carlos.projects.billing.ui.controllers.LoadComponentsControllerTest.java

@Test
public void shouldAddDocumentIdToModelIfItIsPresentOnRequest() throws Exception {
    //Given//  ww w  .j a v  a  2s  .  c om
    Long documentId = 123L;
    when(request.getParameter("documentId")).thenReturn(documentId.toString());

    //When
    ModelAndView modelAndView = controller.handleRequest(request, response);

    //Then
    assertThat("The document id is wrong", (Long) modelAndView.getModel().get("documentId"), is(documentId));
}

From source file:com.haulmont.cuba.restapi.CommitRequest.java

private String generateId(String entityName) {
    Metadata metadata = AppBeans.get(Metadata.NAME);
    MetaClass metaClass = metadata.getSession().getClass(entityName);

    MetaProperty primaryKeyProp = metadata.getTools().getPrimaryKeyProperty(metaClass);
    if (primaryKeyProp == null)
        throw new UnsupportedOperationException("Cannot generate ID for " + entityName);

    if (primaryKeyProp.getJavaType().equals(UUID.class)) {
        UuidSource uuidSource = AppBeans.get(UuidSource.NAME);
        UUID uuid = uuidSource.createUuid();
        return uuid.toString();
    } else if (primaryKeyProp.getJavaType().equals(Long.class)) {
        NumberIdSource numberIdSource = AppBeans.get(NumberIdSource.NAME);
        Long longId = numberIdSource.createLongId(entityName);
        return longId.toString();
    } else if (primaryKeyProp.getJavaType().equals(Integer.class)) {
        NumberIdSource numberIdSource = AppBeans.get(NumberIdSource.NAME);
        Integer intId = numberIdSource.createIntegerId(entityName);
        return intId.toString();
    } else {/*  ww  w . jav a2s  . c  o m*/
        throw new UnsupportedOperationException("Cannot generate ID for " + entityName);
    }
}

From source file:nz.net.orcon.kanban.automation.ClusterManagerImpl.java

public String getIdString(String path, String field, String prefix) throws Exception {
    Long id = getId(path, field);
    return prefix + id.toString();
}

From source file:com.facebook.ads.sdk.AdAccountGroup.java

public static AdAccountGroup fetchById(Long id, APIContext context) throws APIException {
    return fetchById(id.toString(), context);
}

From source file:com.carlos.projects.billing.ui.controllers.SelectComponentsControllerTest.java

@Test
public void shouldAddDocumentIdToModelIfItIsPresentInRequest() throws Exception {
    // Given// w  w  w. j a  v  a 2  s  .  c  o m
    Long documentId = 123L;
    when(request.getParameter("documentId")).thenReturn(documentId.toString());

    // When
    ModelAndView modelAndView = controller.handleRequest(request, response);

    // Then
    assertThat("The document id is wrong", (Long) modelAndView.getModel().get("documentId"), is(documentId));
}