use of org.b3log.latke.repository.annotation.Transactional in project symphony by b3log.
the class NotificationMgmtService method addCommentNotification.
/**
* Adds a 'comment' 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 addCommentNotification(final JSONObject requestJSONObject) throws ServiceException {
try {
requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_COMMENT);
addNotification(requestJSONObject);
} catch (final RepositoryException e) {
final String msg = "Adds notification [type=comment] failed";
LOGGER.log(Level.ERROR, msg, e);
throw new ServiceException(msg);
}
}
use of org.b3log.latke.repository.annotation.Transactional in project symphony by b3log.
the class NotificationMgmtService method addPerfectArticleNotification.
/**
* Adds a 'point - perfect article' 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 addPerfectArticleNotification(final JSONObject requestJSONObject) throws ServiceException {
try {
requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_POINT_PERFECT_ARTICLE);
addNotification(requestJSONObject);
} catch (final RepositoryException e) {
final String msg = "Adds notification [type=perfect_article] failed";
LOGGER.log(Level.ERROR, msg, e);
throw new ServiceException(msg);
}
}
use of org.b3log.latke.repository.annotation.Transactional in project symphony by b3log.
the class NotificationMgmtService method addBroadcastNotification.
/**
* Adds a 'broadcast' 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 addBroadcastNotification(final JSONObject requestJSONObject) throws ServiceException {
try {
requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_BROADCAST);
addNotification(requestJSONObject);
} catch (final RepositoryException e) {
final String msg = "Adds notification [type=broadcast] failed";
LOGGER.log(Level.ERROR, msg, e);
throw new ServiceException(msg);
}
}
use of org.b3log.latke.repository.annotation.Transactional in project symphony by b3log.
the class NotificationMgmtService method addInvitationLinkUsedNotification.
/**
* Adds a 'invitation link used' type notification with the specified request json object.
*
* @param requestJSONObject the specified request json object, for example,
* "userId"; "",
* "dataId": "" // invited user id
* @throws ServiceException service exception
*/
@Transactional
public void addInvitationLinkUsedNotification(final JSONObject requestJSONObject) throws ServiceException {
try {
requestJSONObject.put(Notification.NOTIFICATION_DATA_TYPE, Notification.DATA_TYPE_C_INVITATION_LINK_USED);
addNotification(requestJSONObject);
} catch (final RepositoryException e) {
final String msg = "Adds notification [type=invitation_link_used] failed";
LOGGER.log(Level.ERROR, msg, e);
throw new ServiceException(msg);
}
}
use of org.b3log.latke.repository.annotation.Transactional in project symphony by b3log.
the class RoleMgmtService method addRole.
/**
* Adds the specified role.
*
* @param role the specified role
*/
@Transactional
public void addRole(final JSONObject role) {
try {
final String roleName = role.optString(Role.ROLE_NAME);
final Query query = new Query().setFilter(new PropertyFilter(Role.ROLE_NAME, FilterOperator.EQUAL, roleName));
if (roleRepository.count(query) > 0) {
return;
}
roleRepository.add(role);
} catch (final RepositoryException e) {
LOGGER.log(Level.ERROR, "Adds role failed", e);
}
}
Aggregations