use of com.itrus.portal.db.CrlContextExample in project portal by ixinportal.
the class CrlContextController method list.
// 列表所有信息
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
// page,size
if (page == null || page < 1)
page = 1;
if (size == null || size < 1)
size = 10;
// count,pages
Integer count = sqlSession.selectOne("com.itrus.portal.db.CrlContextMapper.countByExample", null);
uiModel.addAttribute("count", count);
uiModel.addAttribute("pages", (count + size - 1) / size);
// page, size
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
// query data
Integer offset = size * (page - 1);
RowBounds rowBounds = new RowBounds(offset, size);
CrlContextExample example = new CrlContextExample();
List crlList = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectByExample", example, rowBounds);
uiModel.addAttribute("crlList", crlList);
// itemcount
uiModel.addAttribute("itemcount", crlList.size());
return "crlcontext/list";
}
use of com.itrus.portal.db.CrlContextExample in project portal by ixinportal.
the class TrustService method initCVM.
/**
* 初始化CVM
*/
public void initCVM() {
CVM.clear();
CrlContextExample example = new CrlContextExample();
List<CrlContext> contexts = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectByExampleWithBLOBs", example);
// 若没有配置信任源则不进行初始化
if (contexts.isEmpty())
return;
try {
for (CrlContext context : contexts) {
X509Certificate x509cert = null;
if (context.getCaCertBuf() != null && context.getCaCertBuf().length > 0) {
x509cert = X509Certificate.getInstance(context.getCaCertBuf());
}
CVM.addSupportCA(x509cert, context.getCrlUrl().trim(), context.getRetryPolicy().trim(), !context.getCheckCrl());
}
} catch (CertificateException e) {
e.printStackTrace();
} catch (NoSuchProviderException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations