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:
@@ -19,8 +19,6 @@
|
||||
<version column="vers" name="vers" type="long"/>
|
||||
<!-- BasicAttributes are attributes that pretty much all AVMNodes will
|
||||
have. -->
|
||||
<many-to-one name="basicAttributes" column="basic_attrs"
|
||||
class="BasicAttributesBeanImpl" unique="true" cascade="all"/>
|
||||
<many-to-one name="ancestor" column="ancestor_id"
|
||||
class="AVMNodeBeanImpl"/>
|
||||
<!-- Nothing does anything with this yet. We'll need it for
|
||||
@@ -46,6 +44,14 @@
|
||||
convenient one. -->
|
||||
<property name="isNew" column="is_new" type="boolean"
|
||||
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. -->
|
||||
<subclass name="DirectoryNodeBeanImpl"
|
||||
proxy="DirectoryNodeBean"
|
||||
@@ -136,21 +142,6 @@
|
||||
</subclass>
|
||||
</subclass>
|
||||
</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
|
||||
counted. -->
|
||||
<class table="contents" name="ContentBeanImpl" proxy="ContentBean"
|
||||
|
@@ -9,28 +9,6 @@ package org.alfresco.repo.avm.hibernate;
|
||||
*/
|
||||
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.
|
||||
* @param creator The creator to set.
|
||||
|
@@ -10,16 +10,6 @@ package org.alfresco.repo.avm.hibernate;
|
||||
*/
|
||||
public class BasicAttributesBeanImpl implements BasicAttributesBean
|
||||
{
|
||||
/**
|
||||
* The id.
|
||||
*/
|
||||
private Long fID;
|
||||
|
||||
/**
|
||||
* The version for concurrency control.
|
||||
*/
|
||||
private long fVers;
|
||||
|
||||
/**
|
||||
* The creator.
|
||||
*/
|
||||
@@ -50,22 +40,6 @@ public class BasicAttributesBeanImpl implements BasicAttributesBean
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -111,22 +85,6 @@ public class BasicAttributesBeanImpl implements BasicAttributesBean
|
||||
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)
|
||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setCreator(java.lang.String)
|
||||
*/
|
||||
@@ -222,39 +180,4 @@ public class BasicAttributesBeanImpl implements BasicAttributesBean
|
||||
{
|
||||
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
|
||||
{
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
private String fName;
|
||||
@@ -122,4 +122,30 @@ public class Issuer
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user