本文整理了Java中io.kaif.model.zone.ZoneInfo.getWriteAuthority()
方法的一些代码示例,展示了ZoneInfo.getWriteAuthority()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneInfo.getWriteAuthority()
方法的具体详情如下:
包路径:io.kaif.model.zone.ZoneInfo
类名称:ZoneInfo
方法名:getWriteAuthority
暂无
代码示例来源:origin: kaif-open/kaif
@Override
public List<ZoneInfo> listCitizenZones() {
return zoneDao.listOrderByName()
.stream()
.filter(zoneInfo -> zoneInfo.getWriteAuthority() == Authority.CITIZEN)
.collect(toList());
}
代码示例来源:origin: kaif-open/kaif
private Article createArticle(Authorization authorization,
Zone zone,
BiFunction<ZoneInfo, Account, Article> articleCreator) {
//creating article should not use cache
ZoneInfo zoneInfo = zoneDao.loadZoneWithoutCache(zone);
Account author = accountDao.strongVerifyAccount(authorization)
.filter(zoneInfo::canWriteArticle)
.orElseThrow(() -> new AccessDeniedException("no write to create article at zone:" + zone));
Article article = articleCreator.apply(zoneInfo, author);
if (zoneInfo.getWriteAuthority() == Authority.CITIZEN) {
accountDao.increaseArticleCount(author);
}
return article;
}
代码示例来源: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));
}
内容来源于网络,如有侵权,请联系作者删除!