From bdd5740acb99a919ebbb596c6685ee0d9a6294c2 Mon Sep 17 00:00:00 2001 From: Koda Date: Thu, 21 Apr 2016 05:01:33 +0900 Subject: [PATCH] #356 Set the notification flag when user registration. --- .../knowledge/logic/AddUserProcessLogic.java | 41 +++++++++++++++++++ src/main/resources/appconfig.xml | 1 + 2 files changed, 42 insertions(+) create mode 100644 src/main/java/org/support/project/knowledge/logic/AddUserProcessLogic.java diff --git a/src/main/java/org/support/project/knowledge/logic/AddUserProcessLogic.java b/src/main/java/org/support/project/knowledge/logic/AddUserProcessLogic.java new file mode 100644 index 000000000..fadf0e77c --- /dev/null +++ b/src/main/java/org/support/project/knowledge/logic/AddUserProcessLogic.java @@ -0,0 +1,41 @@ +package org.support.project.knowledge.logic; + +import org.support.project.common.config.INT_FLAG; +import org.support.project.common.log.Log; +import org.support.project.common.log.LogFactory; +import org.support.project.knowledge.dao.ExUsersDao; +import org.support.project.knowledge.dao.NotifyConfigsDao; +import org.support.project.knowledge.entity.NotifyConfigsEntity; +import org.support.project.web.entity.UsersEntity; +import org.support.project.web.logic.AddUserProcess; + +public class AddUserProcessLogic implements AddUserProcess { + /** ログ */ + private static final Log LOG = LogFactory.getLog(AddUserProcessLogic.class); + + @Override + public void addUserProcess(String userKey) { + LOG.debug("addUserProcess"); + + UsersEntity user = ExUsersDao.get().selectOnUserKey(userKey); + if (user == null) { + LOG.debug("user: " + userKey + " is not exists."); + return; + } + + // 追加されたユーザの、通知設定をデフォルトONにする + NotifyConfigsDao notifyConfigsDao = NotifyConfigsDao.get(); + NotifyConfigsEntity entity = new NotifyConfigsEntity(); + entity.setNotifyMail(INT_FLAG.ON.getValue()); + entity.setMyItemComment(INT_FLAG.ON.getValue()); + entity.setMyItemLike(INT_FLAG.ON.getValue()); + entity.setMyItemStock(INT_FLAG.ON.getValue()); + entity.setToItemComment(INT_FLAG.ON.getValue()); + entity.setToItemSave(INT_FLAG.ON.getValue()); + entity.setUserId(user.getUserId()); + notifyConfigsDao.save(entity); + + LOG.debug("set notify config to user: " + userKey + ""); + } + +} diff --git a/src/main/resources/appconfig.xml b/src/main/resources/appconfig.xml index cdaa6d818..75a1eea47 100644 --- a/src/main/resources/appconfig.xml +++ b/src/main/resources/appconfig.xml @@ -20,6 +20,7 @@ en + org.support.project.knowledge.logic.AddUserProcessLogic