Search in sources :

Example 41 with Transactional

use of org.b3log.latke.repository.annotation.Transactional in project symphony by b3log.

the class NotificationMgmtService method addFollowingArticleCommentNotification.

/**
 * Adds a 'following - article comment' type notification with the specified request json object.
 *
 * @param requestJSONObject the specified request json object, for example,
 *                          "userId"; "",
 *                          "dataId": "" // comment id
 * @throws ServiceException service exception
 */
@Transactional
public void addFollowingArticleCommentNotification(final JSONObject requestJSONObject) throws ServiceException {
    try {
        requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_FOLLOWING_ARTICLE_COMMENT);
        addNotification(requestJSONObject);
    } catch (final RepositoryException e) {
        final String msg = "Adds notification [type=following_article_comment] failed";
        LOGGER.log(Level.ERROR, msg, e);
        throw new ServiceException(msg);
    }
}
Also used : ServiceException(org.b3log.latke.service.ServiceException) Transactional(org.b3log.latke.repository.annotation.Transactional)

Example 42 with Transactional

use of org.b3log.latke.repository.annotation.Transactional in project symphony by b3log.

the class NotificationMgmtService method addPointChargeNotification.

/**
 * Adds a 'point charge' type notification with the specified request json object.
 *
 * @param requestJSONObject the specified request json object, for example,
 *                          "userId"; "",
 *                          "dataId": "" // transfer record id
 * @throws ServiceException service exception
 */
@Transactional
public void addPointChargeNotification(final JSONObject requestJSONObject) throws ServiceException {
    try {
        requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_POINT_CHARGE);
        addNotification(requestJSONObject);
    } catch (final RepositoryException e) {
        final String msg = "Adds notification [type=point_charge] failed";
        LOGGER.log(Level.ERROR, msg, e);
        throw new ServiceException(msg);
    }
}
Also used : ServiceException(org.b3log.latke.service.ServiceException) Transactional(org.b3log.latke.repository.annotation.Transactional)

Example 43 with Transactional

use of org.b3log.latke.repository.annotation.Transactional in project symphony by b3log.

the class NotificationMgmtService method addReplyNotification.

/**
 * Adds a 'reply' type notification with the specified request json object.
 *
 * @param requestJSONObject the specified request json object, for example,
 *                          "userId"; "",
 *                          "dataId": ""
 * @throws ServiceException service exception
 */
@Transactional
public void addReplyNotification(final JSONObject requestJSONObject) throws ServiceException {
    try {
        requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_REPLY);
        addNotification(requestJSONObject);
    } catch (final RepositoryException e) {
        final String msg = "Adds notification [type=reply] failed";
        LOGGER.log(Level.ERROR, msg, e);
        throw new ServiceException(msg);
    }
}
Also used : ServiceException(org.b3log.latke.service.ServiceException) Transactional(org.b3log.latke.repository.annotation.Transactional)

Example 44 with Transactional

use of org.b3log.latke.repository.annotation.Transactional in project symphony by b3log.

the class NotificationMgmtService method addFollowingUserNotification.

/**
 * Adds a 'following - user' type notification with the specified request json object.
 *
 * @param requestJSONObject the specified request json object, for example,
 *                          "userId"; "",
 *                          "dataId": "" // article id
 * @throws ServiceException service exception
 */
@Transactional
public void addFollowingUserNotification(final JSONObject requestJSONObject) throws ServiceException {
    try {
        requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_FOLLOWING_USER);
        addNotification(requestJSONObject);
    } catch (final RepositoryException e) {
        final String msg = "Adds notification [type=following_user] failed";
        LOGGER.log(Level.ERROR, msg, e);
        throw new ServiceException(msg);
    }
}
Also used : ServiceException(org.b3log.latke.service.ServiceException) Transactional(org.b3log.latke.repository.annotation.Transactional)

Example 45 with Transactional

use of org.b3log.latke.repository.annotation.Transactional in project symphony by b3log.

the class NotificationMgmtService method addPointTransferNotification.

/**
 * Adds a 'point transfer' type notification with the specified request json object.
 *
 * @param requestJSONObject the specified request json object, for example,
 *                          "userId"; "",
 *                          "dataId": "" // transfer record id
 * @throws ServiceException service exception
 */
@Transactional
public void addPointTransferNotification(final JSONObject requestJSONObject) throws ServiceException {
    try {
        requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_POINT_TRANSFER);
        addNotification(requestJSONObject);
    } catch (final RepositoryException e) {
        final String msg = "Adds notification [type=point_transfer] failed";
        LOGGER.log(Level.ERROR, msg, e);
        throw new ServiceException(msg);
    }
}
Also used : ServiceException(org.b3log.latke.service.ServiceException) Transactional(org.b3log.latke.repository.annotation.Transactional)

Aggregations

Transactional (org.b3log.latke.repository.annotation.Transactional)52 ServiceException (org.b3log.latke.service.ServiceException)42 JSONObject (org.json.JSONObject)20 JSONArray (org.json.JSONArray)11 RepositoryException (org.b3log.latke.repository.RepositoryException)6 Query (org.b3log.latke.repository.Query)2 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 URL (java.net.URL)1 ExecutionException (java.util.concurrent.ExecutionException)1 PropertyFilter (org.b3log.latke.repository.PropertyFilter)1 RequestProcessing (org.b3log.latke.servlet.annotation.RequestProcessing)1 TextHTMLRenderer (org.b3log.latke.servlet.renderer.TextHTMLRenderer)1