mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Big honkin' merge from head. Sheesh!
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3617 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -66,6 +66,28 @@ public interface ChildAssoc extends Comparable<ChildAssoc>
|
||||
*/
|
||||
public void setTypeQName(QName assocTypeQName);
|
||||
|
||||
/**
|
||||
* @return Returns the child node name. This may be truncated, in which case it
|
||||
* will end with <b>...</b>
|
||||
*/
|
||||
public String getChildNodeName();
|
||||
|
||||
/**
|
||||
* @param childNodeName the name of the child node, which may be truncated and
|
||||
* terminated with <b>...</b> in order to not exceed 50 characters.
|
||||
*/
|
||||
public void setChildNodeName(String childNodeName);
|
||||
|
||||
/**
|
||||
* @return Returns the crc value for the child node name.
|
||||
*/
|
||||
public long getChildNodeNameCrc();
|
||||
|
||||
/**
|
||||
* @param crc the crc value
|
||||
*/
|
||||
public void setChildNodeNameCrc(long crc);
|
||||
|
||||
/**
|
||||
* @return Returns the qualified name of this association
|
||||
*/
|
||||
|
@@ -56,24 +56,8 @@ public interface Node
|
||||
|
||||
public void setTypeQName(QName typeQName);
|
||||
|
||||
// public NodeStatus getStatus();
|
||||
//
|
||||
// public void setStatus(NodeStatus status);
|
||||
//
|
||||
public Set<QName> getAspects();
|
||||
|
||||
/**
|
||||
* @return Returns all the regular associations for which this node is a target
|
||||
*/
|
||||
public Collection<NodeAssoc> getSourceNodeAssocs();
|
||||
|
||||
/**
|
||||
* @return Returns all the regular associations for which this node is a source
|
||||
*/
|
||||
public Collection<NodeAssoc> getTargetNodeAssocs();
|
||||
|
||||
public Collection<ChildAssoc> getChildAssocs();
|
||||
|
||||
public Collection<ChildAssoc> getParentAssocs();
|
||||
|
||||
public Map<QName, PropertyValue> getProperties();
|
||||
|
@@ -42,12 +42,6 @@ public interface NodeAssoc
|
||||
*/
|
||||
public void buildAssociation(Node sourceNode, Node targetNode);
|
||||
|
||||
/**
|
||||
* Performs the necessary work on the {@link #getSource()() source} and
|
||||
* {@link #getTarget()() target} nodes to maintain the inverse association sets
|
||||
*/
|
||||
public void removeAssociation();
|
||||
|
||||
public AssociationRef getNodeAssocRef();
|
||||
|
||||
public Node getSource();
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<class
|
||||
name="org.alfresco.repo.domain.hibernate.AppliedPatchImpl"
|
||||
proxy="org.alfresco.repo.domain.AppliedPatch"
|
||||
table="applied_patch"
|
||||
table="alf_applied_patch"
|
||||
dynamic-update="false"
|
||||
dynamic-insert="false"
|
||||
select-before-update="false"
|
||||
|
@@ -38,6 +38,8 @@ public class ChildAssocImpl implements ChildAssoc, Serializable
|
||||
private Node parent;
|
||||
private Node child;
|
||||
private QName typeQName;
|
||||
private String childNodeName;
|
||||
private long childNodeNameCrc;
|
||||
private QName qName;
|
||||
private boolean isPrimary;
|
||||
private int index;
|
||||
@@ -60,15 +62,11 @@ public class ChildAssocImpl implements ChildAssoc, Serializable
|
||||
// add the forward associations
|
||||
this.setParent(parentNode);
|
||||
this.setChild(childNode);
|
||||
// add the inverse associations
|
||||
parentNode.getChildAssocs().add(this);
|
||||
childNode.getParentAssocs().add(this);
|
||||
}
|
||||
|
||||
public void removeAssociation()
|
||||
{
|
||||
// maintain inverse assoc from parent node to this instance
|
||||
this.getParent().getChildAssocs().remove(this);
|
||||
// maintain inverse assoc from child node to this instance
|
||||
this.getChild().getParentAssocs().remove(this);
|
||||
}
|
||||
@@ -128,7 +126,8 @@ public class ChildAssocImpl implements ChildAssoc, Serializable
|
||||
sb.append("ChildAssoc")
|
||||
.append("[ parent=").append(parent)
|
||||
.append(", child=").append(child)
|
||||
.append(", name=").append(getQname())
|
||||
.append(", child name crc=").append(childNodeNameCrc)
|
||||
.append(", assoc name=").append(getQname())
|
||||
.append(", isPrimary=").append(isPrimary)
|
||||
.append("]");
|
||||
return sb.toString();
|
||||
@@ -149,12 +148,19 @@ public class ChildAssocImpl implements ChildAssoc, Serializable
|
||||
return false;
|
||||
}
|
||||
ChildAssoc that = (ChildAssoc) obj;
|
||||
return (
|
||||
EqualsHelper.nullSafeEquals(this.getTypeQName(), that.getTypeQName())
|
||||
&& EqualsHelper.nullSafeEquals(this.getQname(), that.getQname())
|
||||
&& EqualsHelper.nullSafeEquals(this.getParent(), that.getParent())
|
||||
&& EqualsHelper.nullSafeEquals(this.getChild(), that.getChild())
|
||||
);
|
||||
if (EqualsHelper.nullSafeEquals(id, that.getId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (
|
||||
EqualsHelper.nullSafeEquals(this.getChild().getId(), that.getChild().getId())
|
||||
&& EqualsHelper.nullSafeEquals(this.getQname(), that.getQname())
|
||||
&& EqualsHelper.nullSafeEquals(this.getParent().getId(), that.getParent().getId())
|
||||
&& EqualsHelper.nullSafeEquals(this.getTypeQName(), that.getTypeQName())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
@@ -274,6 +280,26 @@ public class ChildAssocImpl implements ChildAssoc, Serializable
|
||||
}
|
||||
}
|
||||
|
||||
public String getChildNodeName()
|
||||
{
|
||||
return childNodeName;
|
||||
}
|
||||
|
||||
public void setChildNodeName(String childNodeName)
|
||||
{
|
||||
this.childNodeName = childNodeName;
|
||||
}
|
||||
|
||||
public long getChildNodeNameCrc()
|
||||
{
|
||||
return childNodeNameCrc;
|
||||
}
|
||||
|
||||
public void setChildNodeNameCrc(long crc)
|
||||
{
|
||||
this.childNodeNameCrc = crc;
|
||||
}
|
||||
|
||||
public QName getQname()
|
||||
{
|
||||
return qName;
|
||||
|
@@ -79,8 +79,15 @@ public class DbAccessControlEntryImpl extends LifecycleAdapter
|
||||
return false;
|
||||
}
|
||||
DbAccessControlEntry other = (DbAccessControlEntry) o;
|
||||
return (EqualsHelper.nullSafeEquals(this.permission, other.getPermission())
|
||||
&& EqualsHelper.nullSafeEquals(this.authority, other.getAuthority()));
|
||||
if (EqualsHelper.nullSafeEquals(id, other.getId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (EqualsHelper.nullSafeEquals(this.permission, other.getPermission())
|
||||
&& EqualsHelper.nullSafeEquals(this.authority, other.getAuthority()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -20,7 +20,6 @@ import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -28,9 +27,7 @@ import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.domain.ChildAssoc;
|
||||
import org.alfresco.repo.domain.DbAccessControlList;
|
||||
import org.alfresco.repo.domain.Node;
|
||||
import org.alfresco.repo.domain.NodeAssoc;
|
||||
import org.alfresco.repo.domain.NodeKey;
|
||||
import org.alfresco.repo.domain.NodeStatus;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
@@ -215,52 +212,6 @@ public class HibernateNodeTest extends BaseSpringTest
|
||||
assertEquals("Not all aspects persisted", 4, aspects.size());
|
||||
}
|
||||
|
||||
public void testNodeAssoc() throws Exception
|
||||
{
|
||||
// make a source node
|
||||
Node sourceNode = new NodeImpl();
|
||||
sourceNode.setStore(store);
|
||||
sourceNode.setUuid(GUID.generate());
|
||||
sourceNode.setTypeQName(ContentModel.TYPE_CMOBJECT);
|
||||
Serializable realNodeId = getSession().save(sourceNode);
|
||||
|
||||
// make a container node
|
||||
Node targetNode = new NodeImpl();
|
||||
targetNode.setStore(store);
|
||||
targetNode.setStore(store);
|
||||
targetNode.setUuid(GUID.generate());
|
||||
targetNode.setTypeQName(ContentModel.TYPE_CONTAINER);
|
||||
Serializable containerNodeId = getSession().save(targetNode);
|
||||
|
||||
// create an association between them
|
||||
NodeAssoc assoc = new NodeAssocImpl();
|
||||
assoc.setTypeQName(QName.createQName("next"));
|
||||
assoc.buildAssociation(sourceNode, targetNode);
|
||||
getSession().save(assoc);
|
||||
|
||||
// make another association between the same two nodes
|
||||
assoc = new NodeAssocImpl();
|
||||
assoc.setTypeQName(QName.createQName("helper"));
|
||||
assoc.buildAssociation(sourceNode, targetNode);
|
||||
getSession().save(assoc);
|
||||
|
||||
// flush and clear the session
|
||||
getSession().flush();
|
||||
getSession().clear();
|
||||
|
||||
// reload the source
|
||||
sourceNode = (Node) getSession().get(NodeImpl.class, realNodeId);
|
||||
assertNotNull("Source node not found", sourceNode);
|
||||
// check that the associations are present
|
||||
assertEquals("Expected exactly 2 target assocs", 2, sourceNode.getTargetNodeAssocs().size());
|
||||
|
||||
// reload the target
|
||||
targetNode = (Node) getSession().get(NodeImpl.class, containerNodeId);
|
||||
assertNotNull("Target node not found", targetNode);
|
||||
// check that the associations are present
|
||||
assertEquals("Expected exactly 2 source assocs", 2, targetNode.getSourceNodeAssocs().size());
|
||||
}
|
||||
|
||||
public void testChildAssoc() throws Exception
|
||||
{
|
||||
// make a content node
|
||||
@@ -281,35 +232,27 @@ public class HibernateNodeTest extends BaseSpringTest
|
||||
assoc1.setIsPrimary(true);
|
||||
assoc1.setTypeQName(QName.createQName(null, "type1"));
|
||||
assoc1.setQname(QName.createQName(null, "number1"));
|
||||
assoc1.setChildNodeName("number1");
|
||||
assoc1.setChildNodeNameCrc(1);
|
||||
assoc1.buildAssociation(containerNode, contentNode);
|
||||
getSession().save(assoc1);
|
||||
|
||||
// make another association between the same two parent and child nodes
|
||||
ChildAssoc assoc2 = new ChildAssocImpl();
|
||||
assoc2.setIsPrimary(true);
|
||||
assoc2.setTypeQName(QName.createQName(null, "type1"));
|
||||
assoc2.setTypeQName(QName.createQName(null, "type2"));
|
||||
assoc2.setQname(QName.createQName(null, "number2"));
|
||||
assoc2.setChildNodeName("number2");
|
||||
assoc2.setChildNodeNameCrc(2);
|
||||
assoc2.buildAssociation(containerNode, contentNode);
|
||||
getSession().save(assoc2);
|
||||
|
||||
assertFalse("Hashcode incorrent", assoc2.hashCode() == 0);
|
||||
assertNotSame("Assoc equals failure", assoc1, assoc2);
|
||||
|
||||
// flushAndClear();
|
||||
|
||||
// reload the container
|
||||
containerNode = (Node) getSession().get(NodeImpl.class, containerNodeId);
|
||||
assertNotNull("Node not found", containerNode);
|
||||
// check
|
||||
assertEquals("Expected exactly 2 children", 2, containerNode.getChildAssocs().size());
|
||||
for (Iterator iterator = containerNode.getChildAssocs().iterator(); iterator.hasNext(); /**/)
|
||||
{
|
||||
ChildAssoc assoc = (ChildAssoc) iterator.next();
|
||||
// the node id must be known
|
||||
assertNotNull("Node not populated on assoc", assoc.getChild());
|
||||
assertEquals("Node key on child assoc is incorrect",
|
||||
contentNodeId, assoc.getChild().getId());
|
||||
}
|
||||
|
||||
// check that we can traverse the association from the child
|
||||
Collection<ChildAssoc> parentAssocs = contentNode.getParentAssocs();
|
||||
@@ -362,7 +305,6 @@ public class HibernateNodeTest extends BaseSpringTest
|
||||
Map<QName, PropertyValue> checkProperties = checkNode.getProperties();
|
||||
assertTrue("Propery map retrieved was not the same instance", checkProperties == properties);
|
||||
assertTrue("Property not found", checkProperties.containsKey(ContentModel.PROP_NAME));
|
||||
// assertTrue("Property value instance retrieved not the same", checkProperties)
|
||||
|
||||
flushAndClear();
|
||||
// commit the transaction
|
||||
@@ -380,8 +322,6 @@ public class HibernateNodeTest extends BaseSpringTest
|
||||
assertNotNull(checkNode);
|
||||
checkAspects = checkNode.getAspects();
|
||||
|
||||
// assertTrue("Node retrieved was not same instance", checkNode == node);
|
||||
|
||||
txn.commit();
|
||||
}
|
||||
catch (Throwable e)
|
||||
@@ -448,6 +388,8 @@ public class HibernateNodeTest extends BaseSpringTest
|
||||
assoc1.setIsPrimary(true);
|
||||
assoc1.setTypeQName(QName.createQName(null, "type1"));
|
||||
assoc1.setQname(QName.createQName(null, "number1"));
|
||||
assoc1.setChildNodeName("number1");
|
||||
assoc1.setChildNodeNameCrc(1);
|
||||
assoc1.buildAssociation(containerNode, contentNode1);
|
||||
getSession().save(assoc1);
|
||||
// create an association to content 2
|
||||
@@ -455,6 +397,8 @@ public class HibernateNodeTest extends BaseSpringTest
|
||||
assoc2.setIsPrimary(true);
|
||||
assoc2.setTypeQName(QName.createQName(null, "type2"));
|
||||
assoc2.setQname(QName.createQName(null, "number2"));
|
||||
assoc2.setChildNodeName("number2");
|
||||
assoc2.setChildNodeNameCrc(2);
|
||||
assoc2.buildAssociation(containerNode, contentNode2);
|
||||
getSession().save(assoc2);
|
||||
|
||||
@@ -465,37 +409,10 @@ public class HibernateNodeTest extends BaseSpringTest
|
||||
// now read the structure back in from the container down
|
||||
containerNodeStatus = (NodeStatus) getSession().get(NodeStatusImpl.class, containerNodeKey);
|
||||
containerNode = containerNodeStatus.getNode();
|
||||
Collection<ChildAssoc> assocs = containerNode.getChildAssocs();
|
||||
for (ChildAssoc assoc : assocs)
|
||||
{
|
||||
Node childNode = assoc.getChild();
|
||||
Store store = childNode.getStore();
|
||||
childNode.getAspects().size();
|
||||
childNode.getProperties().size();
|
||||
childNode.getParentAssocs().size();
|
||||
childNode.getChildAssocs().size();
|
||||
childNode.getSourceNodeAssocs().size();
|
||||
childNode.getTargetNodeAssocs().size();
|
||||
DbAccessControlList acl = childNode.getAccessControlList();
|
||||
if (acl != null)
|
||||
{
|
||||
acl.getEntries().size();
|
||||
}
|
||||
}
|
||||
|
||||
// clear out again
|
||||
getSession().clear();
|
||||
|
||||
// now remove a property from each child
|
||||
containerNodeStatus = (NodeStatus) getSession().get(NodeStatusImpl.class, containerNodeKey);
|
||||
containerNode = containerNodeStatus.getNode();
|
||||
assocs = containerNode.getChildAssocs();
|
||||
for (ChildAssoc assoc : assocs)
|
||||
{
|
||||
Node childNode = assoc.getChild();
|
||||
PropertyValue removed = childNode.getProperties().remove(ContentModel.PROP_ARCHIVED_BY);
|
||||
assertNotNull("Property was not present", removed);
|
||||
}
|
||||
// expect that just the specific property gets removed in the delete statement
|
||||
getSession().flush();
|
||||
getSession().clear();
|
||||
@@ -510,6 +427,8 @@ public class HibernateNodeTest extends BaseSpringTest
|
||||
assoc3.setIsPrimary(false);
|
||||
assoc3.setTypeQName(QName.createQName(null, "type3"));
|
||||
assoc3.setQname(QName.createQName(null, "number3"));
|
||||
assoc3.setChildNodeName("number3");
|
||||
assoc3.setChildNodeNameCrc(2);
|
||||
assoc3.buildAssociation(containerNode, contentNode2); // check whether the children are pulled in for this
|
||||
getSession().save(assoc3);
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
<class
|
||||
name="org.alfresco.repo.domain.hibernate.NodeImpl"
|
||||
proxy="org.alfresco.repo.domain.Node"
|
||||
table="node"
|
||||
table="alf_node"
|
||||
dynamic-update="false"
|
||||
dynamic-insert="false"
|
||||
select-before-update="false"
|
||||
@@ -43,15 +43,15 @@
|
||||
name="accessControlList"
|
||||
class="org.alfresco.repo.domain.hibernate.DbAccessControlListImpl"
|
||||
column="acl_id"
|
||||
lazy="false"
|
||||
fetch="join"
|
||||
lazy="proxy"
|
||||
fetch="select"
|
||||
unique="false"
|
||||
not-null="false"
|
||||
cascade="delete" />
|
||||
<!-- forward assoc to properties -->
|
||||
<map
|
||||
name="properties"
|
||||
table="node_properties"
|
||||
table="alf_node_properties"
|
||||
lazy="true"
|
||||
fetch="select"
|
||||
sort="unsorted"
|
||||
@@ -75,7 +75,7 @@
|
||||
<!-- forward assoc to aspects -->
|
||||
<set
|
||||
name="aspects"
|
||||
table="node_aspects"
|
||||
table="alf_node_aspects"
|
||||
lazy="false"
|
||||
fetch="join"
|
||||
inverse="false"
|
||||
@@ -96,45 +96,12 @@
|
||||
<key column="child_node_id" />
|
||||
<one-to-many class="org.alfresco.repo.domain.hibernate.ChildAssocImpl" />
|
||||
</set>
|
||||
<!-- inverse assoc to child childassocs -->
|
||||
<set
|
||||
name="childAssocs"
|
||||
inverse="true"
|
||||
lazy="true"
|
||||
fetch="select"
|
||||
cascade="none"
|
||||
optimistic-lock="true" >
|
||||
<key column="parent_node_id" />
|
||||
<one-to-many class="org.alfresco.repo.domain.hibernate.ChildAssocImpl" />
|
||||
</set>
|
||||
<!-- inverse assoc to source nodeassocs -->
|
||||
<set
|
||||
name="sourceNodeAssocs"
|
||||
inverse="true"
|
||||
lazy="true"
|
||||
fetch="select"
|
||||
cascade="none"
|
||||
optimistic-lock="true" >
|
||||
<key column="target_node_id" />
|
||||
<one-to-many class="org.alfresco.repo.domain.hibernate.NodeAssocImpl" />
|
||||
</set>
|
||||
<!-- inverse assoc to target nodeassocs -->
|
||||
<set
|
||||
name="targetNodeAssocs"
|
||||
inverse="true"
|
||||
lazy="true"
|
||||
fetch="select"
|
||||
cascade="none"
|
||||
optimistic-lock="true" >
|
||||
<key column="source_node_id" />
|
||||
<one-to-many class="org.alfresco.repo.domain.hibernate.NodeAssocImpl" />
|
||||
</set>
|
||||
</class>
|
||||
|
||||
<class
|
||||
name="org.alfresco.repo.domain.hibernate.NodeStatusImpl"
|
||||
proxy="org.alfresco.repo.domain.NodeStatus"
|
||||
table="node_status"
|
||||
table="alf_node_status"
|
||||
dynamic-update="false"
|
||||
dynamic-insert="false"
|
||||
select-before-update="false"
|
||||
@@ -155,7 +122,7 @@
|
||||
fetch="join"
|
||||
unique="false"
|
||||
not-null="false" />
|
||||
<property name="changeTxnId" column="change_txn_id" type="string" length="56" not-null="true" />
|
||||
<property name="changeTxnId" column="change_txn_id" type="string" length="56" not-null="true" index="CHANGE_TXN_ID"/>
|
||||
</class>
|
||||
|
||||
<class
|
||||
@@ -165,32 +132,37 @@
|
||||
dynamic-update="false"
|
||||
lazy="true"
|
||||
optimistic-lock="version"
|
||||
table="child_assoc" >
|
||||
table="alf_child_assoc" >
|
||||
<!-- auto-generated ID -->
|
||||
<id name="id" column="id" type="long" >
|
||||
<generator class="native" />
|
||||
</id>
|
||||
<!-- forward assoc to parent node -->
|
||||
<many-to-one
|
||||
name="parent"
|
||||
class="org.alfresco.repo.domain.hibernate.NodeImpl"
|
||||
lazy="proxy"
|
||||
fetch="select"
|
||||
optimistic-lock="true"
|
||||
not-null="true" >
|
||||
<column name="parent_node_id" />
|
||||
</many-to-one>
|
||||
<!-- forward assoc to child node -->
|
||||
<many-to-one
|
||||
name="child"
|
||||
lazy="proxy"
|
||||
fetch="select"
|
||||
class="org.alfresco.repo.domain.hibernate.NodeImpl"
|
||||
optimistic-lock="true"
|
||||
not-null="true" >
|
||||
<column name="child_node_id" />
|
||||
</many-to-one>
|
||||
<property name="typeQName" column="type_qname" type="QName" length="255" not-null="true" />
|
||||
<natural-id mutable="true">
|
||||
<!-- forward assoc to parent node -->
|
||||
<many-to-one
|
||||
name="parent"
|
||||
class="org.alfresco.repo.domain.hibernate.NodeImpl"
|
||||
lazy="proxy"
|
||||
fetch="select"
|
||||
optimistic-lock="true"
|
||||
not-null="true"
|
||||
unique-key="UIDX_CHILD_NAME" >
|
||||
<column name="parent_node_id" />
|
||||
</many-to-one>
|
||||
<!-- forward assoc to child node -->
|
||||
<many-to-one
|
||||
name="child"
|
||||
lazy="proxy"
|
||||
fetch="select"
|
||||
class="org.alfresco.repo.domain.hibernate.NodeImpl"
|
||||
optimistic-lock="true"
|
||||
not-null="true" >
|
||||
<column name="child_node_id" />
|
||||
</many-to-one>
|
||||
<property name="typeQName" column="type_qname" type="QName" length="255" not-null="true" unique-key="UIDX_CHILD_NAME" />
|
||||
</natural-id>
|
||||
<property name="childNodeName" column="child_node_name" type="string" length="50" not-null="true" unique-key="UIDX_CHILD_NAME" />
|
||||
<property name="childNodeNameCrc" column="child_node_name_crc" type="long" not-null="true" unique-key="UIDX_CHILD_NAME" />
|
||||
<property name="qname" column="qname" type="QName" length="255" not-null="true" />
|
||||
<property name="isPrimary" column="is_primary" />
|
||||
<property name="index" column="assoc_index" />
|
||||
@@ -199,30 +171,32 @@
|
||||
<class
|
||||
name="org.alfresco.repo.domain.hibernate.NodeAssocImpl"
|
||||
proxy="org.alfresco.repo.domain.NodeAssoc"
|
||||
table="node_assoc" >
|
||||
table="alf_node_assoc" >
|
||||
<!-- auto-generated ID -->
|
||||
<id name="id" column="id" type="long" >
|
||||
<generator class="native" />
|
||||
</id>
|
||||
<!-- forward assoc to source node -->
|
||||
<many-to-one
|
||||
name="source"
|
||||
class="org.alfresco.repo.domain.hibernate.NodeImpl"
|
||||
lazy="false"
|
||||
fetch="join"
|
||||
not-null="true" >
|
||||
<column name="source_node_id" />
|
||||
</many-to-one>
|
||||
<!-- forward assoc to target node -->
|
||||
<many-to-one
|
||||
name="target"
|
||||
class="org.alfresco.repo.domain.hibernate.NodeImpl"
|
||||
lazy="false"
|
||||
fetch="join"
|
||||
not-null="true" >
|
||||
<column name="target_node_id" />
|
||||
</many-to-one>
|
||||
<property name="typeQName" column="type_qname" type="QName" length="255" not-null="true" />
|
||||
<natural-id mutable="true">
|
||||
<!-- forward assoc to source node -->
|
||||
<many-to-one
|
||||
name="source"
|
||||
class="org.alfresco.repo.domain.hibernate.NodeImpl"
|
||||
lazy="false"
|
||||
fetch="join"
|
||||
not-null="true" >
|
||||
<column name="source_node_id" />
|
||||
</many-to-one>
|
||||
<!-- forward assoc to target node -->
|
||||
<many-to-one
|
||||
name="target"
|
||||
class="org.alfresco.repo.domain.hibernate.NodeImpl"
|
||||
lazy="false"
|
||||
fetch="join"
|
||||
not-null="true" >
|
||||
<column name="target_node_id" />
|
||||
</many-to-one>
|
||||
<property name="typeQName" column="type_qname" type="QName" length="255" not-null="true" />
|
||||
</natural-id>
|
||||
</class>
|
||||
|
||||
<query name="store.GetAllStores">
|
||||
@@ -232,39 +206,107 @@
|
||||
org.alfresco.repo.domain.hibernate.StoreImpl as store
|
||||
</query>
|
||||
|
||||
<query name="node.updateChildAssocName">
|
||||
update
|
||||
org.alfresco.repo.domain.hibernate.ChildAssocImpl assoc
|
||||
set
|
||||
assoc.childNodeName = :newName,
|
||||
assoc.childNodeNameCrc = :newNameCrc
|
||||
where
|
||||
assoc.id = :childAssocId
|
||||
</query>
|
||||
|
||||
<query name="node.GetChildAssocs">
|
||||
select
|
||||
assoc
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.ChildAssocImpl as assoc
|
||||
where
|
||||
assoc.parent.id = :parentId
|
||||
order by
|
||||
assoc.index,
|
||||
assoc.id
|
||||
</query>
|
||||
|
||||
<query name="node.GetChildAssocByTypeAndName">
|
||||
select
|
||||
assoc
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.ChildAssocImpl as assoc
|
||||
where
|
||||
assoc.parent.id = :parentId and
|
||||
assoc.typeQName = :typeQName and
|
||||
assoc.childNodeName = :childNodeName and
|
||||
assoc.childNodeNameCrc = :childNodeNameCrc
|
||||
order by
|
||||
assoc.index,
|
||||
assoc.id
|
||||
</query>
|
||||
|
||||
<query name="node.GetChildAssocRefs">
|
||||
select
|
||||
assoc.typeQName,
|
||||
assoc.qname,
|
||||
assoc.isPrimary,
|
||||
assoc.index,
|
||||
child.id,
|
||||
child.store.key.protocol,
|
||||
child.store.key.identifier,
|
||||
child.uuid as parentUuid
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.ChildAssocImpl as assoc
|
||||
join assoc.parent as parent
|
||||
join assoc.child as child
|
||||
where
|
||||
assoc.parent.id = :parentId
|
||||
order by
|
||||
assoc.index,
|
||||
assoc.id
|
||||
</query>
|
||||
|
||||
<query name="node.GetNodeAssoc">
|
||||
select
|
||||
assoc
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.NodeAssocImpl as assoc
|
||||
where
|
||||
assoc.source = :sourceNode and
|
||||
assoc.target = :targetNode and
|
||||
assoc.source.id = :sourceId and
|
||||
assoc.target.id = :targetId and
|
||||
assoc.typeQName = :assocTypeQName
|
||||
</query>
|
||||
|
||||
<query name="node.GetNodeAssocTargets">
|
||||
<query name="node.GetNodeAssocsToAndFrom">
|
||||
select
|
||||
target
|
||||
assoc
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.NodeAssocImpl as assoc
|
||||
join assoc.target as target
|
||||
where
|
||||
assoc.source = :sourceNode and
|
||||
assoc.typeQName = :assocTypeQName
|
||||
assoc.source.id = :nodeId or
|
||||
assoc.target.id = :nodeId
|
||||
</query>
|
||||
|
||||
<query name="node.GetNodeAssocSources">
|
||||
<query name="node.GetTargetAssocs">
|
||||
select
|
||||
source
|
||||
assoc
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.NodeAssocImpl as assoc
|
||||
join assoc.source as source
|
||||
join assoc.target as target
|
||||
where
|
||||
assoc.target = :targetNode and
|
||||
assoc.typeQName = :assocTypeQName
|
||||
assoc.source.id = :sourceId
|
||||
</query>
|
||||
|
||||
|
||||
<query name="node.GetSourceAssocs">
|
||||
select
|
||||
assoc
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.NodeAssocImpl as assoc
|
||||
join assoc.source as source
|
||||
join assoc.target as target
|
||||
where
|
||||
assoc.target.id = :targetId
|
||||
</query>
|
||||
|
||||
<query name="node.GetNextChangeTxnIds">
|
||||
select distinct
|
||||
status.changeTxnId
|
||||
@@ -333,4 +375,20 @@
|
||||
node.properties.multiValued = false
|
||||
</query>
|
||||
|
||||
<query name="node.patch.GetAssocsAndChildNames">
|
||||
<![CDATA[
|
||||
select
|
||||
assoc,
|
||||
child
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.ChildAssocImpl as assoc
|
||||
join assoc.child as child
|
||||
where
|
||||
assoc.id > :lastAssocId and
|
||||
assoc.typeQName = :assocTypeQName
|
||||
order by
|
||||
assoc.id
|
||||
]]>
|
||||
</query>
|
||||
|
||||
</hibernate-mapping>
|
||||
|
@@ -57,17 +57,6 @@ public class NodeAssocImpl implements NodeAssoc, Serializable
|
||||
// add the forward associations
|
||||
this.setTarget(targetNode);
|
||||
this.setSource(sourceNode);
|
||||
// add the inverse associations
|
||||
sourceNode.getTargetNodeAssocs().add(this);
|
||||
targetNode.getSourceNodeAssocs().add(this);
|
||||
}
|
||||
|
||||
public void removeAssociation()
|
||||
{
|
||||
// maintain inverse assoc from source node to this instance
|
||||
this.getSource().getTargetNodeAssocs().remove(this);
|
||||
// maintain inverse assoc from target node to this instance
|
||||
this.getTarget().getSourceNodeAssocs().remove(this);
|
||||
}
|
||||
|
||||
public AssociationRef getNodeAssocRef()
|
||||
|
@@ -29,7 +29,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
import org.alfresco.repo.domain.ChildAssoc;
|
||||
import org.alfresco.repo.domain.DbAccessControlList;
|
||||
import org.alfresco.repo.domain.Node;
|
||||
import org.alfresco.repo.domain.NodeAssoc;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.domain.Store;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -52,12 +51,8 @@ public class NodeImpl extends LifecycleAdapter implements Node, Serializable
|
||||
private Store store;
|
||||
private String uuid;
|
||||
private QName typeQName;
|
||||
// private NodeStatus status;
|
||||
private Set<QName> aspects;
|
||||
private Collection<NodeAssoc> sourceNodeAssocs;
|
||||
private Collection<NodeAssoc> targetNodeAssocs;
|
||||
private Collection<ChildAssoc> parentAssocs;
|
||||
private Collection<ChildAssoc> childAssocs;
|
||||
private Map<QName, PropertyValue> properties;
|
||||
private DbAccessControlList accessControlList;
|
||||
|
||||
@@ -68,10 +63,7 @@ public class NodeImpl extends LifecycleAdapter implements Node, Serializable
|
||||
public NodeImpl()
|
||||
{
|
||||
aspects = new HashSet<QName>(5);
|
||||
sourceNodeAssocs = new HashSet<NodeAssoc>(5);
|
||||
targetNodeAssocs = new HashSet<NodeAssoc>(5);
|
||||
parentAssocs = new HashSet<ChildAssoc>(5);
|
||||
childAssocs = new HashSet<ChildAssoc>(11);
|
||||
properties = new HashMap<QName, PropertyValue>(5);
|
||||
|
||||
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
@@ -137,8 +129,14 @@ public class NodeImpl extends LifecycleAdapter implements Node, Serializable
|
||||
return false;
|
||||
}
|
||||
Node that = (Node) obj;
|
||||
return (EqualsHelper.nullSafeEquals(getStore(), that.getStore())
|
||||
&& EqualsHelper.nullSafeEquals(getUuid(), that.getUuid()));
|
||||
if (EqualsHelper.nullSafeEquals(id, that.getId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (this.getNodeRef().equals(that.getNodeRef()));
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
@@ -221,16 +219,6 @@ public class NodeImpl extends LifecycleAdapter implements Node, Serializable
|
||||
this.typeQName = typeQName;
|
||||
}
|
||||
|
||||
// public NodeStatus getStatus()
|
||||
// {
|
||||
// return status;
|
||||
// }
|
||||
//
|
||||
// public void setStatus(NodeStatus status)
|
||||
// {
|
||||
// this.status = status;
|
||||
// }
|
||||
//
|
||||
public Set<QName> getAspects()
|
||||
{
|
||||
return aspects;
|
||||
@@ -245,34 +233,6 @@ public class NodeImpl extends LifecycleAdapter implements Node, Serializable
|
||||
this.aspects = aspects;
|
||||
}
|
||||
|
||||
public Collection<NodeAssoc> getSourceNodeAssocs()
|
||||
{
|
||||
return sourceNodeAssocs;
|
||||
}
|
||||
|
||||
/**
|
||||
* For Hibernate use
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private void setSourceNodeAssocs(Collection<NodeAssoc> sourceNodeAssocs)
|
||||
{
|
||||
this.sourceNodeAssocs = sourceNodeAssocs;
|
||||
}
|
||||
|
||||
public Collection<NodeAssoc> getTargetNodeAssocs()
|
||||
{
|
||||
return targetNodeAssocs;
|
||||
}
|
||||
|
||||
/**
|
||||
* For Hibernate use
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private void setTargetNodeAssocs(Collection<NodeAssoc> targetNodeAssocs)
|
||||
{
|
||||
this.targetNodeAssocs = targetNodeAssocs;
|
||||
}
|
||||
|
||||
public Collection<ChildAssoc> getParentAssocs()
|
||||
{
|
||||
return parentAssocs;
|
||||
@@ -287,20 +247,6 @@ public class NodeImpl extends LifecycleAdapter implements Node, Serializable
|
||||
this.parentAssocs = parentAssocs;
|
||||
}
|
||||
|
||||
public Collection<ChildAssoc> getChildAssocs()
|
||||
{
|
||||
return childAssocs;
|
||||
}
|
||||
|
||||
/**
|
||||
* For Hibernate use
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private void setChildAssocs(Collection<ChildAssoc> childAssocs)
|
||||
{
|
||||
this.childAssocs = childAssocs;
|
||||
}
|
||||
|
||||
public Map<QName, PropertyValue> getProperties()
|
||||
{
|
||||
return properties;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<class
|
||||
name="org.alfresco.repo.domain.hibernate.DbAccessControlListImpl"
|
||||
proxy="org.alfresco.repo.domain.DbAccessControlList"
|
||||
table="access_control_list"
|
||||
table="alf_access_control_list"
|
||||
dynamic-insert="false"
|
||||
dynamic-update="false"
|
||||
select-before-update="false"
|
||||
@@ -36,7 +36,7 @@
|
||||
<class
|
||||
name="org.alfresco.repo.domain.hibernate.DbAccessControlEntryImpl"
|
||||
proxy="org.alfresco.repo.domain.DbAccessControlEntry"
|
||||
table="access_control_entry"
|
||||
table="alf_access_control_entry"
|
||||
dynamic-insert="false"
|
||||
dynamic-update="false"
|
||||
select-before-update="false"
|
||||
@@ -81,7 +81,7 @@
|
||||
<class
|
||||
name="org.alfresco.repo.domain.hibernate.DbPermissionImpl"
|
||||
proxy="org.alfresco.repo.domain.DbPermission"
|
||||
table="permission"
|
||||
table="alf_permission"
|
||||
dynamic-insert="false"
|
||||
dynamic-update="false"
|
||||
select-before-update="false"
|
||||
@@ -102,7 +102,7 @@
|
||||
<class
|
||||
name="org.alfresco.repo.domain.hibernate.DbAuthorityImpl"
|
||||
proxy="org.alfresco.repo.domain.DbAuthority"
|
||||
table="authority"
|
||||
table="alf_authority"
|
||||
dynamic-insert="false"
|
||||
dynamic-update="false"
|
||||
select-before-update="false"
|
||||
@@ -113,7 +113,7 @@
|
||||
|
||||
<set
|
||||
name="externalKeys"
|
||||
table="auth_ext_keys"
|
||||
table="alf_auth_ext_keys"
|
||||
lazy="true"
|
||||
sort="unsorted"
|
||||
fetch="select"
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<class
|
||||
name="org.alfresco.repo.domain.hibernate.StoreImpl"
|
||||
proxy="org.alfresco.repo.domain.Store"
|
||||
table="store"
|
||||
table="alf_store"
|
||||
dynamic-update="false"
|
||||
dynamic-insert="false"
|
||||
select-before-update="false"
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<class
|
||||
name="org.alfresco.repo.domain.hibernate.VersionCountImpl"
|
||||
proxy="org.alfresco.repo.domain.VersionCount"
|
||||
table="version_count"
|
||||
table="alf_version_count"
|
||||
dynamic-update="false"
|
||||
dynamic-insert="false"
|
||||
select-before-update="false"
|
||||
|
Reference in New Issue
Block a user