Example usage for java.lang Long Long

List of usage examples for java.lang Long Long

Introduction

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

Prototype

@Deprecated(since = "9")
public Long(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Long object that represents the long value indicated by the String parameter.

Usage

From source file:org.openmeetings.app.templates.InvitationTemplate.java

public String getRegisterInvitationTemplate(String user, String message, String invitation_link,
        Long default_lang_id, Date dStart, Date dEnd) {
    try {// ww  w .j a  v  a  2  s . c  o m

        super.init();

        Fieldlanguagesvalues labelid501 = fieldmanagment.getFieldByIdAndLanguage(new Long(501),
                default_lang_id);
        Fieldlanguagesvalues labelid502 = fieldmanagment.getFieldByIdAndLanguage(new Long(502),
                default_lang_id);
        Fieldlanguagesvalues labelid503 = fieldmanagment.getFieldByIdAndLanguage(new Long(503),
                default_lang_id);
        Fieldlanguagesvalues labelid504 = fieldmanagment.getFieldByIdAndLanguage(new Long(504),
                default_lang_id);
        Fieldlanguagesvalues labelid505 = fieldmanagment.getFieldByIdAndLanguage(new Long(505),
                default_lang_id);
        // Fieldlanguagesvalues labelid570 =
        // fieldmanagment.getFieldByIdAndLanguage(new Long(570),
        // default_lang_id);
        // Fieldlanguagesvalues labelid571 =
        // fieldmanagment.getFieldByIdAndLanguage(new Long(571),
        // default_lang_id);

        /* lets make a Context and put data into it */
        VelocityContext context = new VelocityContext();

        context.put("user", user);
        context.put("message", message);
        context.put("invitation_link", invitation_link);
        context.put("invitation_link2", invitation_link);

        context.put("labelid500", fieldmanagment.getString(500L, default_lang_id));
        context.put("labelid501", labelid501.getValue());
        context.put("labelid502", labelid502.getValue());
        context.put("labelid503", labelid503.getValue());
        context.put("labelid504", labelid504.getValue());
        context.put("labelid505", labelid505.getValue());
        context.put("APP_NAME", configurationmanagement.getAppName());

        /* lets render a template */
        StringWriter w = new StringWriter();
        Velocity.mergeTemplate(templateName, "UTF-8", context, w);

        return w.toString();

    } catch (Exception e) {
        log.error("Problem merging template : ", e);
        // System.out.println("Problem merging template : " + e );
    }
    return null;
}

From source file:com.hs.mail.imap.dao.MySqlMessageDao.java

public List<Long> getMessageIDList(long mailboxID) {
    String sql = "SELECT messageid FROM message WHERE mailboxid = ? ORDER BY messageid";
    return (List<Long>) getJdbcTemplate().queryForList(sql, new Object[] { new Long(mailboxID) }, Long.class);
}

From source file:gov.nih.nci.ncicb.cadsr.common.util.SessionUtils.java

/**
 public static void addGlobalSessionKey(
   HttpSession session,/*w w  w  .  j av a2 s. c o  m*/
   String key) {
   if (session != null) {
     Collection keys =
(Collection) session.getAttribute(CaDSRConstants.GLOBAL_SESSION_KEYS);
        
     if (keys == null) {
keys = new HashSet();
     }
        
     keys.add(key);
     session.setAttribute(CaDSRConstants.GLOBAL_SESSION_KEYS, keys);
   }
 }
 */
public static void addToSessionCache(String key, Object object) {
    synchronized (sessionObjectCache) {
        log.error("SessionUtil.addToSessionCache(synchronized) start :" + TimeUtils.getEasternTime());
        clearStaleObject();
        Long currTime = new Long(new Date().getTime());
        sessionObjectCacheTimeout.put(key, currTime);
        sessionObjectCache.put(key, object);
        log.error("SessionUtil.addToSessionCache(synchronized) End :" + TimeUtils.getEasternTime());
    }
}

From source file:com.turn.shapeshifter.transformers.DateTimeTransformer.java

/** 
 * @param node a date formatted using ISO 8601
 *///from  w  w  w  .jav  a2  s  . c o  m
@Override
public Object parse(JsonNode node) {
    Preconditions.checkArgument(JsonToken.VALUE_STRING.equals(node.asToken()));
    String nodeValue = node.asText();
    return new Long(ISO_8601.parseMillis(nodeValue));
}

From source file:com.redhat.rhn.domain.monitoring.satcluster.SatClusterFactory.java

/**
 * Return the default SatCluster created during satellite installation.
 *
 * @return Default SatCluster./*from   w  ww  . jav a  2  s  .  c o m*/
 */
public static SatCluster getDefaultSatCluster() {
    SatCluster scout = SatClusterFactory.findSatClusterById(new Long(1));
    return scout;
}

From source file:com.mockey.ui.ScenarioViewAjaxServlet.java

public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    Long serviceId = new Long(req.getParameter("serviceId"));
    String scenarioIdAsString = req.getParameter("scenarioId");
    Service service = store.getServiceById(serviceId);
    Scenario scenario = null;//w  ww . j av a  2s  . c  o  m
    resp.setContentType("application/json");
    PrintWriter out = resp.getWriter();
    try {
        scenario = service.getScenario(new Long(scenarioIdAsString));
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("serviceId", "" + serviceId);
        jsonObject.put("serviceName", "" + service.getServiceName());
        jsonObject.put("scenarioId", "" + scenario.getId());
        jsonObject.put("name", scenario.getScenarioName());
        jsonObject.put("match", scenario.getMatchStringArg());
        jsonObject.put("response", scenario.getResponseMessage());

        // Error handling flags
        String scenarioErrorId = (service.getErrorScenario() != null) ? "" + service.getErrorScenario().getId()
                : "-1";
        if (scenarioErrorId.equals(scenarioIdAsString)) {
            jsonObject.put("scenarioErrorFlag", true);
        } else {
            jsonObject.put("scenarioErrorFlag", false);
        }

        // For universal, both SERVICE ID and SCENARIO ID have to match.
        Scenario universalError = store.getUniversalErrorScenario();
        boolean universalErrorFlag = false;
        if (universalError != null) {
            try {
                if (serviceId.equals(universalError.getServiceId())
                        && universalError.getServiceId().equals(new Long(scenarioIdAsString))) {
                    universalErrorFlag = true;
                }
            } catch (Exception ae) {
                // Ignore
                logger.debug("Unable to set universal error.", ae);
            }

        }
        jsonObject.put("universalScenarioErrorFlag", universalErrorFlag);
        out.println(jsonObject.toString());
    } catch (Exception e) {
        out.println("{ \"error\": \"Unable to find scenario \"}");
    }
    out.flush();
    out.close();
    return;

}

From source file:fr.univrouen.poste.services.GalaxieExcelParser.java

public void process(GalaxieExcel galaxieExcel) throws SQLException {

    StopWatch chrono = new StopWatch();
    chrono.start();//from  ww w .j  a va  2 s .c  om

    List<List<String>> cells = excelParser
            .getCells(galaxieExcel.getBigFile().getBinaryFile().getBinaryStream());

    Map<String, Long> cellsPosition = new HashMap<String, Long>();

    int p = 0;
    List<String> cellsHead = cells.remove(0);
    for (String cellName : cellsHead) {
        cellsPosition.put(cellName, new Long(p++));
    }
    galaxieMappingService.checkCellsHead(cellsPosition);

    Map<List<String>, GalaxieEntry> dbGalaxyEntries = new HashMap<List<String>, GalaxieEntry>();
    for (GalaxieEntry galaxieEntry : GalaxieEntry.findAllGalaxieEntrys()) {
        dbGalaxyEntries.put(getList4Id(galaxieEntry), galaxieEntry);
    }

    for (List<String> row : cells) {

        // create a new galaxyEntry
        GalaxieEntry galaxieEntry = new GalaxieEntry();
        for (String cellName : cellsPosition.keySet()) {
            int position = cellsPosition.get(cellName).intValue();
            if (row.size() > position) {
                String cellValue = row.get(position);
                galaxieMappingService.setAttrFromCell(galaxieEntry, cellName, cellValue);
            } else {
                logger.debug("can't get " + cellName + " for this row in excel file ...");
            }
        }

        // Rcupration d'un GalaxieEntry  chaque fois trop gourmand, mme avec l'index ...
        //TypedQuery<GalaxieEntry> query = GalaxieEntry.findGalaxieEntrysByNumEmploiAndNumCandidat(galaxieEntry.getNumEmploi(), galaxieEntry.getNumCandidat(), null, null);
        GalaxieEntry dbGalaxyEntrie = dbGalaxyEntries.get(getList4Id(galaxieEntry));

        if (dbGalaxyEntrie == null) {
            galaxieEntry.persist();
            dbGalaxyEntries.put(getList4Id(galaxieEntry), galaxieEntry);
        } else {
            // This GalaxyEntry exists already, we merge it if needed
            if (!fieldsEquals(dbGalaxyEntrie, galaxieEntry)) {
                dbGalaxyEntrie.setCivilite(galaxieEntry.getCivilite());
                dbGalaxyEntrie.setNom(galaxieEntry.getNom());
                dbGalaxyEntrie.setPrenom(galaxieEntry.getPrenom());
                if (dbGalaxyEntrie.getEmail().isEmpty()) {
                    if (!galaxieEntry.getEmail().isEmpty()) {
                        dbGalaxyEntrie.setEmail(galaxieEntry.getEmail());
                        logger.info("Le candidat " + dbGalaxyEntrie.getNumCandidat()
                                + " a maintenant renseign son email : " + galaxieEntry.getEmail());
                    }
                }
                // si email diffrent et si le candidat n'a pas activ son compte - on rinitialise le compte == on le supprime et on le rcr avec cette nvelle adresse mail
                else if (!dbGalaxyEntrie.getEmail().equals(galaxieEntry.getEmail())) {
                    try {
                        User user = User.findUsersByEmailAddress(dbGalaxyEntrie.getEmail()).getSingleResult();
                        if (user.getActivationDate() == null && !user.isCandidatActif()) {
                            logger.info("Le candidat " + dbGalaxyEntrie.getNumCandidat()
                                    + " a chang d'email alors qu'il n'avait pas encore activ son compte - on relance la procdure de cration de son compte/candidature.");

                            // cas o le candidat postule  plusieurs postes pris en compte ainsi
                            List<GalaxieEntry> userGalaxieEntries = GalaxieEntry
                                    .findGalaxieEntrysByCandidat(user).getResultList();
                            for (GalaxieEntry userGalaxieEntry : userGalaxieEntries) {
                                dbGalaxyEntries.remove(getList4Id(userGalaxieEntry));
                            }

                            user.remove();
                            galaxieEntry.persist();
                            dbGalaxyEntries.put(getList4Id(galaxieEntry), galaxieEntry);
                            continue;
                        }
                        dbGalaxyEntrie.setEmail(galaxieEntry.getEmail());
                    } catch (Exception e) {
                        logger.warn("Pb avec le candidat " + dbGalaxyEntrie.getNumCandidat()
                                + " qui a chang d'email ...", e);
                    }
                }
                dbGalaxyEntrie.setLocalisation(galaxieEntry.getLocalisation());
                dbGalaxyEntrie.setProfil(galaxieEntry.getProfil());
                dbGalaxyEntrie.setEtatDossier(galaxieEntry.getEtatDossier());
                dbGalaxyEntrie.merge();
            }
        }
    }

    chrono.stop();
    logger.info("Le traitement du fichier Excel Galaxie a t effectu en "
            + chrono.getTotalTimeMillis() / 1000.0 + " sec.");

}

From source file:de.berlios.gpon.wui.actions.model.AssociationTypeSelectAction.java

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    if (request.getParameter("objectId") != null) {
        // lets go and fill

        String objectId = request.getParameter("objectId");

        log.info("Selected objectId: " + objectId);

        GponModelDao model = (GponModelDao) getObjectForBeanId("txGponModelDao");

        AssociationType associationType = null;

        try {/*from ww  w.  java 2s .  c o m*/
            associationType = model.findAssociationTypeById(new Long(objectId));
        } catch (Throwable ex) {
            log.error("Unable to get AssociationType with id " + objectId);
            return mapping.findForward("error");
        }

        if (associationType == null) {
            log.error("AssociationType is null for id " + objectId);
            return mapping.findForward("error");
        }

        // complexType is set
        AssociationTypeForm associationTypeForm = new AssociationTypeForm();

        if (associationTypeForm != null) {
            associationTypeForm.setId(associationType.getId());
            associationTypeForm.setName(associationType.getName());
            associationTypeForm.setDescription(associationType.getDescription());
            associationTypeForm.setBaseAssociationTypeId(associationType.getBaseAssociationTypeId());

            associationTypeForm.setItemARoleName(associationType.getItemARoleName());
            associationTypeForm.setItemATypeId(associationType.getItemAType().getId());

            associationTypeForm.setMultiplicity(associationType.getMultiplicity());

            associationTypeForm.setVisibility(associationType.getVisibility());

            associationTypeForm.setItemBRoleName(associationType.getItemBRoleName());
            associationTypeForm.setItemBTypeId(associationType.getItemBType().getId());

            associationTypeForm.setPredicates(associationType.getPredicates());
            associationTypeForm.setPredicatesA(associationType.getPredicatesA());
            associationTypeForm.setPredicatesB(associationType.getPredicatesB());

            // bind to session
            request.getSession().setAttribute("selectedAssociationTypeForm", associationTypeForm);
            request.getSession().setAttribute("selectedAssociationType", associationType);

        } else {
            log.error("itemTypeForm is null");
            return mapping.getInputForward();
        }
    } else {
        log.error("No objectId parameter!");
        return mapping.getInputForward();
    }

    return mapping.findForward("success");
}

From source file:eu.cloud4soa.persistence.test.UserRepositoryTest.java

@Ignore
@Test
public void testfindUserById() {
    User user1 = userdao.findByUserId(new Long(1));
    logger.info("User  with id 1:" + user1);
}

From source file:org.myjerry.evenstar.web.admin.DefaultBlogController.java

public ModelAndView setDefaultBlog(HttpServletRequest request, HttpServletResponse response) throws Exception {
    ModelAndView mav = null;/*from   w  ww .  j  a v a2 s. co m*/

    String blogID = request.getParameter("blogID");
    Long id = null;
    if (StringUtils.isNotEmpty(blogID)) {
        id = new Long(blogID);
    }
    boolean result = this.blogService.setDefaultBlogID(id);
    if (result) {
        response.sendRedirect("/admin.html");
    } else {
        mav = view(request, response);
        mav.addObject("errorString", "Unable to set default blog.");
    }
    return mav;
}