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:fi.laverca.examples.Authentication.java

/**
 * Authenticates to the MSSP with the FiCom authentication profile
 * /* ww  w. ja va2s.  c o  m*/
 * @param phoneNumber MSISDN of the user
 */
@Override
public void authenticate(final String phoneNumber) {

    // Generate IDs
    final Long currentTimeMillis = System.currentTimeMillis();
    final String apTransId = "A" + currentTimeMillis;
    final String eventId = "A"
            + currentTimeMillis.toString().substring(currentTimeMillis.toString().length() - 4);

    byte[] authnChallenge = new DTBS(apTransId, DTBS.ENCODING_UTF8).toBytes();

    // Add additional services
    Service eventIdService = FiComAdditionalServices.createEventIdService(eventId);
    Service noSpamService = FiComAdditionalServices.createNoSpamService("A12", false);
    List<Service> additionalServices = this.createAdditionalServices();

    // Create response handler
    FiComResponseHandler handler = new FiComResponseHandler() {
        @Override
        public void onResponse(FiComRequest req, FiComResponse resp) {
            log.info("Got response");
            displayResponse(eventId, resp, null);
        }

        @Override
        public void onError(FiComRequest req, Throwable throwable) {
            log.info("Got error");
            displayResponse(eventId, null, throwable);
        }

        @Override
        public void onOutstandingProgress(FiComRequest req, ProgressUpdate prgUpdate) {
            log.info("Got progress update");
        }
    };

    try {
        log.info("calling authenticate");
        this.req = this.client.authenticate(apTransId, authnChallenge, phoneNumber, noSpamService,
                eventIdService, additionalServices, handler);

        // Display Event ID
        this.displayResponse(eventId, null, null);
    } catch (IOException ioe) {
        this.displayResponse(eventId, null, ioe);
        log.info("Error establishing connection: " + ioe.getMessage());
    }

}

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashMssCF.CFGCashMssCFBindAccountEntryTransferAccountId.java

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }/*  w ww .  j a va  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 ICFGCashAccountEntryObj) {
        Long transferAccountId = ((ICFGCashAccountEntryObj) genDef).getOptionalTransferAccountId();
        if (transferAccountId == null) {
            ret = null;
        } else {
            ret = transferAccountId.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFGCashAccountEntryObj");
    }

    return (ret);
}

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

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//from   w ww  .ja va  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 ICFBamSchemaDefObj) {
        Long defaultLicenseTenantId = ((ICFBamSchemaDefObj) genDef).getOptionalDefaultLicenseTenantId();
        if (defaultLicenseTenantId == null) {
            ret = null;
        } else {
            ret = defaultLicenseTenantId.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamSchemaDefObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashMssCF.CFGCashMssCFBindAccountConfigCustContactListId.java

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

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//from w ww.j  ava  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 ICFGCashAccountConfigObj) {
        Long custContactListId = ((ICFGCashAccountConfigObj) genDef).getOptionalCustContactListId();
        if (custContactListId == null) {
            ret = null;
        } else {
            ret = custContactListId.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFGCashAccountConfigObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashMssCF.CFGCashMssCFBindAccountConfigVendContactListId.java

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

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

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

    String ret;

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

    return (ret);
}

From source file:com.ewcms.content.particular.dao.FrontEmployeBasicDAO.java

public List<EmployeBasic> findEmployeBasicBySector(Long organId) {
    String hql = "From EmployeBasic As p where p.organ.id=:organId and p.release=true Order By p.published desc ";
    TypedQuery<EmployeBasic> query = this.getEntityManager().createQuery(hql, EmployeBasic.class);
    query.setParameter("organId", Integer.valueOf(organId.toString()));
    return query.getResultList();
}

From source file:it.smartcommunitylab.aac.controller.BasicProfileController.java

@ApiOperation(value = "Get basic profile of a current user")
@RequestMapping(method = RequestMethod.GET, value = "/basicprofile/me")
public @ResponseBody BasicProfile findProfile(HttpServletResponse response) throws IOException {
    Long user = userManager.getUserId();
    if (user == null) {
        response.setStatus(HttpServletResponse.SC_FORBIDDEN);
        return null;
    }/*from  www  . java2 s  .c  o m*/
    return profileManager.getBasicProfileById(user.toString());
}

From source file:it.smartcommunitylab.aac.controller.BasicProfileController.java

@ApiOperation(value = "Get account data of a current user")
@RequestMapping(method = RequestMethod.GET, value = "/accountprofile/me")
public @ResponseBody AccountProfile findAccountProfile(HttpServletResponse response) throws IOException {
    Long user = userManager.getUserId();
    if (user == null) {
        response.setStatus(HttpServletResponse.SC_FORBIDDEN);
        return null;
    }//from   w w  w . j  a va 2 s. c  om
    return profileManager.getAccountProfileById(user.toString());
}

From source file:com.hs.mail.imap.message.responder.FetchResponder.java

void composeSize(FetchResponse response) {
    Long size = response.getSize();
    if (size != null) {
        message("RFC822.SIZE");
        message(size.toString());
    }//from  w  w  w .j  ava  2  s  .c om
}

From source file:edu.tcu.gaduo.ihe.iti.ct_transaction.service.NTPClient.java

public Date processResponse(String host) {

    TimeInfo info = null;/*from  ww w  . ja v  a  2 s.  com*/
    try {
        NTPUDPClient client = new NTPUDPClient();
        client.setDefaultTimeout(10000);
        client.open();
        InetAddress hostAddr = InetAddress.getByName(host);
        info = client.getTime(hostAddr);
        client.close();
    } catch (NullPointerException e) {
        logger.info(e.toString());
        return null;
    } catch (IOException e) {
        logger.info(e.toString());
        e.printStackTrace();
        return null;
    }

    message = info.getMessage();
    stratum = message.getStratum(); // 
    if (stratum <= 0)
        refType = "(??)";
    else if (stratum == 1)
        refType = "(??; e.g., GPS)"; // GPS, radio clock,
    else
        refType = "(??; e.g. via NTP or SNTP)";
    // stratum should be 0..15...
    logger.info(" Stratum: " + stratum + " " + refType);

    this.setRefNtpTime(message.getReferenceTimeStamp());

    // Originate Time is time request sent by client (t1)
    this.setOrigNtpTime(message.getOriginateTimeStamp());
    // Receive Time is time request received by server (t2)
    this.setRcvNtpTime(message.getReceiveTimeStamp());
    // Transmit time is time reply sent by server (t3)
    this.setXmitNtpTime(message.getTransmitTimeStamp());
    // Destination time is time reply received by client (t4)
    long destTime = info.getReturnTime();
    this.setDestNtpTime(TimeStamp.getNtpTime(destTime));

    info.computeDetails(); // compute offset/delay if not already done
    Long offsetValue = info.getOffset();
    Long delayValue = info.getDelay();
    this.setDelay(delay = (delayValue == null) ? "N/A" : delayValue.toString());
    this.setOffset((offsetValue == null) ? "N/A" : offsetValue.toString());

    Date Date = message.getReferenceTimeStamp().getDate();
    return Date;
}