[jira] Created: (JCR-1690) PM - Simple vs. Bundle - mixin removal handling

View: New views
2 Messages — Rating Filter:   Alert me  

[jira] Created: (JCR-1690) PM - Simple vs. Bundle - mixin removal handling

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

PM - Simple vs. Bundle - mixin removal handling
-----------------------------------------------

                 Key: JCR-1690
                 URL: https://issues.apache.org/jira/browse/JCR-1690
             Project: Jackrabbit
          Issue Type: Bug
    Affects Versions: core 1.4.5
            Reporter: Jan Haderka


Following code (assuming node had mixin mix:versionable before):
    node.removeMixin("mix:versionable");
    node.save();
leads to difference in stored data based on PM used.
If you perform the operation above and restart your repository
call to:
    node.isMixinType("mix:versionable");
will return false after restart in both cases, but
doing:
hasMixin(node, "mix:versionable");
will return true when repository is using bundled PM. The hasMixin()
method just iterates over all values of jcr:mixinTypes property:

public static void hasMixin(Node node, String mixin) {
  try {
    Value[] vals = node.getProperty("jcr:mixinTypes").getValues();
    for (int i = 0; i < vals.length; i++) {
      log.debug(vals[i].getString());
      if (mixin.equals(vals[i].getString())) {
        return true;
      }
    }
  } catch (PathNotFoundException e) {
    // property not found == can't contain anything
    return false;
  }
  return false;
}

I think the difference is caused by following code (JR 1.4.5) in
AbstractBundledPersistenceManager (which doesn't seem to have equivalent
in simple PM)

557                // skip primaryType pr mixinTypes properties
558                if (id.getName().equals(QName.JCR_PRIMARYTYPE)
559                    || id.getName().equals(QName.JCR_MIXINTYPES)
560                    || id.getName().equals(QName.JCR_UUID)) {
561                    continue;
562                }

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-1690) PM - Simple vs. Bundle - mixin removal handling

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/JCR-1690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Guggisberg resolved JCR-1690.
------------------------------------

       Resolution: Duplicate
    Fix Version/s: 1.5

resolving as duplicate of JCR-1632 which i just fixed.

> PM - Simple vs. Bundle - mixin removal handling
> -----------------------------------------------
>
>                 Key: JCR-1690
>                 URL: https://issues.apache.org/jira/browse/JCR-1690
>             Project: Jackrabbit
>          Issue Type: Bug
>    Affects Versions: core 1.4.5
>            Reporter: Jan Haderka
>             Fix For: 1.5
>
>
> Following code (assuming node had mixin mix:versionable before):
>     node.removeMixin("mix:versionable");
>     node.save();
> leads to difference in stored data based on PM used.
> If you perform the operation above and restart your repository
> call to:
>     node.isMixinType("mix:versionable");
> will return false after restart in both cases, but
> doing:
> hasMixin(node, "mix:versionable");
> will return true when repository is using bundled PM. The hasMixin()
> method just iterates over all values of jcr:mixinTypes property:
> public static void hasMixin(Node node, String mixin) {
>   try {
>     Value[] vals = node.getProperty("jcr:mixinTypes").getValues();
>     for (int i = 0; i < vals.length; i++) {
>       log.debug(vals[i].getString());
>       if (mixin.equals(vals[i].getString())) {
>         return true;
>       }
>     }
>   } catch (PathNotFoundException e) {
>     // property not found == can't contain anything
>     return false;
>   }
>   return false;
> }
> I think the difference is caused by following code (JR 1.4.5) in
> AbstractBundledPersistenceManager (which doesn't seem to have equivalent
> in simple PM)
> 557                // skip primaryType pr mixinTypes properties
> 558                if (id.getName().equals(QName.JCR_PRIMARYTYPE)
> 559                    || id.getName().equals(QName.JCR_MIXINTYPES)
> 560                    || id.getName().equals(QName.JCR_UUID)) {
> 561                    continue;
> 562                }

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.