Example usage for org.apache.commons.lang StringUtils isNumeric

List of usage examples for org.apache.commons.lang StringUtils isNumeric

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils isNumeric.

Prototype

public static boolean isNumeric(String str) 

Source Link

Document

Checks if the String contains only unicode digits.

Usage

From source file:net.bible.service.format.osistohtml.ReferenceHandler.java

/** create a link tag from an OSISref and the content of the tag
 */// www  .j av a 2 s. c  o m
private String getReferenceTag(String reference, String content) {
    log.debug("Ref:" + reference + " Content:" + content);
    StringBuilder result = new StringBuilder();
    try {

        //JSword does not know the basis (default book) so prepend it if it looks like JSword failed to work it out
        //We only need to worry about the first ref because JSword uses the first ref as the basis for the subsequent refs
        // if content starts with a number and is not followed directly by an alpha char e.g. 1Sa
        if (reference == null && content != null && content.length() > 0
                && StringUtils.isNumeric(content.subSequence(0, 1))
                && (content.length() < 2 || !StringUtils.isAlphaSpace(content.subSequence(1, 2)))) {

            // maybe should use VerseRangeFactory.fromstring(orig, basis)
            // this check for a colon to see if the first ref is verse:chap is not perfect but it will do until JSword adds a fix
            int firstColonPos = content.indexOf(":");
            boolean isVerseAndChapter = firstColonPos > 0 && firstColonPos < 4;
            if (isVerseAndChapter) {
                reference = parameters.getBasisRef().getBook().getOSIS() + " " + content;
            } else {
                reference = parameters.getBasisRef().getBook().getOSIS() + " "
                        + parameters.getBasisRef().getChapter() + ":" + content;
            }
            log.debug("Patched reference:" + reference);
        } else if (reference == null) {
            reference = content;
        }

        // convert urns of type book:key to sword://book/key to simplify urn parsing (1 fewer case to check for).  
        // Avoid urls of type 'matt 3:14' by excludng urns with a space
        if (reference.contains(":") && !reference.contains(" ") && !reference.startsWith("sword://")) {
            reference = "sword://" + reference.replace(":", "/");
        }

        boolean isFullSwordUrn = reference.contains("/") && reference.contains(":");
        if (isFullSwordUrn) {
            // e.g. sword://StrongsRealGreek/01909
            // don't play with the reference - just assume it is correct
            result.append("<a href='").append(reference).append("'>");
            result.append(content);
            result.append("</a>");
        } else {
            Passage ref = (Passage) PassageKeyFactory.instance().getKey(parameters.getDocumentVersification(),
                    reference);
            boolean isSingleVerse = ref.countVerses() == 1;
            boolean isSimpleContent = content.length() < 3 && content.length() > 0;
            Iterator<VerseRange> it = ref.rangeIterator(RestrictionType.CHAPTER);

            if (isSingleVerse && isSimpleContent) {
                // simple verse no e.g. 1 or 2 preceding the actual verse in TSK
                result.append("<a href='").append(Constants.BIBLE_PROTOCOL).append(":")
                        .append(it.next().getOsisRef()).append("'>");
                result.append(content);
                result.append("</a>");
            } else {
                // multiple complex references
                boolean isFirst = true;
                while (it.hasNext()) {
                    Key key = it.next();
                    if (!isFirst) {
                        result.append(" ");
                    }
                    result.append("<a href='").append(Constants.BIBLE_PROTOCOL).append(":")
                            .append(key.iterator().next().getOsisRef()).append("'>");
                    result.append(key);
                    result.append("</a>");
                    isFirst = false;
                }
            }
        }
    } catch (Exception e) {
        log.error("Error parsing OSIS reference:" + reference);
        // just return the content with no html markup
        result.append(content);
    }
    return result.toString();
}

From source file:br.com.nordestefomento.jrimum.vallia.digitoverificador.CodigoDeCompensacaoBancosBACENDV.java

/**
 * <p>/*  ww  w.j a v a2 s  . c o m*/
 * Retorna se um cdigo de compensao passado  vlido, ou seja, se est entre os 
 * valores inteiros de 1 a 999.
 * </p>
 * 
 * @param codigo - Cdigo de compensao
 * @return true se for nmerio entre 1 e 999; false caso contrrio
 * 
 * @since 0.2
 */
public boolean isCodigoValido(String codigo) {

    boolean codigoValido = false;

    if (StringUtils.isNotBlank(codigo) && StringUtils.isNumeric(codigo)) {
        codigoValido = isCodigoValido(Integer.valueOf(codigo.trim()));
    }

    return codigoValido;
}

From source file:com.glaf.core.db.DataTableBean.java

/**
 * ????//from ww w . jav a  2 s  .  c  o m
 * 
 * @param sysDataTable
 *            ?
 * @param loginContext
 *            
 * @param ipAddress
 *            IP?
 */
public void checkPermission(SysDataTable sysDataTable, LoginContext loginContext, String ipAddress) {
    boolean hasPermission = false;
    /**
     * ??????
     */
    if (!StringUtils.equals(sysDataTable.getAccessType(), "PUB")) {
        /**
         * IP???
         */
        if (StringUtils.isNotEmpty(sysDataTable.getAddressPerms())) {
            List<String> addressList = StringTools.split(sysDataTable.getAddressPerms());
            for (String addr : addressList) {
                if (StringUtils.equals(ipAddress, addr)) {
                    hasPermission = true;
                }
                if (StringUtils.equals(ipAddress, "127.0.0.1")) {
                    hasPermission = true;
                }
                if (StringUtils.equals(ipAddress, "localhost")) {
                    hasPermission = true;
                }
                if (addr.endsWith("*")) {
                    String tmp = addr.substring(0, addr.indexOf("*"));
                    if (StringUtils.contains(ipAddress, tmp)) {
                        hasPermission = true;
                    }
                }
            }
            if (!hasPermission) {
                throw new RuntimeException("Permission denied.");
            }
        }

        /**
         * ???
         */
        if (StringUtils.isNotEmpty(sysDataTable.getPerms())
                && !StringUtils.equalsIgnoreCase(sysDataTable.getPerms(), "anyone")) {
            if (loginContext.hasSystemPermission() || loginContext.hasAdvancedPermission()) {
                hasPermission = true;
            }
            List<String> permissions = StringTools.split(sysDataTable.getPerms());
            for (String perm : permissions) {
                if (loginContext.getPermissions().contains(perm)) {
                    hasPermission = true;
                }
                if (loginContext.getRoles().contains(perm)) {
                    hasPermission = true;
                }
                if (StringUtils.isNotEmpty(perm) && StringUtils.isNumeric(perm)) {
                    if (loginContext.getRoleIds().contains(Long.parseLong(perm))) {
                        hasPermission = true;
                    }
                }
            }
            if (!hasPermission) {
                throw new RuntimeException("Permission denied.");
            }
        }
    }
}

From source file:edu.usu.sdl.openstorefront.sort.BeanComparator.java

@Override
public int compare(T o1, T o2) {
    T obj1 = o1;/*  w  w w.ja  va 2s.  co m*/
    T obj2 = o2;
    if (OpenStorefrontConstant.SORT_ASCENDING.equals(sortDirection)) {
        obj1 = o2;
        obj2 = o1;
    }

    if (obj1 != null && obj2 == null) {
        return 1;
    } else if (obj1 == null && obj2 != null) {
        return -1;
    } else if (obj1 != null && obj2 != null) {
        if (StringUtils.isNotBlank(sortField)) {
            try {
                Object o = obj1;
                Class<?> c = o.getClass();

                Field f = c.getDeclaredField(sortField);
                f.setAccessible(true);
                if (f.get(o) instanceof Date) {
                    int compare = 0;
                    DateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH);
                    if (BeanUtils.getProperty(obj1, sortField) != null
                            && BeanUtils.getProperty(obj2, sortField) == null) {
                        return 1;
                    } else if (BeanUtils.getProperty(obj1, sortField) == null
                            && BeanUtils.getProperty(obj2, sortField) != null) {
                        return -1;
                    } else if (BeanUtils.getProperty(obj1, sortField) != null
                            && BeanUtils.getProperty(obj2, sortField) != null) {
                        Date value1 = format.parse(BeanUtils.getProperty(obj1, sortField));
                        Date value2 = format.parse(BeanUtils.getProperty(obj2, sortField));
                        if (value1 != null && value2 == null) {
                            return 1;
                        } else if (value1 == null && value2 != null) {
                            return -1;
                        } else if (value1 != null && value2 != null) {

                            compare = value1.compareTo(value2);
                        }
                    }
                    return compare;
                } else {
                    try {
                        String value1 = BeanUtils.getProperty(obj1, sortField);
                        String value2 = BeanUtils.getProperty(obj2, sortField);
                        if (value1 != null && value2 == null) {
                            return 1;
                        } else if (value1 == null && value2 != null) {
                            return -1;
                        } else if (value1 != null && value2 != null) {

                            if (StringUtils.isNotBlank(value1) && StringUtils.isNotBlank(value2)
                                    && StringUtils.isNumeric(value1) && StringUtils.isNumeric(value2)) {

                                BigDecimal numValue1 = new BigDecimal(value1);
                                BigDecimal numValue2 = new BigDecimal(value2);
                                return numValue1.compareTo(numValue2);
                            } else {
                                return value1.toLowerCase().compareTo(value2.toLowerCase());
                            }
                        }
                    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
                        log.log(Level.FINER, MessageFormat.format("Sort field doesn''t exist: {0}", sortField));
                    }
                }
            } catch (ParseException | NoSuchFieldException | SecurityException | IllegalArgumentException
                    | IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
                try {
                    String value1 = BeanUtils.getProperty(obj1, sortField);
                    String value2 = BeanUtils.getProperty(obj2, sortField);
                    if (value1 != null && value2 == null) {
                        return 1;
                    } else if (value1 == null && value2 != null) {
                        return -1;
                    } else if (value1 != null && value2 != null) {

                        if (StringUtils.isNotBlank(value1) && StringUtils.isNotBlank(value2)
                                && StringUtils.isNumeric(value1) && StringUtils.isNumeric(value2)) {

                            BigDecimal numValue1 = new BigDecimal(value1);
                            BigDecimal numValue2 = new BigDecimal(value2);
                            return numValue1.compareTo(numValue2);
                        } else {
                            return value1.toLowerCase().compareTo(value2.toLowerCase());
                        }
                    }
                } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex2) {
                    log.log(Level.FINER, MessageFormat.format("Sort field doesn''t exist: {0}", sortField));
                }
            }
        }
    }
    return 0;
}

From source file:com.evolveum.midpoint.test.util.Lsof.java

public int count() throws NumberFormatException, IOException, InterruptedException {
    lsofOutput = execLsof(pid);/*  ww  w.jav  a2 s. co m*/

    //      if (LOGGER.isTraceEnabled()) {
    //         LOGGER.trace("LSOF output:\n{}", lsofOutput);
    //      }

    String[] lines = lsofOutput.split("\n");

    Pattern fdPattern = Pattern.compile("(\\d+)(\\S*)");
    Pattern namePatternJar = Pattern.compile("/.+\\.jar");
    Pattern namePatternFile = Pattern.compile("/.*");
    Pattern namePatternPipe = Pattern.compile("pipe");
    Pattern namePatternEventpoll = Pattern.compile("\\[eventpoll\\]");

    typeMap = new HashMap<>();
    miscMap = new HashMap<>();
    nodeMap = new HashMap<>();

    totalFds = 0;
    for (int lineNum = 1; lineNum < lines.length; lineNum++) {
        String line = lines[lineNum];
        String[] columns = line.split("\\s+");
        String pidCol = columns[1];
        if (Integer.parseInt(pidCol) != pid) {
            throw new IllegalStateException(
                    "Unexpected pid in line " + lineNum + ", expected " + pid + "\n" + line);
        }

        String fd = columns[3];
        Matcher fdMatcher = fdPattern.matcher(fd);
        //         if (!fdMatcher.matches()) {
        //            LOGGER.trace("SKIP fd {}", fd);
        //            continue;
        //         }

        totalFds++;

        String type = columns[4];
        increment(typeMap, type);

        String node = columns[7];
        String nodeKey = node;
        if (!StringUtils.isNumeric(nodeKey)) {
            nodeKey = nodeKey + ":" + fd;
        }
        nodeMap.put(nodeKey, line);

        String name = columns[8];
        if (namePatternJar.matcher(name).matches()) {
            increment(miscMap, "jar");
        } else if (namePatternFile.matcher(name).matches()) {
            increment(miscMap, "file");
        } else if (namePatternPipe.matcher(name).matches()) {
            increment(miscMap, "pipe");
        } else if (namePatternEventpoll.matcher(name).matches()) {
            increment(miscMap, "eventpoll");
        } else if ("TCP".equals(node)) {
            increment(miscMap, "TCP");
        } else {
            increment(miscMap, "other");
        }
    }

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("lsof counts:\n{}", debugDump(1));
    }

    return totalFds;
}

From source file:jp.primecloud.auto.process.nifty.NiftyVolumeProcess.java

/**
 * TODO: //  w ww .j av a  2s  . com
 *
 * @param niftyProcessClient
 * @param instanceNo
 * @param volumeNo
 */
public void startVoiume(NiftyProcessClient niftyProcessClient, Long instanceNo, Long volumeNo) {
    NiftyVolume niftyVolume = niftyVolumeDao.read(volumeNo);
    Integer scsiId = null;

    // ID????
    if (StringUtils.isNotEmpty(niftyVolume.getInstanceId())) {
        return;
    }

    NiftyInstance niftyInstance = niftyInstanceDao.read(instanceNo);

    //
    Component component = componentDao.read(niftyVolume.getComponentNo());
    Instance instance = instanceDao.read(instanceNo);
    Platform platform = platformDao.read(niftyProcessClient.getPlatformNo());

    VolumeDto volume;
    if (StringUtils.isEmpty(niftyVolume.getVolumeId())) {
        try {
            // (api??????)
            synchronized (lock) {
                //
                processLogger.writeLogSupport(ProcessLogger.LOG_DEBUG, component, instance, "NiftyDiskCreate",
                        new Object[] { platform.getPlatformName() });

                // ID??????????
                volume = niftyProcessClient.createVolume(niftyVolume.getSize(), niftyInstance.getInstanceId());
                // 
                niftyVolume.setVolumeId(volume.getVolumeId());
                niftyVolume.setStatus(volume.getStatus());
                niftyVolumeDao.update(niftyVolume);
                // ???
                volume = niftyProcessClient.waitCreateVolume(volume.getVolumeId());

                //
                processLogger.writeLogSupport(ProcessLogger.LOG_DEBUG, component, instance,
                        "NiftyDiskCreateFinish", new Object[] { platform.getPlatformName(),
                                volume.getVolumeId(), niftyVolume.getSize() });

                List<VolumeAttachmentDto> attachments = volume.getAttachments();
                String device = attachments.get(0).getDevice();
                //SCSI(xx:yy)???yy???
                Pattern p = Pattern.compile(":([0-9]*)\\)");
                Matcher m = p.matcher(device);
                if (m.find() && StringUtils.isNumeric(m.group(1))) {
                    scsiId = Integer.parseInt(m.group(1));
                } else {
                    //??scsiId?????????
                    throw new AutoException("EPROCESS-000618", niftyVolume.getVolumeId());
                }

                // 
                niftyVolume.setSize(Integer.valueOf(volume.getSize()));
                niftyVolume.setStatus(volume.getStatus());
                niftyVolume.setScsiId(scsiId);
                niftyVolume.setInstanceId(niftyInstance.getInstanceId());
                niftyVolumeDao.update(niftyVolume);
            }
        } catch (AutoException e) {
            // 
            niftyVolume.setVolumeId(null);
            niftyVolume.setStatus(null);
            niftyVolume.setInstanceId(null);
            niftyVolumeDao.update(niftyVolume);
            throw e;
        }
    } else {
        try {
            // (api??????)
            synchronized (lock) {
                //
                processLogger.writeLogSupport(ProcessLogger.LOG_DEBUG, component, instance, "NiftyDiskAttach",
                        new Object[] { instance.getInstanceName(), niftyVolume.getVolumeId() });

                // ??
                niftyProcessClient.attachVolume(niftyVolume.getVolumeId(), niftyInstance.getInstanceId());
                // 
                niftyVolume.setInstanceId(niftyInstance.getInstanceId());
                niftyVolumeDao.update(niftyVolume);

                // ???
                volume = niftyProcessClient.waitAttachVolume(niftyVolume.getVolumeId(),
                        niftyInstance.getInstanceId());

                //
                processLogger.writeLogSupport(ProcessLogger.LOG_DEBUG, component, instance,
                        "NiftyDiskAttachFinish",
                        new Object[] { instance.getInstanceName(), niftyVolume.getVolumeId() });

                List<VolumeAttachmentDto> attachments = volume.getAttachments();
                String device = attachments.get(0).getDevice();
                //SCSI(xx:yy)???yy???
                Pattern p = Pattern.compile(":([0-9]*)\\)");
                Matcher m = p.matcher(device);
                if (m.find() && StringUtils.isNumeric(m.group(1))) {
                    scsiId = Integer.parseInt(m.group(1));
                } else {
                    //??scsiId?????????
                    throw new AutoException("EPROCESS-000618", niftyVolume.getVolumeId());
                }

                // 
                niftyVolume.setStatus(volume.getStatus());
                niftyVolume.setScsiId(scsiId);
                niftyVolumeDao.update(niftyVolume);
            }
        } catch (AutoException e) {
            // 
            niftyVolume.setStatus("error");
            niftyVolume.setInstanceId(null);
            niftyVolumeDao.update(niftyVolume);
            throw e;
        }
    }
}

From source file:com.impetus.kundera.rest.common.EntityUtils.java

/**
 * @param queryString//  w  ww .  j a v a  2 s  .c om
 * @param q
 * @param em
 */
public static void setObjectQueryParameters(String queryString, String parameterString, Query q,
        EntityManager em, String mediaType) {
    MetamodelImpl metamodel = (MetamodelImpl) em.getEntityManagerFactory().getMetamodel();

    if (parameterString == null || parameterString.isEmpty()) {
        return;
    }

    Map<String, String> paramsMap = new HashMap<String, String>();
    ObjectMapper mapper = new ObjectMapper();

    try {
        paramsMap = mapper.readValue(parameterString, new TypeReference<HashMap<String, String>>() {
        });
        KunderaQuery kq = ((QueryImpl) q).getKunderaQuery();
        Set<Parameter<?>> parameters = kq.getParameters();
        for (String paramName : paramsMap.keySet()) {
            String value = paramsMap.get(paramName);

            if (paramName.equalsIgnoreCase("firstResult")) {
                q.setFirstResult(Integer.parseInt(value));

            } else if (paramName.equalsIgnoreCase("maxResult")) {
                q.setMaxResults(Integer.parseInt(value));

            } else if (StringUtils.isNumeric(paramName)) {
                for (Parameter param : parameters) {
                    if (param.getPosition() == Integer.parseInt(paramName)) {

                        Class<?> paramClass = param.getParameterType();
                        Object paramValue = null;
                        if (metamodel.isEmbeddable(paramClass)) {
                            paramValue = JAXBUtils.toObject(StreamUtils.toInputStream(value), paramClass,
                                    mediaType);

                        } else {
                            PropertyAccessor accessor = PropertyAccessorFactory.getPropertyAccessor(paramClass);
                            paramValue = accessor.fromString(paramClass, value);
                        }

                        q.setParameter(Integer.parseInt(paramName), paramValue);
                        break;
                    }
                }
            } else {
                for (Parameter param : parameters) {
                    if (param.getName().equals(paramName)) {

                        Class<?> paramClass = param.getParameterType();
                        Object paramValue = null;

                        if (metamodel.isEmbeddable(paramClass)) {
                            paramValue = JAXBUtils.toObject(StreamUtils.toInputStream(value), paramClass,
                                    mediaType);

                        } else {
                            PropertyAccessor accessor = PropertyAccessorFactory.getPropertyAccessor(paramClass);
                            paramValue = accessor.fromString(paramClass, value);
                        }
                        q.setParameter(paramName, paramValue);
                        break;
                    }
                }

            }
        }

    } catch (JsonParseException e) {
        log.error(e.getMessage());
    } catch (JsonMappingException e) {
        log.error(e.getMessage());
    } catch (IOException e) {
        log.error(e.getMessage());
    }
}

From source file:com.lm.lic.manager.controller.IsvManWithdrawLicHandler.java

public boolean verifyIsvRequest(HttpServletRequest request) {
    boolean valid = false;
    String isvId = GenUtil.findLoggedinIsv(request, loginService);
    valid = StringUtils.isNotEmpty(isvId) && StringUtils.isNumeric(isvId);
    return valid;
}

From source file:fr.paris.lutece.portal.web.system.DaemonsJspBean.java

/**
 * Process the daemon action//  w  ww . j av a  2  s .c om
 * @param request The HTTP request
 * @return The forward URL
 */
public String doDaemonAction(HttpServletRequest request) {
    String strAction = request.getParameter(PARAMETER_ACTION);
    String strDaemonKey = request.getParameter(PARAMETER_DAEMON);

    if (strAction.equalsIgnoreCase(ACTION_START)) {
        AppDaemonService.startDaemon(strDaemonKey);
    } else if (strAction.equalsIgnoreCase(ACTION_STOP)) {
        AppDaemonService.stopDaemon(strDaemonKey);
    }

    else if (strAction.equalsIgnoreCase(ACTION_UPDATE_INTERVAL)) {
        String strErrorMessage = null;
        String strDaemonInterval = request.getParameter(PARAMETER_INTERVAL);

        Object[] tabFieldInterval = { I18nService.getLocalizedString(PROPERTY_FIELD_INTERVAL, getLocale()) };

        if (StringUtils.isEmpty(strDaemonInterval)) {
            strErrorMessage = MESSAGE_MANDATORY_FIELD;
        } else if (!StringUtils.isNumeric(strDaemonInterval)) {
            strErrorMessage = MESSAGE_NUMERIC_FIELD;
        }

        if (strErrorMessage != null) {
            return AdminMessageService.getMessageUrl(request, strErrorMessage, tabFieldInterval,
                    AdminMessage.TYPE_STOP);
        }

        AppDaemonService.modifyDaemonInterval(strDaemonKey, strDaemonInterval);
    }

    return getHomeUrl(request);
}

From source file:fr.paris.lutece.plugins.suggest.service.subscription.SuggestSubscribersNotificationDaemon.java

/**
 * {@inheritDoc}/*w ww. java 2  s . c  o  m*/
 */
@Override
public void run() {
    synchronized (this) {
        Date date = new Date();
        String strLastRunDate = DatastoreService.getInstanceDataValue(DATASTORE_DAEMON_LAST_RUN_KEY, null);

        if (StringUtils.isNotEmpty(strLastRunDate) && StringUtils.isNumeric(strLastRunDate)) {
            resetNotifSend();

            Plugin plugin = PluginService.getPlugin(SuggestPlugin.PLUGIN_NAME);
            Date dateLastRun = new Date(Long.parseLong(strLastRunDate));

            // We get the list of comments posted after the last run of this daemon
            List<CommentSubmit> listComment = CommentSubmitHome.findSuggestCommentByDate(dateLastRun, plugin);
            if ((listComment != null) && (listComment.size() > 0)) {
                // We order the list of comments by suggest submit
                Map<Integer, List<CommentSubmit>> mapCommentsBySuggestSubmitId = new HashMap<Integer, List<CommentSubmit>>(
                        listComment.size());

                for (CommentSubmit comment : listComment) {
                    comment.setSuggestSubmit(SuggestSubmitHome
                            .findByPrimaryKey(comment.getSuggestSubmit().getIdSuggestSubmit(), plugin));
                    addCommentToMap(comment, mapCommentsBySuggestSubmitId);
                }

                // Now that the map contain every comment ordered by suggest submit, we just have to generate notifications

                // We get the list of subscriptions to suggest submits
                SubscriptionFilter subscriptionFilter = new SubscriptionFilter();
                subscriptionFilter
                        .setSubscriptionKey(SuggestSubscriptionProviderService.SUBSCRIPTION_SUGGEST_SUBMIT);
                subscriptionFilter.setSubscriptionProvider(
                        SuggestSubscriptionProviderService.getService().getProviderName());

                List<Subscription> listSubscription = SubscriptionService.getInstance()
                        .findByFilter(subscriptionFilter);

                if ((listSubscription != null) && (listSubscription.size() > 0)) {
                    for (Subscription subscription : listSubscription) {
                        if (StringUtils.isNotEmpty(subscription.getIdSubscribedResource())
                                && StringUtils.isNumeric(subscription.getIdSubscribedResource())) {
                            int nIdSuggestSubmit = Integer.parseInt(subscription.getIdSubscribedResource());
                            List<CommentSubmit> listComments = mapCommentsBySuggestSubmitId
                                    .get(nIdSuggestSubmit);

                            if ((listComments != null) && (listComments.size() > 0)) {
                                registerCommentNotificationToSend(listComments, subscription.getUserId());
                            }
                        }
                    }

                    sendRegisteredCommentNotifications(plugin);
                    // We clear registered notifications
                    _mapCommentNotif = null;
                }
            }

            SubmitFilter submitFilter = new SubmitFilter();
            submitFilter.setDateFirst(new Timestamp(dateLastRun.getTime()));

            List<SuggestSubmit> listCreatedSuggestSubmit = SuggestSubmitService.getService()
                    .getSuggestSubmitList(submitFilter, plugin);

            if ((listCreatedSuggestSubmit != null) && (listCreatedSuggestSubmit.size() > 0)) {
                // We get the list of subscriptions to suggest categories
                SubscriptionFilter subscriptionFilter = new SubscriptionFilter();
                subscriptionFilter
                        .setSubscriptionKey(SuggestSubscriptionProviderService.SUBSCRIPTION_SUGGEST_CATEGORY);
                subscriptionFilter.setSubscriptionProvider(
                        SuggestSubscriptionProviderService.getService().getProviderName());

                List<Subscription> listSubscription = SubscriptionService.getInstance()
                        .findByFilter(subscriptionFilter);

                if ((listSubscription != null) && (listSubscription.size() > 0)) {
                    for (Subscription subscription : listSubscription) {
                        if (StringUtils.isNotEmpty(subscription.getIdSubscribedResource())
                                && StringUtils.isNumeric(subscription.getIdSubscribedResource())) {
                            int nIdCategory = SuggestUtils
                                    .getIntegerParameter(subscription.getIdSubscribedResource());

                            for (SuggestSubmit suggestSubmit : listCreatedSuggestSubmit) {
                                if (nIdCategory != SuggestUtils.CONSTANT_ID_NULL
                                        && suggestSubmit.getCategory() != null
                                        && nIdCategory == suggestSubmit.getCategory().getIdCategory()) {
                                    registerSuggestSubmitNotificationToSend(suggestSubmit,
                                            subscription.getUserId());
                                }
                            }
                        }
                    }
                }

                subscriptionFilter = new SubscriptionFilter();
                subscriptionFilter.setSubscriptionKey(SuggestSubscriptionProviderService.SUBSCRIPTION_SUGGEST);
                subscriptionFilter.setSubscriptionProvider(
                        SuggestSubscriptionProviderService.getService().getProviderName());
                listSubscription = SubscriptionService.getInstance().findByFilter(subscriptionFilter);

                if ((listSubscription != null) && (listSubscription.size() > 0)) {
                    for (Subscription subscription : listSubscription) {
                        if (StringUtils.isNotEmpty(subscription.getIdSubscribedResource())
                                && StringUtils.isNumeric(subscription.getIdSubscribedResource())) {
                            int nIdSuggest = Integer.parseInt(subscription.getIdSubscribedResource());

                            for (SuggestSubmit suggestSubmit : listCreatedSuggestSubmit) {
                                if (nIdSuggest == suggestSubmit.getSuggest().getIdSuggest()) {
                                    registerSuggestSubmitNotificationToSend(suggestSubmit,
                                            subscription.getUserId());
                                }
                            }
                        }
                    }
                }

                sendRegisteredSuggestSubmitNotifications(plugin);
            }
        }

        DatastoreService.setInstanceDataValue(DATASTORE_DAEMON_LAST_RUN_KEY, Long.toString(date.getTime()));
    }
}