热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.xwiki.users.User类的使用及代码示例

本文整理了Java中org.xwiki.users.User类的一些代码示例,展示了User类的具体用法。这些代码示例主要来源于G

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

User介绍

[英]XWiki User Interface.
[中]XWiki用户界面。

代码示例

代码示例来源:origin: phenotips/phenotips

private boolean isGuestOwner(String owner, User user)
{
return StringUtils.isEmpty(owner) && (user == null || user.getProfileDocument() == null);
}
}

代码示例来源:origin: phenotips/phenotips

private void populateUserInfo(ContactInfo.Builder contactInfo, User user)
{
String email = (String) user.getAttribute(ATTRIBUTE_EMAIL_USER);
String institution = (String) user.getAttribute(ATTRIBUTE_INSTITUTION);
contactInfo.withUserId(user.getId());
contactInfo.withName(user.getName());
contactInfo.withEmail(email);
contactInfo.withInstitution(institution);
}

代码示例来源:origin: phenotips/phenotips

@Override
public DocumentLock getLock(DocumentReference doc)
{
XWikiContext cOntext= this.provider.get();
XWikiDocument xdoc;
try {
xdoc = context.getWiki().getDocument(doc, context);
if (xdoc == null) {
return null;
}
XWikiLock xlock = xdoc.getLock(context);
User user = this.userManager.getUser(xlock.getUserName());
if (xlock != null && !user.getId().equals(this.userManager.getCurrentUser().getId())) {
Set actiOns= Collections.singleton("edit");
return new DocumentLock(user, xlock.getDate(),
this.tm.translate("locks.documentInUse", user.getName()), actions, true);
}
} catch (XWikiException e) {
this.logger.error("Failed to access the document lock: {}", e.getMessage(), e);
}
return null;
}
}

代码示例来源:origin: phenotips/phenotips

private void runUsersQuery(JSONArray resultArray, String queryString, String formattedInput, int maxResults)
throws Exception
{
List queryResult = runQuery(queryString, formattedInput, maxResults);
for (String userName : queryResult)
{
User user = this.userManager.getUser(userName);
List attachmentRefs =
this.bridge.getAttachmentReferences((DocumentReference) user.getProfileDocument());
String avatarURL = "";
if (attachmentRefs.size() > 0) {
avatarURL = this.bridge.getAttachmentURL(attachmentRefs.get(0), true);
} else {
XWikiContext xcOntext= this.xcontextProvider.get();
XWiki xwiki = xcontext.getWiki();
avatarURL = xwiki.getSkinFile("icons/xwiki/noavatar.png", xcontext);
}
String name = user.getName();
if (StringUtils.isBlank(name)) {
name = user.getUsername();
}
JSONObject o = createObject(user.getUsername(), name, avatarURL, name, userName);
resultArray.put(o);
if (resultArray.length() == maxResults) {
break;
}
}
}

代码示例来源:origin: org.phenotips/family-studies-api

private synchronized XWikiDocument createFamilyDocument(User creator)
throws IllegalArgumentException, QueryException, XWikiException
{
XWikiContext cOntext= this.provider.get();
XWiki wiki = context.getWiki();
long nextId = getLastUsedId();
DocumentReference newFamilyRef;
do {
newFamilyRef = this.entityReferenceResolver.resolve(new EntityReference(
String.format("%s%07d", PREFIX, ++nextId), EntityType.DOCUMENT, Family.DATA_SPACE));
} while (wiki.exists(newFamilyRef, context));
XWikiDocument newFamilyDoc = wiki.getDocument(newFamilyRef, context);
// Copying all objects from template to family
newFamilyDoc.readFromTemplate(
this.entityReferenceResolver.resolve(FAMILY_TEMPLATE), context);
// Adding additional values to family
BaseObject ownerObject = newFamilyDoc.newXObject(Owner.CLASS_REFERENCE, context);
ownerObject.set("owner", creator == null ? "" : creator.getId(), context);
BaseObject familyObject = newFamilyDoc.getXObject(Family.CLASS_REFERENCE);
familyObject.set("identifier", nextId, context);
if (creator != null) {
DocumentReference creatorRef = creator.getProfileDocument();
newFamilyDoc.setCreatorReference(creatorRef);
newFamilyDoc.setAuthorReference(creatorRef);
newFamilyDoc.setContentAuthorReference(creatorRef);
}
this.updateFamilyPermissions(new PhenotipsFamily(newFamilyDoc), context, false);
wiki.saveDocument(newFamilyDoc, context);
return newFamilyDoc;
}

代码示例来源:origin: org.phenotips/patient-contacts

@Override
public List getContacts(Patient patient)
{
DocumentReference reporter = patient.getReporter();
if (reporter == null) {
return Collections.emptyList();
}
List list = new ArrayList<>();
ContactInfo.Builder cOntactInfo= new ContactInfo.Builder();
contactInfo.withUserId(this.serializer.serialize(reporter));
User user = this.userManager.getUser(reporter.toString());
if (user != null) {
String email = (String) user.getAttribute("email");
String institution = (String) user.getAttribute("company");
contactInfo.withName(user.getName());
contactInfo.withEmail(email);
contactInfo.withInstitution(institution);
// FIXME URL is missing
}
// Otherwise, if null user -> user is no longer valid, all we know is the username, already added before the if
list.add(contactInfo.build());
return list;
}
}

代码示例来源:origin: phenotips/phenotips

/**
* {@inheritDoc}
*
* @see Comparable#compareTo(Object)
*/
@Override
public int compareTo(User user)
{
return getName().compareTo(user.getName());
}
}

代码示例来源:origin: phenotips/phenotips

@Override
public Serializable disassemble(Object value) throws HibernateException
{
return ((User) value).getId();
}

代码示例来源:origin: org.phenotips/patient-data-default-impl

@Override
public DocumentLock getLock(DocumentReference doc)
{
XWikiContext cOntext= this.provider.get();
XWikiDocument xdoc;
try {
xdoc = context.getWiki().getDocument(doc, context);
if (xdoc == null) {
return null;
}
String documentId = xdoc.getDocumentReference().getName();
Patient patient = this.patientRepository.getPatientById(documentId);
if (patient == null) {
return null;
}
XWikiLock xlock = xdoc.getLock(context);
User user = this.userManager.getUser(xlock.getUserName());
if (xlock != null && !user.getId().equals(this.userManager.getCurrentUser().getId())) {
Set actiOns= Collections.singleton("edit");
return new DocumentLock(user, xlock.getDate(), this.tm.translate("patient.locks.patientInUse",
user.getName()), actions, false);
}
} catch (XWikiException e) {
this.logger.error("Failed to access the document lock: {}", e.getMessage(), e);
}
return null;
}
}

代码示例来源:origin: phenotips/phenotips

@Override
public List getContacts(Patient patient)
{
DocumentReference reporter = patient.getReporter();
if (reporter == null) {
return Collections.emptyList();
}
List list = new ArrayList<>();
ContactInfo.Builder cOntactInfo= new ContactInfo.Builder();
contactInfo.withUserId(this.serializer.serialize(reporter));
User user = this.userManager.getUser(reporter.toString());
if (user != null) {
String email = (String) user.getAttribute("email");
String institution = (String) user.getAttribute("company");
contactInfo.withName(user.getName());
contactInfo.withEmail(email);
contactInfo.withInstitution(institution);
// FIXME URL is missing
}
// Otherwise, if null user -> user is no longer valid, all we know is the username, already added before the if
list.add(contactInfo.build());
return list;
}
}

代码示例来源:origin: org.phenotips/family-studies-api

User user = this.userManager.getUser(xlock.getUserName());
return new DocumentLock(user, xlock.getDate(),
this.tm.translate("family.locks.patientFamilyInUse", user.getName()), actions, false);

代码示例来源:origin: phenotips/phenotips

@Override
public String toString()
{
return (this.user == null ? null : this.user.getId()) + " (" + this.ip + "): "
+ this.action + " on " + this.entity + " at "
+ (this.time == null ? null : this.time.getTime());
}

代码示例来源:origin: phenotips/phenotips

@Override
public Boolean hasAccess(User user, Right access, EntityReference entity)
{
return this.authorizationManager.hasAccess(access, user == null ? null : user.getProfileDocument(), entity);
}
}

代码示例来源:origin: org.phenotips/family-studies-api

@Override
public DocumentLock getLock(DocumentReference doc)
{
XWikiContext cOntext= this.provider.get();
XWikiDocument xdoc;
try {
xdoc = context.getWiki().getDocument(doc, context);
if (xdoc == null) {
return null;
}
String documentId = xdoc.getDocumentReference().getName();
Family family = this.familyRepository.getFamilyById(documentId);
if (family == null) {
return null;
}
XWikiLock xlock = xdoc.getLock(context);
User user = this.userManager.getUser(xlock.getUserName());
if (xlock != null && !user.getId().equals(this.userManager.getCurrentUser().getId())) {
Set actiOns= Collections.singleton("edit");
return new DocumentLock(user, xlock.getDate(), this.tm.translate("family.locks.familyInUse",
user.getName()), actions, false);
}
} catch (XWikiException e) {
this.logger.error("Failed to access the document lock: {}", e.getMessage(), e);
}
return null;
}
}

代码示例来源:origin: org.phenotips/patient-access-rules-api

private void populateUserInfo(ContactInfo.Builder contactInfo, User user)
{
String email = (String) user.getAttribute(ATTRIBUTE_EMAIL_USER);
String institution = (String) user.getAttribute(ATTRIBUTE_INSTITUTION);
contactInfo.withUserId(user.getId());
contactInfo.withName(user.getName());
contactInfo.withEmail(email);
contactInfo.withInstitution(institution);
}

代码示例来源:origin: phenotips/phenotips

User user = this.userManager.getUser(xlock.getUserName());
return new DocumentLock(user, xlock.getDate(),
this.tm.translate("family.locks.patientFamilyInUse", user.getName()), actions, false);

代码示例来源:origin: phenotips/phenotips

@Override
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException
{
if (User.class.isInstance(value)) {
st.setString(index, ((User) value).getId());
} else {
st.setNull(index, Types.VARCHAR);
}
}

代码示例来源:origin: org.phenotips/phenotips-authorization

@Override
public Boolean hasAccess(User user, Right access, EntityReference entity)
{
return this.authorizationManager.hasAccess(access, user == null ? null : user.getProfileDocument(), entity);
}
}

代码示例来源:origin: phenotips/phenotips

@Override
public DocumentLock getLock(DocumentReference doc)
{
XWikiContext cOntext= this.provider.get();
XWikiDocument xdoc;
try {
xdoc = context.getWiki().getDocument(doc, context);
if (xdoc == null) {
return null;
}
String documentId = xdoc.getDocumentReference().getName();
Patient patient = this.patientRepository.getPatientById(documentId);
if (patient == null) {
return null;
}
XWikiLock xlock = xdoc.getLock(context);
User user = this.userManager.getUser(xlock.getUserName());
if (xlock != null && !user.getId().equals(this.userManager.getCurrentUser().getId())) {
Set actiOns= Collections.singleton("edit");
return new DocumentLock(user, xlock.getDate(), this.tm.translate("patient.locks.patientInUse",
user.getName()), actions, false);
}
} catch (XWikiException e) {
this.logger.error("Failed to access the document lock: {}", e.getMessage(), e);
}
return null;
}
}

代码示例来源:origin: phenotips/phenotips

/**
* Returns the JSON representation of the audit event.
*
* @return a JSON object.
*/
public JSONObject toJSON()
{
JSONObject event = new JSONObject();
event.put("user", this.user == null ? null : this.user.getId());
event.put("ip", this.ip);
event.put("action", this.action);
event.put("extra", this.extra);
event.put("entity", this.entity == null ? null : this.entity.toString());
event.put("time", this.time == null ? null : this.time.toInstant().toString());
return event;
}
}

推荐阅读
  • 本文整理了Java中java.lang.NoSuchMethodError.getMessage()方法的一些代码示例,展示了NoSuchMethodErr ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • 在Android开发中,使用Picasso库可以实现对网络图片的等比例缩放。本文介绍了使用Picasso库进行图片缩放的方法,并提供了具体的代码实现。通过获取图片的宽高,计算目标宽度和高度,并创建新图实现等比例缩放。 ... [详细]
  • VScode格式化文档换行或不换行的设置方法
    本文介绍了在VScode中设置格式化文档换行或不换行的方法,包括使用插件和修改settings.json文件的内容。详细步骤为:找到settings.json文件,将其中的代码替换为指定的代码。 ... [详细]
  • 本文分享了一个关于在C#中使用异步代码的问题,作者在控制台中运行时代码正常工作,但在Windows窗体中却无法正常工作。作者尝试搜索局域网上的主机,但在窗体中计数器没有减少。文章提供了相关的代码和解决思路。 ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • 标题: ... [详细]
  • Python爬虫中使用正则表达式的方法和注意事项
    本文介绍了在Python爬虫中使用正则表达式的方法和注意事项。首先解释了爬虫的四个主要步骤,并强调了正则表达式在数据处理中的重要性。然后详细介绍了正则表达式的概念和用法,包括检索、替换和过滤文本的功能。同时提到了re模块是Python内置的用于处理正则表达式的模块,并给出了使用正则表达式时需要注意的特殊字符转义和原始字符串的用法。通过本文的学习,读者可以掌握在Python爬虫中使用正则表达式的技巧和方法。 ... [详细]
  • 重入锁(ReentrantLock)学习及实现原理
    本文介绍了重入锁(ReentrantLock)的学习及实现原理。在学习synchronized的基础上,重入锁提供了更多的灵活性和功能。文章详细介绍了重入锁的特性、使用方法和实现原理,并提供了类图和测试代码供读者参考。重入锁支持重入和公平与非公平两种实现方式,通过对比和分析,读者可以更好地理解和应用重入锁。 ... [详细]
  • 使用在线工具jsonschema2pojo根据json生成java对象
    本文介绍了使用在线工具jsonschema2pojo根据json生成java对象的方法。通过该工具,用户只需将json字符串复制到输入框中,即可自动将其转换成java对象。该工具还能解析列表式的json数据,并将嵌套在内层的对象也解析出来。本文以请求github的api为例,展示了使用该工具的步骤和效果。 ... [详细]
  • sklearn数据集库中的常用数据集类型介绍
    本文介绍了sklearn数据集库中常用的数据集类型,包括玩具数据集和样本生成器。其中详细介绍了波士顿房价数据集,包含了波士顿506处房屋的13种不同特征以及房屋价格,适用于回归任务。 ... [详细]
  • 本文介绍了在MFC下利用C++和MFC的特性动态创建窗口的方法,包括继承现有的MFC类并加以改造、插入工具栏和状态栏对象的声明等。同时还提到了窗口销毁的处理方法。本文详细介绍了实现方法并给出了相关注意事项。 ... [详细]
author-avatar
开心123
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有