Skip to content
Snippets Groups Projects
Commit 0ac316a5 authored by Guillaume Delhumeau's avatar Guillaume Delhumeau
Browse files

[Misc] Fix deprecated call.

parent c7e2b620
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,8 @@
import org.xwiki.bridge.event.WikiReadyEvent;
import org.xwiki.component.annotation.Component;
import org.xwiki.context.Execution;
import org.xwiki.model.EntityType;
import org.xwiki.model.reference.EntityReference;
import org.xwiki.model.reference.EntityReferenceSerializer;
import org.xwiki.observation.EventListener;
import org.xwiki.observation.event.Event;
......@@ -105,10 +107,10 @@ public void onEvent(Event arg0, Object arg1, Object arg2)
private void installOrUpdateComponentInterfaceXClass() throws XWikiException
{
XWikiContext xcontext = getXWikiContext();
XWikiDocument doc = xcontext.getWiki().getDocument(INTERFACE_CLASS, xcontext);
XWikiDocument doc = xcontext.getWiki().getDocument(INTERFACE_CLASS_REFERENCE, xcontext);
BaseClass bclass = doc.getXClass();
bclass.setName(INTERFACE_CLASS);
bclass.setDocumentReference(doc.getDocumentReference());
boolean needsUpdate = false;
......@@ -128,10 +130,10 @@ private void installOrUpdateComponentInterfaceXClass() throws XWikiException
private void installOrUpdateComponentXClass() throws XWikiException
{
XWikiContext xcontext = getXWikiContext();
XWikiDocument doc = xcontext.getWiki().getDocument(COMPONENT_CLASS, xcontext);
XWikiDocument doc = xcontext.getWiki().getDocument(COMPONENT_CLASS_REFERENCE, xcontext);
BaseClass bclass = doc.getXClass();
bclass.setName(COMPONENT_CLASS);
bclass.setDocumentReference(doc.getDocumentReference());
boolean needsUpdate = false;
......@@ -154,10 +156,10 @@ private void installOrUpdateComponentXClass() throws XWikiException
private void installOrUpdateComponentRequirementXClass() throws XWikiException
{
XWikiContext xcontext = getXWikiContext();
XWikiDocument doc = xcontext.getWiki().getDocument(DEPENDENCY_CLASS, xcontext);
XWikiDocument doc = xcontext.getWiki().getDocument(DEPENDENCY_CLASS_REFERENCE, xcontext);
BaseClass bclass = doc.getXClass();
bclass.setName(DEPENDENCY_CLASS);
bclass.setDocumentReference(doc.getDocumentReference());
boolean needsUpdate = false;
......@@ -179,10 +181,10 @@ private void installOrUpdateComponentRequirementXClass() throws XWikiException
private void installOrUpdateComponentMethodXClass() throws XWikiException
{
XWikiContext xcontext = getXWikiContext();
XWikiDocument doc = xcontext.getWiki().getDocument(METHOD_CLASS, xcontext);
XWikiDocument doc = xcontext.getWiki().getDocument(METHOD_CLASS_REFRENCE, xcontext);
BaseClass bclass = doc.getXClass();
bclass.setName(METHOD_CLASS);
bclass.setDocumentReference(doc.getDocumentReference());
boolean needsUpdate = false;
......@@ -219,17 +221,18 @@ private boolean initializeXClassDocumentMetadata(XWikiDocument doc, String title
{
boolean needsUpdate = false;
if (StringUtils.isBlank(doc.getCreator())) {
if (doc.getCreatorReference() == null) {
needsUpdate = true;
doc.setCreator(CLASS_AUTHOR);
}
if (StringUtils.isBlank(doc.getAuthor())) {
if (doc.getAuthorReference() == null) {
needsUpdate = true;
doc.setAuthor(doc.getCreator());
doc.setAuthorReference(doc.getCreatorReference());
}
if (StringUtils.isBlank(doc.getParent())) {
if (doc.getParentReference() == null) {
needsUpdate = true;
doc.setParent("XWiki.XWikiClasses");
doc.setParentReference(new EntityReference("XWikiClasses", EntityType.DOCUMENT)
.appendParent(new EntityReference("XWiki", EntityType.SPACE)));
}
if (StringUtils.isBlank(doc.getTitle())) {
needsUpdate = true;
......
......@@ -19,6 +19,9 @@
*/
package org.xwiki.component.wiki.internal;
import org.xwiki.model.EntityType;
import org.xwiki.model.reference.EntityReference;
import com.xpn.xwiki.user.api.XWikiRightService;
/**
......@@ -34,26 +37,59 @@ public interface WikiComponentConstants
*/
String CLASS_AUTHOR = XWikiRightService.SUPERADMIN_USER;
/**
* Space of the XClass documents.
*/
EntityReference CLASS_SPACE_REFERENCE = new EntityReference("XWiki", EntityType.SPACE);
/**
* The XClass defining a component implementation.
*/
@Deprecated
String COMPONENT_CLASS = "XWiki.ComponentClass";
/**
* The XClass defining a component implementation.
*/
EntityReference COMPONENT_CLASS_REFERENCE = new EntityReference("ComponentClass", EntityType.DOCUMENT)
.appendParent(CLASS_SPACE_REFERENCE);
/**
* The XClass defining a component injection.
*/
@Deprecated
String DEPENDENCY_CLASS = "XWiki.ComponentDependencyClass";
/**
* The XClass defining a component injection.
*/
EntityReference DEPENDENCY_CLASS_REFERENCE = new EntityReference("ComponentDependencyClass", EntityType.DOCUMENT)
.appendParent(CLASS_SPACE_REFERENCE);
/**
* The XClass defining a component method.
*/
@Deprecated
String METHOD_CLASS = "XWiki.ComponentMethodClass";
/**
* The XClass defining a component method.
*/
EntityReference METHOD_CLASS_REFRENCE = new EntityReference("ComponentMethodClass", EntityType.DOCUMENT)
.appendParent(CLASS_SPACE_REFERENCE);
/**
* The XClass defining a component interface implementation.
*/
@Deprecated
String INTERFACE_CLASS = "XWiki.ComponentInterfaceClass";
/**
* The XClass defining a component interface implementation.
*/
EntityReference INTERFACE_CLASS_REFERENCE = new EntityReference("ComponentInterfaceClass", EntityType.DOCUMENT)
.appendParent(CLASS_SPACE_REFERENCE);
/**
* The name property of the {@link #INTERFACE_CLASS} XClass.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment