コード例 #1
0
  /**
   * @BeforeClass
   *
   * @throws Exception
   */
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    TestCommon.setUpBeforeClass();
    DBUserPool.get().setUser(loginedUser.getUserId());

    LOG.info("テストユーザ1でKnowledge登録");
    KnowledgesEntity knowledge = new KnowledgesEntity();
    knowledge.setTitle("テスト1");
    knowledge.setContent("テスト");
    knowledge.setPublicFlag(KnowledgeLogic.PUBLIC_FLAG_PUBLIC); // 公開
    knowledge1 = KnowledgeLogic.get().insert(knowledge, null, null, null, null, null, loginedUser);

    LOG.info("テストユーザ1でKnowledge登録");
    knowledge = new KnowledgesEntity();
    knowledge.setTitle("テスト2");
    knowledge.setContent("テスト2");
    knowledge.setPublicFlag(KnowledgeLogic.PUBLIC_FLAG_PRIVATE); // 非公開
    knowledge2 = KnowledgeLogic.get().insert(knowledge, null, null, null, null, null, loginedUser);

    LOG.info("テストユーザ1でKnowledge登録");
    knowledge = new KnowledgesEntity();
    knowledge.setTitle("テスト3");
    knowledge.setContent("テスト3");
    knowledge.setPublicFlag(KnowledgeLogic.PUBLIC_FLAG_PROTECT); // 非公開
    List<LabelValue> targets = new ArrayList<>();
    LabelValue labelValue = new LabelValue();
    labelValue.setLabel(TargetLogic.ID_PREFIX_USER + loginedUser2.getUserId());
    labelValue.setValue(TargetLogic.ID_PREFIX_USER + loginedUser2.getUserId());
    targets.add(labelValue);
    knowledge3 =
        KnowledgeLogic.get().insert(knowledge, null, null, targets, null, null, loginedUser);

    LOG.info("テストユーザ1でKnowledge登録");
    knowledge = new KnowledgesEntity();
    knowledge.setTitle("テスト4");
    knowledge.setContent("テスト4");
    knowledge.setPublicFlag(KnowledgeLogic.PUBLIC_FLAG_PROTECT); // 非公開
    targets = new ArrayList<>();
    labelValue = new LabelValue();
    labelValue.setLabel(TargetLogic.ID_PREFIX_GROUP + group.getGroupId());
    labelValue.setValue(TargetLogic.ID_PREFIX_GROUP + group.getGroupId());
    targets.add(labelValue);
    knowledge4 =
        KnowledgeLogic.get().insert(knowledge, null, null, targets, null, null, loginedUser);
  }
コード例 #2
0
  @Test
  @Order(order = 5)
  public void testNotify5() throws Exception {
    DBUserPool.get().setUser(loginedUser2.getUserId());
    KnowledgesEntity knowledge = knowledge3;
    // 保護のナレッジにコメント登録
    CommentsEntity comment = new CommentsEntity();
    comment.setKnowledgeId(knowledge.getKnowledgeId());
    CommentsDao.get().save(comment);

    UsersEntity user =
        NotifyCommentLogic.get().getInsertUserOnComment(NotifyType.Desktop, comment, knowledge);
    Assert.assertEquals(loginedUser.getUserId(), user.getUserId());
    user = NotifyCommentLogic.get().getInsertUserOnComment(NotifyType.Mail, comment, knowledge);
    Assert.assertEquals(loginedUser.getUserId(), user.getUserId());

    List<UsersEntity> users =
        NotifyCommentLogic.get().getTargetUsersOnComment(NotifyType.Desktop, comment, knowledge);
    Assert.assertEquals(1, users.size());
    users = NotifyCommentLogic.get().getTargetUsersOnComment(NotifyType.Mail, comment, knowledge);
    Assert.assertEquals(1, users.size());
  }
コード例 #3
0
 /** 復元(論理削除されていたものを有効化) */
 @Aspect(advice = org.support.project.ormapping.transaction.Transaction.class)
 public void activation(String functionKey, Integer roleId) {
   DBUserPool pool = Container.getComp(DBUserPool.class);
   Integer user = (Integer) pool.getUser();
   activation(user, functionKey, roleId);
 }
コード例 #4
0
 /** 更新 */
 @Aspect(advice = org.support.project.ormapping.transaction.Transaction.class)
 public RoleFunctionsEntity update(RoleFunctionsEntity entity) {
   DBUserPool pool = Container.getComp(DBUserPool.class);
   Integer userId = (Integer) pool.getUser();
   return update(userId, entity);
 }
コード例 #5
0
ファイル: GenCommentsDao.java プロジェクト: ZZHGit/knowledge
 /**
  * Ativation. if delete flag is exists and delete flag is true, delete flug is false to activate.
  *
  * @param commentNo commentNo
  */
 @Aspect(advice = org.support.project.ormapping.transaction.Transaction.class)
 public void activation(Long commentNo) {
   DBUserPool pool = Container.getComp(DBUserPool.class);
   Integer user = (Integer) pool.getUser();
   activation(user, commentNo);
 }
コード例 #6
0
ファイル: GenCommentsDao.java プロジェクト: ZZHGit/knowledge
 /**
  * Insert. saved user id is auto set.
  *
  * @param entity entity
  * @return saved entity
  */
 @Aspect(advice = org.support.project.ormapping.transaction.Transaction.class)
 public CommentsEntity insert(CommentsEntity entity) {
   DBUserPool pool = Container.getComp(DBUserPool.class);
   Integer userId = (Integer) pool.getUser();
   return insert(userId, entity);
 }