mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Figured out the hibernate problem. Foolishness on my part. ContentBeanImpl was missing a
default constructor. Minor mods to the mapping file to fix my self made difficulty. AVMNodeFactory now does the right thing with hibernate proxies. Test now extends to creating a file in a directory in a repository. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@2928 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,6 +22,7 @@ import org.alfresco.repo.avm.hibernate.LayeredDirectoryNodeBean;
|
|||||||
import org.alfresco.repo.avm.hibernate.LayeredFileNodeBean;
|
import org.alfresco.repo.avm.hibernate.LayeredFileNodeBean;
|
||||||
import org.alfresco.repo.avm.hibernate.PlainDirectoryNodeBean;
|
import org.alfresco.repo.avm.hibernate.PlainDirectoryNodeBean;
|
||||||
import org.alfresco.repo.avm.hibernate.PlainFileNodeBean;
|
import org.alfresco.repo.avm.hibernate.PlainFileNodeBean;
|
||||||
|
import org.hibernate.proxy.HibernateProxy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsible for instantiating AVMNode concrete subclasses from
|
* Responsible for instantiating AVMNode concrete subclasses from
|
||||||
@@ -40,6 +41,8 @@ public class AVMNodeFactory
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
HibernateProxy proxy = (HibernateProxy)bean;
|
||||||
|
bean = (AVMNodeBean)proxy.getHibernateLazyInitializer().getImplementation();
|
||||||
if (bean instanceof PlainFileNodeBean)
|
if (bean instanceof PlainFileNodeBean)
|
||||||
{
|
{
|
||||||
return new PlainFileNode((PlainFileNodeBean)bean);
|
return new PlainFileNode((PlainFileNodeBean)bean);
|
||||||
|
@@ -79,6 +79,8 @@ public class AVMServiceTest extends TestCase
|
|||||||
ArrayList<String> toSnapshot = new ArrayList<String>();
|
ArrayList<String> toSnapshot = new ArrayList<String>();
|
||||||
toSnapshot.add("main");
|
toSnapshot.add("main");
|
||||||
fService.createSnapshot(toSnapshot);
|
fService.createSnapshot(toSnapshot);
|
||||||
|
AVMNode node = fService.lookup(-1, "main:/");
|
||||||
|
assertTrue(node instanceof PlainDirectoryNode);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<class table="avm_nodes" abstract="true"
|
<class table="avm_nodes" abstract="true"
|
||||||
name="AVMNodeBeanImpl"
|
name="AVMNodeBeanImpl"
|
||||||
proxy="AVMNodeBean"
|
proxy="AVMNodeBean"
|
||||||
optimistic-lock="version" lazy="false">
|
optimistic-lock="version" lazy="true">
|
||||||
<cache usage="read-write"/>
|
<cache usage="read-write"/>
|
||||||
<!-- The id is set programmatically using an Issuer. See below. -->
|
<!-- The id is set programmatically using an Issuer. See below. -->
|
||||||
<id name="id" column="id" type="long"/>
|
<id name="id" column="id" type="long"/>
|
||||||
@@ -50,11 +50,11 @@
|
|||||||
<subclass name="DirectoryNodeBeanImpl"
|
<subclass name="DirectoryNodeBeanImpl"
|
||||||
proxy="DirectoryNodeBean"
|
proxy="DirectoryNodeBean"
|
||||||
abstract="true"
|
abstract="true"
|
||||||
lazy="false">
|
lazy="true">
|
||||||
<!-- A Layered Directory is our smart symlink thingy. -->
|
<!-- A Layered Directory is our smart symlink thingy. -->
|
||||||
<subclass name="LayeredDirectoryNodeBeanImpl"
|
<subclass name="LayeredDirectoryNodeBeanImpl"
|
||||||
proxy="LayeredDirectoryNodeBean"
|
proxy="LayeredDirectoryNodeBean"
|
||||||
discriminator-value="layereddirectory" lazy="false">
|
discriminator-value="layereddirectory" lazy="true">
|
||||||
<!-- The layer id is an implementation trick to disambiguate
|
<!-- The layer id is an implementation trick to disambiguate
|
||||||
exactly what layer is being refered to in various circumstances. -->
|
exactly what layer is being refered to in various circumstances. -->
|
||||||
<property name="layerID" column="layer_id" type="long"
|
<property name="layerID" column="layer_id" type="long"
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
</subclass>
|
</subclass>
|
||||||
<!-- Just plain directories. -->
|
<!-- Just plain directories. -->
|
||||||
<subclass name="PlainDirectoryNodeBeanImpl"
|
<subclass name="PlainDirectoryNodeBeanImpl"
|
||||||
discriminator-value="plaindirectory" proxy="PlainDirectoryNodeBean" lazy="false">
|
discriminator-value="plaindirectory" proxy="PlainDirectoryNodeBean" lazy="true">
|
||||||
<!-- For reference count based garbage collection of purged nodes
|
<!-- For reference count based garbage collection of purged nodes
|
||||||
to work we need to specially mark the root directory of
|
to work we need to specially mark the root directory of
|
||||||
a Repository as special so that its absence of parents will
|
a Repository as special so that its absence of parents will
|
||||||
@@ -123,14 +123,14 @@
|
|||||||
lazy="false">
|
lazy="false">
|
||||||
<!-- Plain files just have a reference to a Content object. -->
|
<!-- Plain files just have a reference to a Content object. -->
|
||||||
<subclass discriminator-value="plainfile"
|
<subclass discriminator-value="plainfile"
|
||||||
name="PlainFileNodeBeanImpl" proxy="PlainFileNodeBean" lazy="false">
|
name="PlainFileNodeBeanImpl" proxy="PlainFileNodeBean" lazy="true">
|
||||||
<many-to-one name="content" column="content_id"
|
<many-to-one name="content" column="content_id"
|
||||||
class="ContentBeanImpl" fetch="join" cascade="save-update">
|
class="ContentBeanImpl" fetch="join" cascade="save-update">
|
||||||
</many-to-one>
|
</many-to-one>
|
||||||
</subclass>
|
</subclass>
|
||||||
<!-- Layered files are almost exactly copy on write symlinks. -->
|
<!-- Layered files are almost exactly copy on write symlinks. -->
|
||||||
<subclass name="LayeredFileNodeBeanImpl"
|
<subclass name="LayeredFileNodeBeanImpl"
|
||||||
discriminator-value="layeredfile" proxy="LayeredFileNodeBean" lazy="false">
|
discriminator-value="layeredfile" proxy="LayeredFileNodeBean" lazy="true">
|
||||||
<property name="indirection" type="string" length="511"
|
<property name="indirection" type="string" length="511"
|
||||||
column="indirection" />
|
column="indirection" />
|
||||||
</subclass>
|
</subclass>
|
||||||
|
@@ -39,6 +39,13 @@ public class ContentBeanImpl implements ContentBean
|
|||||||
*/
|
*/
|
||||||
private long fVers;
|
private long fVers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
public ContentBeanImpl()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor with an id.
|
* Basic constructor with an id.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user