mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Renamed a few things. What used to be SuperRepository (kind of meaning free name
wasn't it) is now AVMRepository. What used to be Repository is now AVMStore as it more closely matches what is meant by a store in Alfresco. Many adjustments in ancillary class names, references, and comments followed. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3329 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -99,12 +99,12 @@
|
||||
<property name="refCount" column="ref_count" type="int"
|
||||
not-null="true"/>
|
||||
</class>
|
||||
<!-- A Repository is the what we used to call a virtual repository.
|
||||
Each Repository has it's own branch ids and layer ids but shares node ids
|
||||
<!-- A store is the what we used to call a virtual repository.
|
||||
Each store has it's own branch ids and layer ids but shares node ids
|
||||
with other repositories. The physical repository is structured this way
|
||||
for better scaling. -->
|
||||
<class table="repositories" name="RepositoryImpl"
|
||||
proxy="Repository" optimistic-lock="version">
|
||||
<class table="avm_repositories" name="AVMStoreImpl"
|
||||
proxy="AVMStore" optimistic-lock="version">
|
||||
<cache usage="read-write"/>
|
||||
<id name="name" column="name" type="string"/>
|
||||
<version name="vers" column="vers" type="long"/>
|
||||
@@ -112,7 +112,7 @@
|
||||
column="next_version_id" not-null="true"/>
|
||||
<property type="string" name="creator" column="creator" not-null="true"/>
|
||||
<property type="long" name="createDate" column="create_date" not-null="true"/>
|
||||
<!-- Every Repository has a root directory that is the current root directory. -->
|
||||
<!-- Every AVMStore has a root directory that is the current root directory. -->
|
||||
<!-- This should be not-null but hibernate (or my own idiocy) makes that difficult. -->
|
||||
<many-to-one name="root" class="DirectoryNodeImpl"
|
||||
column="current_root_id" unique="true" cascade="save-update">
|
||||
@@ -131,8 +131,8 @@
|
||||
<property name="creator" type="string" column="creator"
|
||||
not-null="true">
|
||||
</property>
|
||||
<many-to-one name="repository" column="repository_id"
|
||||
class="RepositoryImpl" not-null="true">
|
||||
<many-to-one name="avmStore" column="avm_store_id"
|
||||
class="AVMStoreImpl" not-null="true">
|
||||
</many-to-one>
|
||||
<many-to-one name="root" class="DirectoryNodeImpl"
|
||||
column="root_id" not-null="true">
|
||||
@@ -171,9 +171,9 @@
|
||||
<key-many-to-one name="mto" class="AVMNodeImpl" column="mto"/>
|
||||
</composite-id>
|
||||
</class>
|
||||
<class name="NewInRepositoryImpl" proxy="NewInRepository" table="new_in_repository_nodes">
|
||||
<class name="NewInAVMStoreImpl" proxy="NewInAVMStore" table="new_in_avm_store_nodes">
|
||||
<composite-id>
|
||||
<key-many-to-one name="repository" class="RepositoryImpl" column="repository_id"/>
|
||||
<key-many-to-one name="avmStore" class="AVMStoreImpl" column="avm_store_id"/>
|
||||
<key-many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
|
||||
</composite-id>
|
||||
</class>
|
||||
@@ -204,10 +204,10 @@
|
||||
where ce.parent = :parent
|
||||
]]>
|
||||
</query>
|
||||
<query name="AVMNode.ByNewInRepo">
|
||||
<query name="AVMNode.ByNewInAVMStore">
|
||||
<![CDATA[
|
||||
from NewInRepositoryImpl nie
|
||||
where nie.repository = :rep
|
||||
from NewInAVMStoreImpl nie
|
||||
where nie.avmStore = :store
|
||||
]]>
|
||||
</query>
|
||||
<query name="AVMNode.GetDescendents">
|
||||
@@ -241,14 +241,14 @@
|
||||
select v.root
|
||||
from VersionRootImpl v
|
||||
where
|
||||
v.repository = :rep and v.versionID = :version
|
||||
v.avmStore = :store and v.versionID = :version
|
||||
]]>
|
||||
</query>
|
||||
<query name="VersionRoot.VersionByID">
|
||||
<![CDATA[
|
||||
from VersionRootImpl v
|
||||
where
|
||||
v.repository = :rep and v.versionID = :version
|
||||
v.avmStore = :store and v.versionID = :version
|
||||
]]>
|
||||
</query>
|
||||
<query name="DeletedChild.ByNameParent">
|
||||
|
@@ -25,7 +25,7 @@ import org.alfresco.repo.avm.AVMNodeDAO;
|
||||
import org.alfresco.repo.avm.AVMNodeImpl;
|
||||
import org.alfresco.repo.avm.AVMNodeUnwrapper;
|
||||
import org.alfresco.repo.avm.DirectoryNode;
|
||||
import org.alfresco.repo.avm.Repository;
|
||||
import org.alfresco.repo.avm.AVMStore;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
@@ -81,15 +81,15 @@ public class AVMNodeDAOHibernate extends HibernateDaoSupport implements
|
||||
|
||||
/**
|
||||
* Get the root of a particular version.
|
||||
* @param rep The repository we're querying.
|
||||
* @param store The store we're querying.
|
||||
* @param version The version.
|
||||
* @return The VersionRoot or null.
|
||||
*/
|
||||
public DirectoryNode getRepositoryRoot(Repository rep, int version)
|
||||
public DirectoryNode getAVMStoreRoot(AVMStore store, int version)
|
||||
{
|
||||
Query query =
|
||||
getSession().getNamedQuery("VersionRoot.GetVersionRoot");
|
||||
query.setEntity("rep", rep);
|
||||
query.setEntity("store", store);
|
||||
query.setInteger("version", version);
|
||||
AVMNode root = (AVMNode)query.uniqueResult();
|
||||
if (root == null)
|
||||
@@ -136,19 +136,6 @@ public class AVMNodeDAOHibernate extends HibernateDaoSupport implements
|
||||
return (List<AVMNode>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all nodes that have the given repository as their owning repository.
|
||||
* @param rep The Repository.
|
||||
* @return An Iterator over the matching nodes.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<AVMNode> getByRepository(Repository rep)
|
||||
{
|
||||
Query query = getSession().createQuery("from AVMNodeImpl an where an.repository = :rep");
|
||||
query.setEntity("rep", rep);
|
||||
return (Iterator<AVMNode>)query.iterate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inappropriate hack to get Hibernate to play nice.
|
||||
*/
|
||||
|
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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.AVMStore;
|
||||
import org.alfresco.repo.avm.AVMStoreDAO;
|
||||
import org.alfresco.repo.avm.AVMStoreImpl;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
/**
|
||||
* The Hibernate version for AVMStoreDAO
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMStoreDAOHibernate extends HibernateDaoSupport implements
|
||||
AVMStoreDAO
|
||||
{
|
||||
/**
|
||||
* Do nothing constructor.
|
||||
*/
|
||||
public AVMStoreDAOHibernate()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a store, never before saved.
|
||||
* @param store The store
|
||||
*/
|
||||
public void save(AVMStore store)
|
||||
{
|
||||
getSession().save(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given AVMStore.
|
||||
* @param store The AVMStore.
|
||||
*/
|
||||
public void delete(AVMStore store)
|
||||
{
|
||||
getSession().delete(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all stores.
|
||||
* @return A List of all the AVMStores.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<AVMStore> getAll()
|
||||
{
|
||||
Query query = getSession().createQuery("from AVMStoreImpl r");
|
||||
return (List<AVMStore>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a store by name.
|
||||
* @param name The name of the store.
|
||||
* @return The store or null if not found.
|
||||
*/
|
||||
public AVMStore getByName(String name)
|
||||
{
|
||||
return (AVMStore)getSession().get(AVMStoreImpl.class, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given AVMStore record.
|
||||
* @param store The dirty AVMStore.
|
||||
*/
|
||||
public void update(AVMStore store)
|
||||
{
|
||||
// No op in Hibernate.
|
||||
}
|
||||
}
|
@@ -20,24 +20,24 @@ package org.alfresco.repo.avm.hibernate;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.avm.AVMNode;
|
||||
import org.alfresco.repo.avm.NewInRepository;
|
||||
import org.alfresco.repo.avm.NewInRepositoryDAO;
|
||||
import org.alfresco.repo.avm.Repository;
|
||||
import org.alfresco.repo.avm.NewInAVMStore;
|
||||
import org.alfresco.repo.avm.NewInAVMStoreDAO;
|
||||
import org.alfresco.repo.avm.AVMStore;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
/**
|
||||
* Hibernate implementation of NewInRepository DAO.
|
||||
* Hibernate implementation of NewInAVMStore DAO.
|
||||
* @author britt
|
||||
*/
|
||||
public class NewInRepositoryDAOHibernate extends HibernateDaoSupport implements
|
||||
NewInRepositoryDAO
|
||||
public class NewInAVMStoreDAOHibernate extends HibernateDaoSupport implements
|
||||
NewInAVMStoreDAO
|
||||
{
|
||||
/**
|
||||
* Save one.
|
||||
* @param newEntry The item to save.
|
||||
*/
|
||||
public void save(NewInRepository newEntry)
|
||||
public void save(NewInAVMStore newEntry)
|
||||
{
|
||||
getSession().save(newEntry);
|
||||
}
|
||||
@@ -47,31 +47,31 @@ public class NewInRepositoryDAOHibernate extends HibernateDaoSupport implements
|
||||
* @param node The node to lookup with.
|
||||
* @return The Entry or null if not found.
|
||||
*/
|
||||
public NewInRepository getByNode(AVMNode node)
|
||||
public NewInAVMStore getByNode(AVMNode node)
|
||||
{
|
||||
Query query = getSession().createQuery("from NewInRepositoryImpl nie where nie.node = :node");
|
||||
Query query = getSession().createQuery("from NewInAVMStoreImpl nie where nie.node = :node");
|
||||
query.setEntity("node", node);
|
||||
return (NewInRepository)query.uniqueResult();
|
||||
return (NewInAVMStore)query.uniqueResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all that are in the given repository.
|
||||
* @param repository The Repository.
|
||||
* @return A List of NewInRepositorys.
|
||||
* Get all that are in the given store.
|
||||
* @param store The AVMStore.
|
||||
* @return A List of NewInAVMStores.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<NewInRepository> getByRepository(Repository repository)
|
||||
public List<NewInAVMStore> getByAVMStore(AVMStore store)
|
||||
{
|
||||
Query query = getSession().createQuery("from NewInRepositoryImpl nie where nie.repository = :rep");
|
||||
query.setEntity("rep", repository);
|
||||
return (List<NewInRepository>)query.list();
|
||||
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(NewInRepository newEntry)
|
||||
public void delete(NewInAVMStore newEntry)
|
||||
{
|
||||
getSession().delete(newEntry);
|
||||
}
|
@@ -1,90 +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.Repository;
|
||||
import org.alfresco.repo.avm.RepositoryDAO;
|
||||
import org.alfresco.repo.avm.RepositoryImpl;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
/**
|
||||
* The Hibernate version for RepositoryDAO
|
||||
* @author britt
|
||||
*/
|
||||
public class RepositoryDAOHibernate extends HibernateDaoSupport implements
|
||||
RepositoryDAO
|
||||
{
|
||||
/**
|
||||
* Do nothing constructor.
|
||||
*/
|
||||
public RepositoryDAOHibernate()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a repository, never before saved.
|
||||
* @param rep The repository
|
||||
*/
|
||||
public void save(Repository rep)
|
||||
{
|
||||
getSession().save(rep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given Repository.
|
||||
* @param rep The Repository.
|
||||
*/
|
||||
public void delete(Repository rep)
|
||||
{
|
||||
getSession().delete(rep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all repositories.
|
||||
* @return A List of all the Repositories.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Repository> getAll()
|
||||
{
|
||||
Query query = getSession().createQuery("from RepositoryImpl r");
|
||||
return (List<Repository>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a repository by name.
|
||||
* @param name The name of the repository.
|
||||
* @return The repository or null if not found.
|
||||
*/
|
||||
public Repository getByName(String name)
|
||||
{
|
||||
return (Repository)getSession().get(RepositoryImpl.class, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given Repository record.
|
||||
* @param rep The dirty Repository.
|
||||
*/
|
||||
public void update(Repository rep)
|
||||
{
|
||||
// No op in Hibernate.
|
||||
}
|
||||
}
|
@@ -20,7 +20,7 @@ package org.alfresco.repo.avm.hibernate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.avm.Repository;
|
||||
import org.alfresco.repo.avm.AVMStore;
|
||||
import org.alfresco.repo.avm.VersionRoot;
|
||||
import org.alfresco.repo.avm.VersionRootDAO;
|
||||
import org.hibernate.Query;
|
||||
@@ -61,73 +61,70 @@ public class VersionRootDAOHibernate extends HibernateDaoSupport implements
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the version roots in a given repository.
|
||||
* @param rep The repository.
|
||||
* Get all the version roots in a given store.
|
||||
* @param store The store.
|
||||
* @return A List of VersionRoots. In id order.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<VersionRoot> getAllInRepository(Repository rep)
|
||||
public List<VersionRoot> getAllInAVMStore(AVMStore store)
|
||||
{
|
||||
Query query = getSession().createQuery("from VersionRootImpl v where v.repository = :rep order by v.versionID");
|
||||
query.setEntity("rep", rep);
|
||||
Query query = getSession().createQuery("from VersionRootImpl v where v.avmStore = :store order by v.versionID");
|
||||
query.setEntity("store", store);
|
||||
return (List<VersionRoot>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version of a repository by dates.
|
||||
* @param rep The repository.
|
||||
* Get the version of a store by dates.
|
||||
* @param store The store.
|
||||
* @param from The starting date. May be null but not with to null also.
|
||||
* @param to The ending date. May be null but not with from null also.
|
||||
* @return A List of VersionRoots.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<VersionRoot> getByDates(Repository rep, Date from, Date to)
|
||||
public List<VersionRoot> getByDates(AVMStore store, Date from, Date to)
|
||||
{
|
||||
Query query;
|
||||
if (from == null)
|
||||
{
|
||||
query =
|
||||
getSession().createQuery("from VersionRootImpl vr where vr.createDate <= :to " +
|
||||
"and vr.repository = :rep " +
|
||||
"and vr.avmStore = :store " +
|
||||
"order by vr.versionID");
|
||||
query.setLong("to", to.getTime());
|
||||
query.setEntity("rep", rep);
|
||||
}
|
||||
else if (to == null)
|
||||
{
|
||||
query =
|
||||
getSession().createQuery("from VersionRootImpl vr " +
|
||||
"where vr.createDate >= :from " +
|
||||
"and vr.repository = :rep " +
|
||||
"and vr.avmStore = :store " +
|
||||
"order by vr.versionID");
|
||||
query.setLong("from", from.getTime());
|
||||
query.setEntity("rep", rep);
|
||||
}
|
||||
else
|
||||
{
|
||||
query =
|
||||
getSession().createQuery("from VersionRootImpl vr "+
|
||||
"where vr.createDate between :from and :to " +
|
||||
"and vr.repository = :rep " +
|
||||
"and vr.avmStore = :store " +
|
||||
"order by vr.versionID");
|
||||
query.setLong("from", from.getTime());
|
||||
query.setLong("to", to.getTime());
|
||||
query.setEntity("rep", rep);
|
||||
}
|
||||
query.setEntity("rep", rep);
|
||||
query.setEntity("store", store);
|
||||
return (List<VersionRoot>)query.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VersionRoot corresponding to the given id.
|
||||
* @param rep The repository
|
||||
* @param store The store
|
||||
* @param id The version id.
|
||||
* @return The VersionRoot or null if not found.
|
||||
*/
|
||||
public VersionRoot getByVersionID(Repository rep, int id)
|
||||
public VersionRoot getByVersionID(AVMStore store, int id)
|
||||
{
|
||||
Query query = getSession().getNamedQuery("VersionRoot.VersionByID");
|
||||
query.setEntity("rep", rep);
|
||||
query.setEntity("store", store);
|
||||
query.setInteger("version", id);
|
||||
return (VersionRoot)query.uniqueResult();
|
||||
}
|
||||
@@ -137,7 +134,7 @@ public class VersionRootDAOHibernate extends HibernateDaoSupport implements
|
||||
* @param rep The repository.
|
||||
* @return The highest numbered version.
|
||||
*/
|
||||
public VersionRoot getMaxVersion(Repository rep)
|
||||
public VersionRoot getMaxVersion(AVMStore rep)
|
||||
{
|
||||
Query query = getSession().createQuery("from VersionRootImpl vr " +
|
||||
"where vr.versionID = " +
|
||||
|
Reference in New Issue
Block a user