本文整理了Java中org.xwiki.rendering.listener.reference.ResourceReference.setReference
方法的一些代码示例,展示了ResourceReference.setReference
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceReference.setReference
方法的具体详情如下:
包路径:org.xwiki.rendering.listener.reference.ResourceReference
类名称:ResourceReference
方法名:setReference
暂无
代码示例来源:origin: org.xwiki.platform/xwiki-core-rendering-api
/**
* @param reference see {@link #getReference()}
* @param type see {@link #getType()}
*/
public ResourceReference(String reference, ResourceType type)
{
setReference(reference);
setType(type);
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-refactoring-api
/**
* @param document the document whose anchors to update
* @param fragments see {@link #collectDocumentFragments(List)}
*/
private void updateAnchors(WikiDocument document, Map<String, String> fragments)
{
for (LinkBlock linkBlock : document.getXdom().<LinkBlock> getBlocks(new ClassBlockMatcher(LinkBlock.class),
Axes.DESCENDANT)) {
ResourceReference reference = linkBlock.getReference();
ResourceType resoureceType = reference.getType();
String fragment = null;
if (isDocument(resoureceType) && StringUtils.isEmpty(reference.getReference())) {
fragment = reference.getParameter(ANCHOR_PARAMETER);
} else if (StringUtils.startsWith(reference.getReference(), "#")
&& (ResourceType.PATH.equals(resoureceType) || ResourceType.URL.equals(resoureceType))) {
fragment = reference.getReference().substring(1);
}
String targetDocument = fragments.get(fragment);
if (targetDocument != null && !targetDocument.equals(document.getFullName())) {
// The fragment has been moved so we need to update the link.
reference.setType(ResourceType.DOCUMENT);
reference.setReference(targetDocument);
reference.setParameter(ANCHOR_PARAMETER, fragment);
}
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* @since 2.2M1
*/
private void refactorDocumentLinks(DocumentReference oldDocumentReference, DocumentReference newDocumentReference,
XWikiContext context) throws XWikiException
{
XDOM xdom = getXDOM();
List<LinkBlock> linkBlockList = xdom.getChildrenByType(LinkBlock.class, true);
for (LinkBlock linkBlock : linkBlockList) {
ResourceReference linkReference = linkBlock.getReference();
if (linkReference.getType().equals(ResourceType.DOCUMENT)) {
DocumentReference documentReference = this.explicitDocumentReferenceResolver.resolve(
linkReference.getReference(), getDocumentReference());
if (documentReference.equals(oldDocumentReference)) {
linkReference.setReference(this.compactEntityReferenceSerializer.serialize(newDocumentReference,
getDocumentReference()));
}
}
}
setContent(xdom);
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
linkReference.setReference(this.compactWikiEntityReferenceSerializer.serialize(
currentLinkReference, newDocument.getDocumentReference()));
内容来源于网络,如有侵权,请联系作者删除!