Search in sources :

Example 16 with Transactional

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

the class NotificationMgmtService method addArticleNotification.

/**
 * Adds a 'article' type notification with the specified request json object.
 *
 * @param requestJSONObject the specified request json object, for example,
 *                          "userId"; "",
 *                          "dataId": ""
 * @throws ServiceException service exception
 */
// XXX: Unused
@Transactional
public void addArticleNotification(final JSONObject requestJSONObject) throws ServiceException {
    try {
        requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_ARTICLE);
        addNotification(requestJSONObject);
    } catch (final RepositoryException e) {
        final String msg = "Adds notification [type=article] 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 17 with Transactional

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

the class NotificationMgmtService method addSysAnnounceRoleChangedNotification.

/**
 * Adds a 'sys announce - role changed' type notification with the specified request json object.
 *
 * @param requestJSONObject the specified request json object, for example,
 *                          "userId"; "",
 *                          "dataId": "" // oldRoleId-newRoleId
 * @throws ServiceException service exception
 */
@Transactional
public void addSysAnnounceRoleChangedNotification(final JSONObject requestJSONObject) throws ServiceException {
    try {
        requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_SYS_ANNOUNCE_ROLE_CHANGED);
        addNotification(requestJSONObject);
    } catch (final RepositoryException e) {
        final String msg = "Adds notification [type=sys_announce_role_changed] 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 18 with Transactional

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

the class NotificationMgmtService method addFollowingArticleUpdateNotification.

/**
 * Adds a 'following - article update' 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 addFollowingArticleUpdateNotification(final JSONObject requestJSONObject) throws ServiceException {
    try {
        requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_FOLLOWING_ARTICLE_UPDATE);
        addNotification(requestJSONObject);
    } catch (final RepositoryException e) {
        final String msg = "Adds notification [type=following_article_update] 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 19 with Transactional

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

the class NotificationMgmtService method addSysAnnounceNewUserNotification.

/**
 * Adds a 'sys announce - new 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 addSysAnnounceNewUserNotification(final JSONObject requestJSONObject) throws ServiceException {
    try {
        requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_SYS_ANNOUNCE_NEW_USER);
        addNotification(requestJSONObject);
    } catch (final RepositoryException e) {
        final String msg = "Adds notification [type=sys_announce_new_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 20 with Transactional

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

the class NotificationMgmtService method addPointExchangeNotification.

/**
 * Adds a 'point exchange' 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 addPointExchangeNotification(final JSONObject requestJSONObject) throws ServiceException {
    try {
        requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_POINT_EXCHANGE);
        addNotification(requestJSONObject);
    } catch (final RepositoryException e) {
        final String msg = "Adds notification [type=point_exchange] 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