gpt4 book ai didi

io.kaif.model.zone.ZoneInfo.getDebateAuthority()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:57:25 30 4
gpt4 key购买 nike

本文整理了Java中io.kaif.model.zone.ZoneInfo.getDebateAuthority()方法的一些代码示例,展示了ZoneInfo.getDebateAuthority()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneInfo.getDebateAuthority()方法的具体详情如下:
包路径:io.kaif.model.zone.ZoneInfo
类名称:ZoneInfo
方法名:getDebateAuthority

ZoneInfo.getDebateAuthority介绍

暂无

代码示例

代码示例来源:origin: kaif-open/kaif

@Override
public Debate debate(FlakeId articleId,
  @Nullable FlakeId parentDebateId,
  Authorization debaterAuth,
  String content) {
 //creating debate should not use cache
 Article article = articleDao.loadArticleWithoutCache(articleId);
 ZoneInfo zoneInfo = zoneDao.loadZoneWithoutCache(article.getZone());
 Account debater = accountDao.strongVerifyAccount(debaterAuth)
   .filter(zoneInfo::canDebate)
   .orElseThrow(() -> new AccessDeniedException("no write to debate at zone:"
     + article.getZone()));
 Debate parent = Optional.ofNullable(parentDebateId).flatMap(debateDao::findDebate).orElse(null);
 Debate debate = debateDao.create(article, parent, content, debater, Instant.now(clock));
 //may improve later to make it async, but async has transaction problem
 articleDao.increaseDebateCount(article);
 if (zoneInfo.getDebateAuthority() == Authority.CITIZEN) {
  accountDao.increaseDebateCount(debater);
 }
 if (!debate.getReplyToAccountId().equals(debater.getAccountId())) {
  feedService.createReplyFeed(debate.getDebateId(), debate.getReplyToAccountId());
 }
 return debate;
}

代码示例来源:origin: kaif-open/kaif

@CacheEvict(value = "listAdministrators", key = "#a0.zone")
public ZoneInfo create(ZoneInfo zoneInfo) {
 jdbc().update(""
     + " INSERT "
     + "   INTO ZoneInfo "
     + "        (zone, aliasName, theme, voteAuthority, debateAuthority, writeAuthority, "
     + "         createTime, adminAccountIds, hideFromTop) "
     + " VALUES "
     + questions(9),
   zoneInfo.getZone().value(),
   zoneInfo.getAliasName(),
   zoneInfo.getTheme(),
   zoneInfo.getVoteAuthority().name(),
   zoneInfo.getDebateAuthority().name(),
   zoneInfo.getWriteAuthority().name(),
   Timestamp.from(zoneInfo.getCreateTime()),
   createUuidArray(zoneInfo.getAdminAccountIds().stream()),
   zoneInfo.isHideFromTop());
 createZoneAdmin(zoneInfo);
 return zoneInfo;
}

代码示例来源:origin: kaif-open/kaif

@Test
public void createDefault() throws Exception {
 ZoneInfo zoneInfo = service.createDefault("abc", "Abc");
 ZoneInfo loaded = zoneDao.loadZoneWithoutCache(Zone.valueOf("abc"));
 assertEquals(zoneInfo, loaded);
 assertEquals("abc", loaded.getName());
 assertEquals("Abc", loaded.getAliasName());
 assertEquals(Authority.CITIZEN, loaded.getVoteAuthority());
 assertEquals(Authority.CITIZEN, loaded.getWriteAuthority());
 assertEquals(Authority.CITIZEN, loaded.getDebateAuthority());
 assertEquals(ZoneInfo.THEME_DEFAULT, loaded.getTheme());
 assertFalse(loaded.isHideFromTop());
 assertEquals(0, loaded.getAdminAccountIds().size());
}

代码示例来源:origin: kaif-open/kaif

@Test
public void createKaif() throws Exception {
 ZoneInfo zoneInfo = service.createKaif("faq", "FAQ");
 ZoneInfo loaded = zoneDao.loadZoneWithoutCache(Zone.valueOf("faq"));
 assertEquals(zoneInfo, loaded);
 assertEquals("faq", loaded.getZone().value());
 assertEquals("FAQ", loaded.getAliasName());
 assertEquals(Authority.CITIZEN, loaded.getVoteAuthority());
 assertEquals(Authority.CITIZEN, loaded.getDebateAuthority());
 assertEquals(Authority.FORBIDDEN, loaded.getWriteAuthority());
 assertEquals(ZoneInfo.THEME_KAIF, loaded.getTheme());
 assertTrue(loaded.isHideFromTop());
 assertEquals(0, loaded.getAdminAccountIds().size());
}

代码示例来源:origin: kaif-open/kaif

@Test
public void createByUser() throws Exception {
 accountDao.changeTotalVotedDebate(citizen.getAccountId(), 10, 0);
 ZoneInfo zoneInfo = service.createByUser("aaa", "this is aaa", citizen);
 ZoneInfo loaded = zoneDao.loadZoneWithoutCache(Zone.valueOf("aaa"));
 assertEquals(zoneInfo, loaded);
 assertEquals("aaa", loaded.getName());
 assertEquals("this is aaa", loaded.getAliasName());
 assertEquals(Authority.CITIZEN, loaded.getVoteAuthority());
 assertEquals(Authority.CITIZEN, loaded.getWriteAuthority());
 assertEquals(Authority.CITIZEN, loaded.getDebateAuthority());
 assertEquals(ZoneInfo.THEME_DEFAULT, loaded.getTheme());
 assertFalse(loaded.isHideFromTop());
 assertEquals(citizen.getAccountId(), loaded.getAdminAccountIds().get(0));
 List<ZoneInfo> zones = zoneDao.listZonesByAdmin(citizen.getAccountId());
 assertEquals(zoneInfo, zones.get(0));
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com