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:org.flite.cach3.test.UpdateSingleCacheTest.java

@Test
public void testVelocity() {
    final TestSvc test = (TestSvc) context.getBean("testSvc");
    final StubUpdateSingleCacheListenerImpl listener = (StubUpdateSingleCacheListenerImpl) context
            .getBean("stubUS");

    final String original = RandomStringUtils.randomAlphanumeric(7);
    final String update = RandomStringUtils.randomAlphanumeric(9);
    final String replace = RandomStringUtils.randomAlphanumeric(11);

    final Long first = System.currentTimeMillis();
    final Long second = first - 133700;
    final String baseKey = first.toString() + "&&" + second.toString();

    final String r1 = test.getCompoundString(first, original, second);
    assertEquals(r1, original);/*w  w  w  .j a v  a 2 s  . c  o m*/

    final String r2 = test.getCompoundString(first, replace, second);
    assertEquals(r2, original);

    final int previous = listener.getTriggers().size();
    final String r3 = test.updateCompoundString(second, update, first);
    assertEquals(r3, update);

    // Testing that the listener got invoked as required.
    assertTrue("Doesn't look like the listener got called.", listener.getTriggers().size() == previous + 1);
    final String expected = StubUpdateSingleCacheListenerImpl.formatTriggers(TestDAOImpl.COMPOUND_NAMESPACE,
            TestDAOImpl.COMPOUND_PREFIX, baseKey, update, update, new Object[] { second, update, first });
    assertEquals(expected, listener.getTriggers().get(listener.getTriggers().size() - 1));

    // Now, verify that the update happened.
    final String r4 = test.getCompoundString(first, replace, second);
    assertEquals(r4, update);
}

From source file:org.homiefund.api.support.HomeAccessVoterImpl.java

@Override
public boolean isAllowed(Long homeId, UserDTO principal) {
    if (principal == null || principal.getAuthorities() == null) {
        return false;
    }/*w w w .j a  v  a2s .c  om*/
    return principal.getAuthorities()
            .contains(new SimpleGrantedAuthority(homeId == null ? "0" : homeId.toString()));
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindUInt32DefMaxValue.java

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//from   ww  w  .ja v  a  2s  .  c o  m

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

    String ret;

    if (genDef instanceof ICFBamUInt32DefObj) {
        Long maxValue = ((ICFBamUInt32DefObj) genDef).getOptionalMaxValue();
        if (maxValue == null) {
            ret = null;
        } else {
            ret = maxValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamUInt32DefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindUInt32DefMinValue.java

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//  w ww .ja v  a 2  s.  c om

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

    String ret;

    if (genDef instanceof ICFBamUInt32DefObj) {
        Long minValue = ((ICFBamUInt32DefObj) genDef).getOptionalMinValue();
        if (minValue == null) {
            ret = null;
        } else {
            ret = minValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamUInt32DefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindInt64DefInitValue.java

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//from   w w  w .ja  v  a 2 s. c  om

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

    String ret;

    if (genDef instanceof ICFBamInt64DefObj) {
        Long initValue = ((ICFBamInt64DefObj) genDef).getOptionalInitValue();
        if (initValue == null) {
            ret = null;
        } else {
            ret = initValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamInt64DefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindInt64DefNullValue.java

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//from   w w  w.ja v a 2 s .  co  m

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

    String ret;

    if (genDef instanceof ICFBamInt64DefObj) {
        Long nullValue = ((ICFBamInt64DefObj) genDef).getOptionalNullValue();
        if (nullValue == null) {
            ret = null;
        } else {
            ret = nullValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamInt64DefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindTableAltIndexId.java

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }/*from  ww  w .j  a v  a2s . c om*/

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

    String ret;

    if (genDef instanceof ICFBamTableObj) {
        Long altIndexId = ((ICFBamTableObj) genDef).getOptionalAltIndexId();
        if (altIndexId == null) {
            ret = null;
        } else {
            ret = altIndexId.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamTableObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindUInt32DefInitValue.java

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }/* w  w w. j  av  a2s.co m*/

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

    String ret;

    if (genDef instanceof ICFBamUInt32DefObj) {
        Long initValue = ((ICFBamUInt32DefObj) genDef).getOptionalInitValue();
        if (initValue == null) {
            ret = null;
        } else {
            ret = initValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamUInt32DefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindUInt32DefNullValue.java

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }/*from   w ww  .  j av  a2s  . co  m*/

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

    String ret;

    if (genDef instanceof ICFBamUInt32DefObj) {
        Long nullValue = ((ICFBamUInt32DefObj) genDef).getOptionalNullValue();
        if (nullValue == null) {
            ret = null;
        } else {
            ret = nullValue.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamUInt32DefObj");
    }

    return (ret);
}

From source file:org.sakaiproject.imagegallery.service.impl.ImageGalleryServiceImpl.java

@Transactional
public Image addImage(MultipartFile uploadedFile) {
    final String currentContext = contextService.getCurrentContextUid();
    if (log.isDebugEnabled())
        log.debug("About to add image context=" + currentContext + ", file=" + uploadedFile);
    ImageFile storedFile = fileLibraryService.storeImageFile(uploadedFile);
    String fileId = storedFile.getFileId();
    Image image = new Image();
    image.setTitle(storedFile.getFilename());
    image.setDescription("");
    image.setFileId(fileId);/*w  ww .  jav a 2 s . c o  m*/
    image.setImageFile(storedFile);
    Long generatedId = jdbcTemplate.insertAndReturnGeneratedId(insertImage, "ID",
            new Object[] { currentContext, storedFile.getFilename(), "", fileId });
    image.setId(generatedId.toString());
    if (log.isDebugEnabled())
        log.debug("new image ID=" + image.getId() + ", fileId=" + image.getFileId());
    return image;
}