Search in sources :

Example 1 with QmsThemes

use of forpdateam.ru.forpda.api.qms.models.QmsThemes in project ForPDA by RadiationX.

the class Qms method parseThemes.

private QmsThemes parseThemes(String response, int id) {
    QmsThemes qmsThemes = new QmsThemes();
    Matcher matcher = threadPattern.matcher(response);
    while (matcher.find()) {
        QmsTheme thread = new QmsTheme();
        thread.setId(Integer.parseInt(matcher.group(1)));
        thread.setDate(matcher.group(2));
        thread.setName(ApiUtils.fromHtml(matcher.group(3).trim()));
        thread.setCountMessages(Integer.parseInt(matcher.group(4)));
        String countNew = matcher.group(5);
        thread.setCountNew(countNew == null || countNew.isEmpty() ? 0 : Integer.parseInt(countNew));
        qmsThemes.addTheme(thread);
    }
    matcher = threadNickPattern.matcher(response);
    if (matcher.find()) {
        qmsThemes.setNick(ApiUtils.fromHtml(matcher.group(1)));
    }
    qmsThemes.setUserId(id);
    return qmsThemes;
}
Also used : QmsThemes(forpdateam.ru.forpda.api.qms.models.QmsThemes) Matcher(java.util.regex.Matcher) QmsTheme(forpdateam.ru.forpda.api.qms.models.QmsTheme)

Aggregations

QmsTheme (forpdateam.ru.forpda.api.qms.models.QmsTheme)1 QmsThemes (forpdateam.ru.forpda.api.qms.models.QmsThemes)1 Matcher (java.util.regex.Matcher)1