When users are added to the XWikiAllGroup, the class which is created is called
Main.WebHome instead of XWiki.XWikiGroupClass
testwiki=> select baseobject0_.XWO_CLASSNAME, stringprop1_.XWS_VALUE as
col_0_0_ from xwikiobjects baseobject0_, xwikistrings stringprop1_ inner join
xwikiproperties stringprop1_1_ on stringprop1_.XWS_ID=stringprop1_1_.XWP_ID and
stringprop1_.XWS_NAME=stringprop1_1_.XWP_NAME where
baseobject0_.XWO_NAME='XWiki.XWikiAllGroup' and
baseobject0_.XWO_ID=stringprop1_.XWS_ID and (trim(both from
stringprop1_.XWS_VALUE)<>'' or (trim(both from stringprop1_.XWS_VALUE) is not
null) and ('' is null));
xwo_classname | col_0_0_
-------------------+-----------------
XWiki.XWikiGroups | XWiki.Admin
Main.WebHome | XWiki.JohnSmith
Main.WebHome | XWiki.meme
(3 rows)
That is why the createAndDeleteUser test is failing
http://hudson.xwiki.org/job/xwiki-product-enterprise-tests/com.xpn.xwiki.products$xwiki-enterprise-test-selenium/428/testReport/com.xpn.xwiki.it.selenium/UsersGroupsRightsManagementTest/testCreateAndDeleteUser/?
Caleb
vmassol (SVN) wrote:
> Author: vmassol
> Date: 2010-01-21 09:25:54 +0100 (Thu, 21 Jan 2010)
> New Revision: 26271
>
> Modified:
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
>
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/BaseObject.java
>
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/classes/BaseClass.java
>
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
> Log:
> XWIKI-4753: Refactor old model to use the new Entity Reference classes
>
> * More deprecation removal + added @deprecated annotations for
> BaseClass/BaseObject's get/SetName() to find places where they shouldn't be
> used
>
> Modified:
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
> ===================================================================
> --- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
> 2010-01-21 08:20:26 UTC (rev 26270)
> +++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
> 2010-01-21 08:25:54 UTC (rev 26271)
> @@ -3796,10 +3796,10 @@
> XWikiDocument groupDoc = getDocument(groupName, context);
>
> BaseObject memberObject = (BaseObject) groupClass.newObject(context);
> - memberObject.setClassName(groupClass.getName());
> - memberObject.setName(groupDoc.getFullName());
> + memberObject.setXClassReference(groupClass.getXClassReference());
> + memberObject.setDocumentReference(groupDoc.getDocumentReference());
> memberObject.setStringValue("member", userName);
> - groupDoc.addObject(groupClass.getName(), memberObject);
> + groupDoc.addXObject(groupClass.getDocumentReference(), memberObject);
> if (groupDoc.isNew()) {
> saveDocument(groupDoc,
> context.getMessageTool().get("core.comment.addedUserToGroup"), context);
> } else {
>
> Modified:
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/BaseObject.java
> ===================================================================
> ---
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/BaseObject.java
> 2010-01-21 08:20:26 UTC (rev 26270)
> +++
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/BaseObject.java
> 2010-01-21 08:25:54 UTC (rev 26271)
> @@ -42,6 +42,26 @@
> private String guid = UUID.randomUUID().toString();
>
> /**
> + * Note: This method is overridden to add the deprecation warning so
> that code using is can see it's deprecated.
> + * @deprecated since 2.2M2 use {...@link #getDocumentReference()}
> + */
> + @Deprecated
> + @Override public String getName()
> + {
> + return super.getName();
> + }
> +
> + /**
> + * Note: This method is overridden to add the deprecation warning so
> that code using is can see it's deprecated.
> + * @deprecated since 2.2M2 use {...@link
> #setDocumentReference(org.xwiki.model.reference.DocumentReference)}
> + */
> + @Deprecated
> + @Override public void setName(String name)
> + {
> + super.setName(name);
> + }
> +
> + /**
> * {...@inheritdoc}
> *
> * @see com.xpn.xwiki.objects.BaseCollection#hashCode()
>
> Modified:
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/classes/BaseClass.java
> ===================================================================
> ---
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/classes/BaseClass.java
> 2010-01-21 08:20:26 UTC (rev 26270)
> +++
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/objects/classes/BaseClass.java
> 2010-01-21 08:25:54 UTC (rev 26271)
> @@ -76,6 +76,26 @@
> private String nameField;
>
> /**
> + * Note: This method is overridden to add the deprecation warning so
> that code using is can see it's deprecated.
> + * @deprecated since 2.2M2 use {...@link #getDocumentReference()}
> + */
> + @Deprecated
> + @Override public String getName()
> + {
> + return super.getName();
> + }
> +
> + /**
> + * Note: This method is overridden to add the deprecation warning so
> that code using is can see it's deprecated.
> + * @deprecated since 2.2M2 use {...@link
> #setDocumentReference(org.xwiki.model.reference.DocumentReference)}
> + */
> + @Deprecated
> + @Override public void setName(String name)
> + {
> + super.setName(name);
> + }
> +
> + /**
> * {...@inheritdoc}
> * <p>
> * This insures natural ordering between properties.
>
> Modified:
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
> ===================================================================
> ---
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
> 2010-01-21 08:20:26 UTC (rev 26270)
> +++
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
> 2010-01-21 08:25:54 UTC (rev 26271)
> @@ -491,8 +491,8 @@
> }
>
> // Verify if the document already exists
> - Query query =
> - session.createQuery("select xwikidoc.id from XWikiDocument
> as xwikidoc where xwikidoc.id = :id");
> + Query query = session.createQuery(
> + "select xwikidoc.id from XWikiDocument as xwikidoc where
> xwikidoc.id = :id");
> query.setLong("id", doc.getId());
> if (query.uniqueResult() == null) {
> session.save(doc);
> @@ -503,16 +503,16 @@
> }
>
> // Remove objects planned for removal
> - if (doc.getObjectsToRemove().size() > 0) {
> - for (BaseObject removedObject : doc.getObjectsToRemove()) {
> + if (doc.getXObjectsToRemove().size() > 0) {
> + for (BaseObject removedObject : doc.getXObjectsToRemove()) {
> deleteXWikiObject(removedObject, context, false);
> }
> - doc.setObjectsToRemove(new ArrayList<BaseObject>());
> + doc.setXObjectsToRemove(new ArrayList<BaseObject>());
> }
>
> // We should only save the class if we are using the class table
> mode
> if (bclass != null) {
> - bclass.setName(doc.getFullName());
> + bclass.setDocumentReference(doc.getDocumentReference());
> if ((bclass.getFieldList().size() > 0) &&
> (useClassesTable(true, context))) {
> saveXWikiClass(bclass, context, false);
> }
> @@ -525,18 +525,14 @@
> // migrate values of list properties
> if (prop instanceof StaticListClass || prop instanceof
> DBListClass) {
> ListClass lc = (ListClass) prop;
> - String[] classes =
> - {DBStringListProperty.class.getName(),
> StringListProperty.class.getName(),
> - StringProperty.class.getName()}; // @see
> - // ListClass#newProperty()
> + String[] classes = {
> DBStringListProperty.class.getName(), StringListProperty.class.getName(),
> + StringProperty.class.getName()}; // @see
> ListClass#newProperty()
> for (int i = 0; i < classes.length; i++) {
> String oldclass = classes[i];
> if
> (!oldclass.equals(lc.newProperty().getClass().getName())) {
> - Query q =
> - session.createQuery(
> - "select p from " + oldclass + " as
> p, BaseObject as o" + " where o.className=?"
> - + " and p.id=o.id and
> p.name=?").setString(0, bclass.getName()).setString(
> - 1, lc.getName());
> + Query q = session.createQuery("select p from
> " + oldclass + " as p, BaseObject as o"
> + + " where o.className=? and p.id=o.id
> and p.name=?").setString(0,
> + bclass.getName()).setString(1,
> lc.getName());
> for (Iterator it = q.list().iterator();
> it.hasNext();) {
> BaseProperty lp = (BaseProperty)
> it.next();
> BaseProperty lp1 = lc.newProperty();
> @@ -609,7 +605,7 @@
> for (List<BaseObject> objects : doc.getXObjects().values()) {
> for (BaseObject obj : objects) {
> if (obj != null) {
> - obj.setName(doc.getFullName());
> +
> obj.setDocumentReference(doc.getDocumentReference());
> /* If the object doesn't have a GUID, create it
> before saving */
> if (StringUtils.isEmpty(obj.getGuid())) {
> obj.setGuid(UUID.randomUUID().toString());
>
> _______________________________________________
> notifications mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/notifications
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs