mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Shored up the tests a bit. Made BasicAttributes into a component instead of a one-to-one
in the mapping file. Added missing equals and hashCode to Issuer. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@2929 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -98,6 +98,7 @@ public class AVMServiceTest extends TestCase
|
|||||||
{
|
{
|
||||||
testCreateDirectory();
|
testCreateDirectory();
|
||||||
fService.createFile("main:testdir", "testfile");
|
fService.createFile("main:testdir", "testfile");
|
||||||
|
fService.createFile("main:/", "testfile2");
|
||||||
ArrayList<String> toSnapshot = new ArrayList<String>();
|
ArrayList<String> toSnapshot = new ArrayList<String>();
|
||||||
toSnapshot.add("main");
|
toSnapshot.add("main");
|
||||||
fService.createSnapshot(toSnapshot);
|
fService.createSnapshot(toSnapshot);
|
||||||
|
@@ -69,7 +69,6 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
time,
|
time,
|
||||||
time,
|
time,
|
||||||
time);
|
time);
|
||||||
repos.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData = new LayeredDirectoryNodeBeanImpl(repos.getSuperRepository().issueID(),
|
fData = new LayeredDirectoryNodeBeanImpl(repos.getSuperRepository().issueID(),
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@@ -100,7 +99,6 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
attrs.setModDate(time);
|
attrs.setModDate(time);
|
||||||
attrs.setAccessDate(time);
|
attrs.setAccessDate(time);
|
||||||
attrs.setLastModifier("britt");
|
attrs.setLastModifier("britt");
|
||||||
repos.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData = new LayeredDirectoryNodeBeanImpl(repos.getSuperRepository().issueID(),
|
fData = new LayeredDirectoryNodeBeanImpl(repos.getSuperRepository().issueID(),
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@@ -133,7 +131,6 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
attrs.setModDate(time);
|
attrs.setModDate(time);
|
||||||
attrs.setAccessDate(time);
|
attrs.setAccessDate(time);
|
||||||
attrs.setLastModifier("britt");
|
attrs.setLastModifier("britt");
|
||||||
repos.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData = new LayeredDirectoryNodeBeanImpl(repos.getSuperRepository().issueID(),
|
fData = new LayeredDirectoryNodeBeanImpl(repos.getSuperRepository().issueID(),
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@@ -172,7 +169,6 @@ public class LayeredDirectoryNode extends DirectoryNode implements Layered
|
|||||||
attrs.setAccessDate(time);
|
attrs.setAccessDate(time);
|
||||||
attrs.setCreator("britt");
|
attrs.setCreator("britt");
|
||||||
attrs.setLastModifier("britt");
|
attrs.setLastModifier("britt");
|
||||||
repo.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData = new LayeredDirectoryNodeBeanImpl(repo.getSuperRepository().issueID(),
|
fData = new LayeredDirectoryNodeBeanImpl(repo.getSuperRepository().issueID(),
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
|
@@ -59,7 +59,6 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
attrs.setAccessDate(time);
|
attrs.setAccessDate(time);
|
||||||
attrs.setCreator("britt");
|
attrs.setCreator("britt");
|
||||||
attrs.setLastModifier("britt");
|
attrs.setLastModifier("britt");
|
||||||
repo.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData =
|
fData =
|
||||||
new LayeredFileNodeBeanImpl(repo.getSuperRepository().issueID(),
|
new LayeredFileNodeBeanImpl(repo.getSuperRepository().issueID(),
|
||||||
-1L,
|
-1L,
|
||||||
@@ -97,7 +96,6 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
attrs.setAccessDate(time);
|
attrs.setAccessDate(time);
|
||||||
attrs.setCreator("britt");
|
attrs.setCreator("britt");
|
||||||
attrs.setLastModifier("britt");
|
attrs.setLastModifier("britt");
|
||||||
repos.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData =
|
fData =
|
||||||
new LayeredFileNodeBeanImpl(repos.getSuperRepository().issueID(),
|
new LayeredFileNodeBeanImpl(repos.getSuperRepository().issueID(),
|
||||||
-1L,
|
-1L,
|
||||||
@@ -126,7 +124,6 @@ public class LayeredFileNode extends FileNode implements Layered
|
|||||||
time,
|
time,
|
||||||
time,
|
time,
|
||||||
time);
|
time);
|
||||||
repo.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData = new LayeredFileNodeBeanImpl(repo.getSuperRepository().issueID(),
|
fData = new LayeredFileNodeBeanImpl(repo.getSuperRepository().issueID(),
|
||||||
-1L,
|
-1L,
|
||||||
-1L,
|
-1L,
|
||||||
|
@@ -53,7 +53,6 @@ public class PlainDirectoryNode extends DirectoryNode
|
|||||||
time,
|
time,
|
||||||
time,
|
time,
|
||||||
time);
|
time);
|
||||||
repo.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData = new PlainDirectoryNodeBeanImpl(repo.getSuperRepository().issueID(),
|
fData = new PlainDirectoryNodeBeanImpl(repo.getSuperRepository().issueID(),
|
||||||
repo.getLatestVersion(),
|
repo.getLatestVersion(),
|
||||||
0L,
|
0L,
|
||||||
@@ -95,7 +94,6 @@ public class PlainDirectoryNode extends DirectoryNode
|
|||||||
attrs.setAccessDate(time);
|
attrs.setAccessDate(time);
|
||||||
attrs.setCreator("britt");
|
attrs.setCreator("britt");
|
||||||
attrs.setLastModifier("britt");
|
attrs.setLastModifier("britt");
|
||||||
repos.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData = new PlainDirectoryNodeBeanImpl(repos.getSuperRepository().issueID(),
|
fData = new PlainDirectoryNodeBeanImpl(repos.getSuperRepository().issueID(),
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
|
@@ -58,7 +58,6 @@ public class PlainFileNode extends FileNode
|
|||||||
time,
|
time,
|
||||||
time,
|
time,
|
||||||
time);
|
time);
|
||||||
repos.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData = new PlainFileNodeBeanImpl(repos.getSuperRepository().issueID(),
|
fData = new PlainFileNodeBeanImpl(repos.getSuperRepository().issueID(),
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@@ -91,7 +90,6 @@ public class PlainFileNode extends FileNode
|
|||||||
attrs.setAccessDate(time);
|
attrs.setAccessDate(time);
|
||||||
attrs.setCreator("britt");
|
attrs.setCreator("britt");
|
||||||
attrs.setLastModifier("britt");
|
attrs.setLastModifier("britt");
|
||||||
repos.getSuperRepository().getSession().save(attrs);
|
|
||||||
fData = new PlainFileNodeBeanImpl(repos.getSuperRepository().issueID(),
|
fData = new PlainFileNodeBeanImpl(repos.getSuperRepository().issueID(),
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
|
@@ -19,8 +19,6 @@
|
|||||||
<version column="vers" name="vers" type="long"/>
|
<version column="vers" name="vers" type="long"/>
|
||||||
<!-- BasicAttributes are attributes that pretty much all AVMNodes will
|
<!-- BasicAttributes are attributes that pretty much all AVMNodes will
|
||||||
have. -->
|
have. -->
|
||||||
<many-to-one name="basicAttributes" column="basic_attrs"
|
|
||||||
class="BasicAttributesBeanImpl" unique="true" cascade="all"/>
|
|
||||||
<many-to-one name="ancestor" column="ancestor_id"
|
<many-to-one name="ancestor" column="ancestor_id"
|
||||||
class="AVMNodeBeanImpl"/>
|
class="AVMNodeBeanImpl"/>
|
||||||
<!-- Nothing does anything with this yet. We'll need it for
|
<!-- Nothing does anything with this yet. We'll need it for
|
||||||
@@ -46,6 +44,14 @@
|
|||||||
convenient one. -->
|
convenient one. -->
|
||||||
<property name="isNew" column="is_new" type="boolean"
|
<property name="isNew" column="is_new" type="boolean"
|
||||||
not-null="true"/>
|
not-null="true"/>
|
||||||
|
<component name="basicAttributes" class="BasicAttributesBeanImpl">
|
||||||
|
<property name="creator" type="string" not-null="true"/>
|
||||||
|
<property name="owner" type="string" not-null="true"/>
|
||||||
|
<property name="lastModifier" type="string" not-null="true"/>
|
||||||
|
<property name="createDate" type="long" not-null="true"/>
|
||||||
|
<property name="modDate" type="long" not-null="true"/>
|
||||||
|
<property name="accessDate" type="long" not-null="true"/>
|
||||||
|
</component>
|
||||||
<!-- Directories, two flavors. -->
|
<!-- Directories, two flavors. -->
|
||||||
<subclass name="DirectoryNodeBeanImpl"
|
<subclass name="DirectoryNodeBeanImpl"
|
||||||
proxy="DirectoryNodeBean"
|
proxy="DirectoryNodeBean"
|
||||||
@@ -136,21 +142,6 @@
|
|||||||
</subclass>
|
</subclass>
|
||||||
</subclass>
|
</subclass>
|
||||||
</class>
|
</class>
|
||||||
<!-- BasicAttributes are a glom of all the properties that (nearly) all filesystem like
|
|
||||||
nodes have. -->
|
|
||||||
<class name="BasicAttributesBeanImpl" proxy="BasicAttributesBean"
|
|
||||||
lazy="true" optimistic-lock="version" table="basic_attributes">
|
|
||||||
<id name="id" type="long">
|
|
||||||
<generator class="native"></generator>
|
|
||||||
</id>
|
|
||||||
<version column="vers" name="vers" type="long"/>
|
|
||||||
<property name="creator" type="string" not-null="true"/>
|
|
||||||
<property name="owner" type="string" not-null="true"/>
|
|
||||||
<property name="lastModifier" type="string" not-null="true"/>
|
|
||||||
<property name="createDate" type="long" not-null="true"/>
|
|
||||||
<property name="modDate" type="long" not-null="true"/>
|
|
||||||
<property name="accessDate" type="long" not-null="true"/>
|
|
||||||
</class>
|
|
||||||
<!-- Contents are objects to hang actual bytestreams off. They are explicitly reference
|
<!-- Contents are objects to hang actual bytestreams off. They are explicitly reference
|
||||||
counted. -->
|
counted. -->
|
||||||
<class table="contents" name="ContentBeanImpl" proxy="ContentBean"
|
<class table="contents" name="ContentBeanImpl" proxy="ContentBean"
|
||||||
|
@@ -9,28 +9,6 @@ package org.alfresco.repo.avm.hibernate;
|
|||||||
*/
|
*/
|
||||||
public interface BasicAttributesBean
|
public interface BasicAttributesBean
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Set the id.
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
public void setId(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the id.
|
|
||||||
* @return The id.
|
|
||||||
*/
|
|
||||||
public Long getId();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the version (for concurrency control.)
|
|
||||||
*/
|
|
||||||
public void setVers(long vers);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the version (for concurrency control.)
|
|
||||||
*/
|
|
||||||
public long getVers();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the creator of the node.
|
* Set the creator of the node.
|
||||||
* @param creator The creator to set.
|
* @param creator The creator to set.
|
||||||
|
@@ -10,16 +10,6 @@ package org.alfresco.repo.avm.hibernate;
|
|||||||
*/
|
*/
|
||||||
public class BasicAttributesBeanImpl implements BasicAttributesBean
|
public class BasicAttributesBeanImpl implements BasicAttributesBean
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The id.
|
|
||||||
*/
|
|
||||||
private Long fID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The version for concurrency control.
|
|
||||||
*/
|
|
||||||
private long fVers;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The creator.
|
* The creator.
|
||||||
*/
|
*/
|
||||||
@@ -50,22 +40,6 @@ public class BasicAttributesBeanImpl implements BasicAttributesBean
|
|||||||
*/
|
*/
|
||||||
private long fAccessDate;
|
private long fAccessDate;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#getId()
|
|
||||||
*/
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return fID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setId(java.lang.Long)
|
|
||||||
*/
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
fID = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
@@ -111,22 +85,6 @@ public class BasicAttributesBeanImpl implements BasicAttributesBean
|
|||||||
fAccessDate = accessDate;
|
fAccessDate = accessDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#getVers()
|
|
||||||
*/
|
|
||||||
public long getVers()
|
|
||||||
{
|
|
||||||
return fVers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setVers(long)
|
|
||||||
*/
|
|
||||||
public void setVers(long vers)
|
|
||||||
{
|
|
||||||
fVers = vers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setCreator(java.lang.String)
|
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setCreator(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -222,39 +180,4 @@ public class BasicAttributesBeanImpl implements BasicAttributesBean
|
|||||||
{
|
{
|
||||||
return fAccessDate;
|
return fAccessDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO This is probably wrong.
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (this == obj)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (fID == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof BasicAttributesBean))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return fID == ((BasicAttributesBean)obj).getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
if (fID == null)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return fID.hashCode();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@ import org.hibernate.Session;
|
|||||||
public class Issuer
|
public class Issuer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The name of this issuer. Used as the primary key in it's
|
* The name of this issuer. Used as the primary key in its
|
||||||
* mapping.
|
* mapping.
|
||||||
*/
|
*/
|
||||||
private String fName;
|
private String fName;
|
||||||
@@ -122,4 +122,30 @@ public class Issuer
|
|||||||
{
|
{
|
||||||
fVers = vers;
|
fVers = vers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Object#equals(java.lang.Object)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj)
|
||||||
|
{
|
||||||
|
if (this == obj)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof Issuer))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return fName.equals(((Issuer)obj).getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Object#hashCode()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return fName.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -87,8 +87,6 @@ public class AVMServiceImpl implements AVMService
|
|||||||
se.create(false, true);
|
se.create(false, true);
|
||||||
class HTxnCallback implements HibernateTxnCallback
|
class HTxnCallback implements HibernateTxnCallback
|
||||||
{
|
{
|
||||||
public InputStream in = null;
|
|
||||||
|
|
||||||
public void perform(Session session)
|
public void perform(Session session)
|
||||||
{
|
{
|
||||||
new Issuer("node", 0L, session);
|
new Issuer("node", 0L, session);
|
||||||
|
@@ -83,7 +83,6 @@ public class RepositoryImpl implements Repository
|
|||||||
time,
|
time,
|
||||||
time,
|
time,
|
||||||
time);
|
time);
|
||||||
superRepo.getSession().save(attrs);
|
|
||||||
PlainDirectoryNodeBean rootBean =
|
PlainDirectoryNodeBean rootBean =
|
||||||
new PlainDirectoryNodeBeanImpl(fSuper.issueID(),
|
new PlainDirectoryNodeBeanImpl(fSuper.issueID(),
|
||||||
fData.getNextVersionID(),
|
fData.getNextVersionID(),
|
||||||
|
Reference in New Issue
Block a user