本文整理了Java中org.sakaiproject.entity.api.Reference.isKnownType
方法的一些代码示例,展示了Reference.isKnownType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.isKnownType
方法的具体详情如下:
包路径:org.sakaiproject.entity.api.Reference
类名称:Reference
方法名:isKnownType
[英]Check if the reference's type is known
[中]检查引用的类型是否已知
代码示例来源:origin: org.sakaiproject.polls/polls-impl
public List<String> getSitesForUser(String userId, String permission) {
log.debug("userId: " + userId + ", permission: " + permission);
List<String> l = new ArrayList<String>();
// get the groups from Sakai
Set<String> authzGroupIds =
authzGroupService.getAuthzGroupsIsAllowed(userId, permission, null);
Iterator<String> it = authzGroupIds.iterator();
while (it.hasNext()) {
String authzGroupId = it.next();
Reference r = entityManager.newReference(authzGroupId);
if (r.isKnownType()) {
// check if this is a Sakai Site or Group
if (r.getType().equals(SiteService.APPLICATION_ID)) {
String type = r.getSubType();
if (SAKAI_SITE_TYPE.equals(type)) {
// this is a Site
String siteId = r.getId();
l.add(siteId);
}
}
}
}
if (l.isEmpty()) log.info("Empty list of siteIds for user:" + userId + ", permission: " + permission);
return l;
}
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl
/**
* Return the url unchanged, unless it's a reference, then return the reference url
*/
protected String convertReferenceUrl(String url)
{
// make a reference
Reference ref = entityManager().newReference(url);
// if it didn't recognize this, return it unchanged
if (!ref.isKnownType()) return url;
// return the reference's url
return ref.getUrl();
}
内容来源于网络,如有侵权,请联系作者删除!