本文整理了Java中com.xpn.xwiki.api.Document.getFullName()
方法的一些代码示例,展示了Document.getFullName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.getFullName()
方法的具体详情如下:
包路径:com.xpn.xwiki.api.Document
类名称:Document
方法名:getFullName
[英]Get the fullName of the document. If a document is named "MyDoc" in space "MySpace", the fullname is "MySpace.MyDoc". In a wiki, all the documents have a different fullName.
[中]获取文档的全名。如果文档在“MySpace”空间中命名为“MyDoc”,则全名为“MySpace.MyDoc”。在wiki中,所有文档都有不同的全名。
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public String getPageName()
{
return doc.getFullName();
}
代码示例来源:origin: com.avane.xwiki.products/xwiki-plugin-chronopolys
public String getFullName()
{
return doc.getFullName();
}
代码示例来源:origin: com.avane.xwiki.products/xwiki-plugin-chronopolys
public String getURL(XWikiContext context) throws XWikiException
{
return context.getWiki().getExternalURL(doc.getFullName(), "view", context);
}
代码示例来源:origin: com.avane.xwiki.products/xwiki-plugin-chronopolys
public XWikiDocument getProjectHomeDoc(XWikiContext context) throws XWikiException
{
return context.getWiki().getDocument(doc.getFullName(), context);
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public void saveWithProgrammingRights(String comment, boolean minorEdit) throws XWikiException
{
if (hasProgrammingRights()) {
saveDocument(comment, minorEdit);
} else {
java.lang.Object[] args = {this.getFullName()};
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED,
"Access denied with no programming rights document {0}", null, args);
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public void deleteWithProgrammingRights() throws XWikiException
{
if (hasProgrammingRights()) {
deleteDocument();
} else {
java.lang.Object[] args = {this.getFullName()};
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED,
"Access denied with no programming rights document {0}", null, args);
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public void delete() throws XWikiException
{
if (hasAccessLevel("delete")) {
deleteDocument();
} else {
java.lang.Object[] args = {this.getFullName()};
throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED,
"Access denied in edit mode on document {0}", null, args);
}
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-application-manager-api
@Override
public boolean isInstance(Document doc)
{
return doc.getObjectNumbers(getClassFullName()) > 0
&& (!forceValidDocumentName() || isValidName(doc.getFullName()));
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Get statistics about the number of request for the current page during the current month.
*
* @param action the type of request for which to retrieve statistics: view, edit...
* @return the statistics object holding information for this document and the current month
*/
public DocumentStats getCurrentMonthPageStats(String action)
{
Scope scope = ScopeFactory.createPageScope(this.getFullName());
Range range = RangeFactory.ALL;
Period period = PeriodFactory.getCurrentMonth();
XWikiStatsService statisticsService = getXWikiContext().getWiki().getStatsService(getXWikiContext());
List<DocumentStats> stats = statisticsService.getDocumentStatistics(action, scope, period, range, this.context);
if (stats.size() > 0) {
return stats.get(0);
}
return new DocumentStats();
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
/**
* <p>
* Get the page full name given its components.
* </p>
*
* @param wikiName
* @param spaceName
* @param pageName
* @return The page full name.
*/
public static String getPageFullName(String wikiName, String spaceName, String pageName)
{
XWikiDocument xwikiDocument = new XWikiDocument();
xwikiDocument.setDatabase(wikiName);
xwikiDocument.setName(pageName);
xwikiDocument.setSpace(spaceName);
Document document = new Document(xwikiDocument, null);
return document.getFullName();
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Get referer statistics for the current document during the current month.
*
* @return a list of referer statistics for the document's space
*/
public List<RefererStats> getCurrentMonthRefStats()
{
Scope scope = ScopeFactory.createPageScope(this.getFullName());
Range range = RangeFactory.ALL;
Period period = PeriodFactory.getCurrentMonth();
XWikiStatsService statisticsService = getXWikiContext().getWiki().getStatsService(getXWikiContext());
List<RefererStats> stats = statisticsService.getRefererStatistics("", scope, period, range, this.context);
return stats;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Create a space from its WebHome document.
*
* @return A Space object containing all the information about the space.
*/
public static Space createSpace(Document spaceWebHome)
{
Space result = new Space();
result.setKey(spaceWebHome.getSpace());
result.setName(spaceWebHome.getTitle());
result.setDescription("No description available");
result.setHomepage(spaceWebHome.getFullName());
result.setUrl(spaceWebHome.getExternalURL("view"));
return result;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public void reload(Document doc, XWikiContext context) throws XWikiException
{
if (doc == null)
doc = context.getWiki().getDocument(this.doc.getFullName(), context).newDocument(context);
this.doc = doc;
BaseClass dirGrpClass = getXWikiDirectoryGroupClass(context);
Object obj;
if ((obj = doc.getObject(dirGrpClass.getName())) == null) {
doc.createNewObject(dirGrpClass.getName());
obj = doc.getObject(dirGrpClass.getName());
this.isNew = true;
}
this.objDirectoryGroup = obj;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Retrieves the value of a string property.
*/
protected String getStringValue(String mapping, Document doc, XWikiContext context) throws XWikiException
{
PropertySelector ps = new PropertySelector(mapping);
if (ps.getClassName() == null) {
return doc.display(ps.getPropertyName());
} else {
XWikiDocument xdoc = context.getWiki().getDocument(doc.getFullName(), context);
return xdoc.getObject(ps.getClassName(), ps.getObjectIndex()).getStringValue(ps.getPropertyName());
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Create a page summary description from an XWiki document.
*
* @return An XWikiPageSummary with the information.
* @throws XWikiException If there is a problem getting page translations.
*/
public static XWikiPageSummary createXWikiPageSummary(Document document) throws XWikiException
{
XWikiPageSummary result = new XWikiPageSummary();
String pageTitle = document.getTitle();
if (pageTitle.equals("")) {
pageTitle = document.getName();
}
result.setId(document.getFullName());
result.setSpace(document.getSpace());
result.setParentId(document.getParent());
result.setTitle(pageTitle);
result.setUrl(document.getExternalURL("view"));
result.setTranslations(document.getTranslationList());
return result;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Create a summary of a given xwiki object.
*
* @return An XWikiObjectSummary object containing all the information.
*/
public static XWikiObjectSummary createXWikiObjectSummary(Document document, com.xpn.xwiki.api.Object object)
{
String prettyName = object.getPrettyName();
if (prettyName == null || prettyName.equals("")) {
prettyName = String.format("%s[%d]", object.getxWikiClass().getName(), object.getNumber());
}
XWikiObjectSummary result = new XWikiObjectSummary();
result.setPageId(document.getFullName());
result.setPageVersion(document.getRCSVersion().at(0));
result.setPageMinorVersion(document.getRCSVersion().at(1));
result.setClassName(object.getxWikiClass().getName());
result.setId(object.getNumber());
result.setGuid(object.getGuid());
result.setPrettyName(prettyName);
return result;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Retrieves the value of a date property.
*/
protected Date getDateValue(String mapping, Document doc, XWikiContext context) throws XWikiException
{
XWikiDocument xdoc = context.getWiki().getDocument(doc.getFullName(), context);
PropertySelector ps = new PropertySelector(mapping);
if (ps.getClassName() == null) {
return xdoc.getFirstObject(ps.getPropertyName(), context).getDateValue(ps.getPropertyName());
} else {
return xdoc.getObject(ps.getClassName(), ps.getObjectIndex()).getDateValue(ps.getPropertyName());
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Retrieves the value of a list property.
*/
protected List<Object> getListValue(String mapping, Document doc, XWikiContext context) throws XWikiException
{
XWikiDocument xdoc = context.getWiki().getDocument(doc.getFullName(), context);
PropertySelector ps = new PropertySelector(mapping);
if (ps.getClassName() == null) {
return xdoc.getFirstObject(ps.getPropertyName(), context).getListValue(ps.getPropertyName());
} else {
return xdoc.getObject(ps.getClassName(), ps.getObjectIndex()).getListValue(ps.getPropertyName());
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Create a page history summary containing revision information about a document.
*
* @return An XWikiPageHistorySummary object containing the revision information.
*/
public static XWikiPageHistorySummary createXWikiPageHistorySummary(Document document)
{
XWikiExtendedId extendedId = new XWikiExtendedId(document.getFullName());
extendedId.setParameter("version", Integer.toString(document.getRCSVersion().at(0)));
extendedId.setParameter("minorVersion", Integer.toString(document.getRCSVersion().at(1)));
extendedId.setParameter("language", document.getLanguage());
XWikiPageHistorySummary result = new XWikiPageHistorySummary();
result.setId(extendedId.toString());
result.setVersion(document.getRCSVersion().at(0));
result.setMinorVersion(document.getRCSVersion().at(1));
result.setModified(document.getContentUpdateDate());
result.setModifier(document.getContentAuthor());
return result;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public String inviteUser(String name, String email, XWikiContext context) throws XWikiException {
if (!isValidEmail(email))
throw new PluginException(getName(), ERROR_XWIKI_EMAIL_INVALID_EMAIL, "The email is not valid");
Document userdoc = createUserDocument(name, email, context);
userdoc.use(DEFAULT_USER_CLASS);
userdoc.set("last_name", name);
userdoc.set("email", email);
userdoc.saveWithProgrammingRights();
context.getWiki().setUserDefaultGroup(userdoc.getFullName(), context);
BaseObject userObj = userdoc.getObject(DEFAULT_USER_CLASS).getXWikiObject();
XWikiDocument doc = context.getWiki().getDocument(getInvitationMessageDocument(context), context);
String message = prepareInvitationMessage(doc, name, userObj.getStringValue("password"), email, userObj.getStringValue("validkey"), userdoc.getURL(), context);
String sender;
try {
sender = context.getWiki().getXWikiPreference("admin_email", context);
} catch (Exception e) {
throw new PluginException(getName(), ERROR_XWIKI_EMAIL_INVALID_ADMIN_EMAIL, "Exception while reading the validation email config", e, null);
}
context.getWiki().sendMessage(sender, email, message, context);
return userdoc.getFullName();
}
内容来源于网络,如有侵权,请联系作者删除!