Skip to content

Commit

Permalink
Merge pull request #357 from support-project/feature/issue356_default…
Browse files Browse the repository at this point in the history
…_notify_config

#356 Set the notification flag when user registration.
  • Loading branch information
koda-masaru committed Apr 21, 2016
2 parents bd5cfb6 + bdd5740 commit f3b2640
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 + "");
}

}
1 change: 1 addition & 0 deletions src/main/resources/appconfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<value>en</value>
</language>
</languages>
<addUserProcess>org.support.project.knowledge.logic.AddUserProcessLogic</addUserProcess>
</app>


0 comments on commit f3b2640

Please sign in to comment.