jackrabbit session.importXML() 不接受 uuid
jackrabbit session.importXML() does not honour uuid
我一直在尝试使用
将 xml 数据导入 JCR
session.importXML("/", resource, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
第一次它工作正常,但是当我再次导入相同的数据时它不会抛出异常,即使 xml 中的 uid 是相同的。它只是将记录添加到数据库中。这意味着每次导入时我的记录都会不断添加到数据库中
如果我在同一会话中两次导入 xml,它会抛出异常。如果我在不同的会话中导入 xml 它不会抛出异常。我对 jackrabbit 代码进行了一些调试。在从 xml 导入数据时,jackrabbit 遍历每条记录,如果它具有唯一 ID,则它会尝试查找该记录是否已经存在,显然它没有找到,即使它存在。如果记录已经导入到同一会话中,它会找到它。
这是我的XML。
<?xml version="1.0" encoding="UTF-8"?>
<sv:node xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:pb="http://pb.com/pb/hubble/projects/1.0/"
xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
sv:name="Viewpoint">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:component</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd43fb6-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Component</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>Viewpoint</sv:value>
</sv:property>
<sv:property sv:name="pb:licensed" sv:type="Boolean">
<sv:value>true</sv:value>
</sv:property>
<sv:node sv:name="pb:roles" jcr:primaryType="pb:role">
<sv:node sv:name="Community Administrator">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:role</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd441d2-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Role</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>Community Administrator</sv:value>
</sv:property>
<sv:property sv:name="pb:nameDisplayKey" sv:type="String">
<sv:value>roleNameKey.CommunityAdministrator</sv:value>
</sv:property>
<sv:property sv:name="pb:categoryDisplayKey" sv:type="String">
<sv:value>categoryKey.Administrative</sv:value>
</sv:property>
<sv:property sv:name="pb:category" sv:type="String">
<sv:value>Administrative</sv:value>
</sv:property>
<sv:property sv:name="pb:type" sv:type="String">
<sv:value>ADMINISTRATOR</sv:value>
</sv:property>
<sv:node sv:name="pb:entitlements" jcr:primaryType="pb:entitlement">
<sv:node sv:name="VIEWPOINT_LIST_ROLE_MAPPINGS">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd44308-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_LIST_ROLE_MAPPINGS</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_UPDATE_ROLE_MAPPINGS">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd44434-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_UPDATE_ROLE_MAPPINGS</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_LIST_COMMUNITIES">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>85438386-343b-11e4-99ba-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_LIST_COMMUNITIES</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_UPDATE_COMMUNITIES">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>854385fc-343b-11e4-99ba-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_UPDATE_COMMUNITIES</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_VIEW_COMMUNITY_TO_VAULT_DATABASE_MAPPINGS">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd4465a-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_VIEW_COMMUNITY_TO_VAULT_DATABASE_MAPPINGS</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_EDIT_COMMUNITY_TO_VAULT_DATABASE_MAPPINGS">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd4484e-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_EDIT_COMMUNITY_TO_VAULT_DATABASE_MAPPINGS</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_VIEW_ENGAGEONE_SERVER">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>8543873c-343b-11e4-99ba-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_VIEW_ENGAGEONE_SERVER</sv:value>
</sv:property>
</sv:node>
</sv:node>
</sv:node>
</sv:node>
奇怪的行为有什么原因吗,我做错了什么吗?
有人认为我在数据库支持的 Jackrabbit 中看不到这种行为。
我只在 InMemory Jackrabbit 中观察到阻止我编写测试的行为
我一直在尝试使用
将 xml 数据导入 JCRsession.importXML("/", resource, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
第一次它工作正常,但是当我再次导入相同的数据时它不会抛出异常,即使 xml 中的 uid 是相同的。它只是将记录添加到数据库中。这意味着每次导入时我的记录都会不断添加到数据库中
如果我在同一会话中两次导入 xml,它会抛出异常。如果我在不同的会话中导入 xml 它不会抛出异常。我对 jackrabbit 代码进行了一些调试。在从 xml 导入数据时,jackrabbit 遍历每条记录,如果它具有唯一 ID,则它会尝试查找该记录是否已经存在,显然它没有找到,即使它存在。如果记录已经导入到同一会话中,它会找到它。
这是我的XML。
<?xml version="1.0" encoding="UTF-8"?>
<sv:node xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:pb="http://pb.com/pb/hubble/projects/1.0/"
xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
sv:name="Viewpoint">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:component</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd43fb6-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Component</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>Viewpoint</sv:value>
</sv:property>
<sv:property sv:name="pb:licensed" sv:type="Boolean">
<sv:value>true</sv:value>
</sv:property>
<sv:node sv:name="pb:roles" jcr:primaryType="pb:role">
<sv:node sv:name="Community Administrator">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:role</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd441d2-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Role</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>Community Administrator</sv:value>
</sv:property>
<sv:property sv:name="pb:nameDisplayKey" sv:type="String">
<sv:value>roleNameKey.CommunityAdministrator</sv:value>
</sv:property>
<sv:property sv:name="pb:categoryDisplayKey" sv:type="String">
<sv:value>categoryKey.Administrative</sv:value>
</sv:property>
<sv:property sv:name="pb:category" sv:type="String">
<sv:value>Administrative</sv:value>
</sv:property>
<sv:property sv:name="pb:type" sv:type="String">
<sv:value>ADMINISTRATOR</sv:value>
</sv:property>
<sv:node sv:name="pb:entitlements" jcr:primaryType="pb:entitlement">
<sv:node sv:name="VIEWPOINT_LIST_ROLE_MAPPINGS">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd44308-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_LIST_ROLE_MAPPINGS</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_UPDATE_ROLE_MAPPINGS">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd44434-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_UPDATE_ROLE_MAPPINGS</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_LIST_COMMUNITIES">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>85438386-343b-11e4-99ba-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_LIST_COMMUNITIES</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_UPDATE_COMMUNITIES">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>854385fc-343b-11e4-99ba-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_UPDATE_COMMUNITIES</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_VIEW_COMMUNITY_TO_VAULT_DATABASE_MAPPINGS">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd4465a-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_VIEW_COMMUNITY_TO_VAULT_DATABASE_MAPPINGS</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_EDIT_COMMUNITY_TO_VAULT_DATABASE_MAPPINGS">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>cbd4484e-3530-11e4-8920-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_EDIT_COMMUNITY_TO_VAULT_DATABASE_MAPPINGS</sv:value>
</sv:property>
</sv:node>
<sv:node sv:name="VIEWPOINT_VIEW_ENGAGEONE_SERVER">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>pb:entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:uuid" sv:type="String">
<sv:value>8543873c-343b-11e4-99ba-164230d1df67</sv:value>
</sv:property>
<sv:property sv:name="className" sv:type="String">
<sv:value>com.pb.viewpoint.common.model.Entitlement</sv:value>
</sv:property>
<sv:property sv:name="jcr:title" sv:type="String">
<sv:value>VIEWPOINT_VIEW_ENGAGEONE_SERVER</sv:value>
</sv:property>
</sv:node>
</sv:node>
</sv:node>
</sv:node>
奇怪的行为有什么原因吗,我做错了什么吗?
有人认为我在数据库支持的 Jackrabbit 中看不到这种行为。
我只在 InMemory Jackrabbit 中观察到阻止我编写测试的行为