gpt4 book ai didi

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

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

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

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));
}

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