Got rid of the NewInAVMStore table by folding it into the AVMNode

table.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3665 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-09-03 22:39:35 +00:00
parent 0b58cca272
commit c03b967e71
20 changed files with 111 additions and 444 deletions

View File

@@ -41,6 +41,7 @@
<property name="accessDate" type="long" not-null="true"/>
</component>
<property name="isRoot" column="is_root" type="boolean"/>
<many-to-one name="storeNew" class="AVMStoreImpl" column="store_new_id"/>
<!-- ACL -->
<many-to-one name="acl" column="acl_id"
class="org.alfresco.repo.domain.hibernate.DbAccessControlListImpl"/>
@@ -161,14 +162,6 @@
<key-many-to-one name="mto" class="AVMNodeImpl" column="mto"/>
</composite-id>
</class>
<class name="NewInAVMStoreImpl" proxy="NewInAVMStore" table="new_in_avm_store_nodes">
<cache usage="read-write"/>
<id name="id" column="id" type="long">
<generator class="native"/>
</id>
<many-to-one name="avmStore" class="AVMStoreImpl" column="avm_store_id"/>
<many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
</class>
<class name="AVMNodePropertyImpl" proxy="AVMNodeProperty" table="avm_node_properties">
<id name="id" column="id" type="long">
<generator class="native"/>
@@ -240,10 +233,10 @@
where ce.parent = :parent
]]>
</query>
<query name="AVMNode.ByNewInAVMStore">
<query name="AVMNode.GetNewInStore">
<![CDATA[
from NewInAVMStoreImpl nie
where nie.avmStore = :store
from AVMNodeImpl an
where an.storeNew = :store
]]>
</query>
<query name="AVMNode.GetDescendents">

View File

@@ -146,6 +146,19 @@ class AVMNodeDAOHibernate extends HibernateDaoSupport implements
return (List<String>)query.list();
}
/**
* Get all AVMNodes that are new in the given store.
* @param store The given store.
* @return A List of AVMNodes.
*/
@SuppressWarnings("unchecked")
public List<AVMNode> getNewInStore(AVMStore store)
{
Query query = getSession().getNamedQuery("AVMNode.GetNewInStore");
query.setEntity("store", store);
return (List<AVMNode>)query.list();
}
/**
* Inappropriate hack to get Hibernate to play nice.
*/

View File

@@ -1,78 +0,0 @@
/*
* Copyright (C) 2006 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.repo.avm.hibernate;
import java.util.List;
import org.alfresco.repo.avm.AVMNode;
import org.alfresco.repo.avm.AVMStore;
import org.alfresco.repo.avm.NewInAVMStore;
import org.alfresco.repo.avm.NewInAVMStoreDAO;
import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* Hibernate implementation of NewInAVMStore DAO.
* @author britt
*/
class NewInAVMStoreDAOHibernate extends HibernateDaoSupport implements
NewInAVMStoreDAO
{
/**
* Save one.
* @param newEntry The item to save.
*/
public void save(NewInAVMStore newEntry)
{
getSession().save(newEntry);
}
/**
* Get one by Node.
* @param node The node to lookup with.
* @return The Entry or null if not found.
*/
public NewInAVMStore getByNode(AVMNode node)
{
Query query = getSession().createQuery("from NewInAVMStoreImpl nie where nie.node = :node");
query.setEntity("node", node);
return (NewInAVMStore)query.uniqueResult();
}
/**
* Get all that are in the given store.
* @param store The AVMStore.
* @return A List of NewInAVMStores.
*/
@SuppressWarnings("unchecked")
public List<NewInAVMStore> getByAVMStore(AVMStore store)
{
Query query = getSession().createQuery("from NewInAVMStoreImpl nie where nie.avmStore = :store");
query.setEntity("store", store);
return (List<NewInAVMStore>)query.list();
}
/**
* Delete the given entry.
* @param newEntry The entry to delete.
*/
public void delete(NewInAVMStore newEntry)
{
getSession().delete(newEntry);
}
}