mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -78,12 +78,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="newInAVMStoreDAO" class="org.alfresco.repo.avm.hibernate.NewInAVMStoreDAOHibernate">
|
|
||||||
<property name="sessionFactory">
|
|
||||||
<ref bean="sessionFactory"/>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="avmNodePropertyDAO" class="org.alfresco.repo.avm.hibernate.AVMNodePropertyDAOHibernate">
|
<bean id="avmNodePropertyDAO" class="org.alfresco.repo.avm.hibernate.AVMNodePropertyDAOHibernate">
|
||||||
<property name="sessionFactory">
|
<property name="sessionFactory">
|
||||||
<ref bean="sessionFactory"/>
|
<ref bean="sessionFactory"/>
|
||||||
@@ -127,9 +121,6 @@
|
|||||||
<property name="deletedChildDAO">
|
<property name="deletedChildDAO">
|
||||||
<ref bean="deletedChildDAO"/>
|
<ref bean="deletedChildDAO"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="newInAVMStoreDAO">
|
|
||||||
<ref bean="newInAVMStoreDAO"/>
|
|
||||||
</property>
|
|
||||||
<property name="avmNodePropertyDAO">
|
<property name="avmNodePropertyDAO">
|
||||||
<ref bean="avmNodePropertyDAO"/>
|
<ref bean="avmNodePropertyDAO"/>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -70,11 +70,6 @@ public class AVMContext implements ApplicationContextAware
|
|||||||
*/
|
*/
|
||||||
public DeletedChildDAO fDeletedChildDAO;
|
public DeletedChildDAO fDeletedChildDAO;
|
||||||
|
|
||||||
/**
|
|
||||||
* The NewInAVMStoreDAO
|
|
||||||
*/
|
|
||||||
public NewInAVMStoreDAO fNewInAVMStoreDAO;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The AVMNodePropertyDAO
|
* The AVMNodePropertyDAO
|
||||||
*/
|
*/
|
||||||
@@ -196,14 +191,6 @@ public class AVMContext implements ApplicationContextAware
|
|||||||
fIssuerDAO = issuerDAO;
|
fIssuerDAO = issuerDAO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param newInAVMStoreDAO The DAO to set.
|
|
||||||
*/
|
|
||||||
public void setNewInAVMStoreDAO(NewInAVMStoreDAO newInAVMStoreDAO)
|
|
||||||
{
|
|
||||||
fNewInAVMStoreDAO = newInAVMStoreDAO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAvmNodePropertyDAO(AVMNodePropertyDAO avmNodePropertyDAO)
|
public void setAvmNodePropertyDAO(AVMNodePropertyDAO avmNodePropertyDAO)
|
||||||
{
|
{
|
||||||
fAVMNodePropertyDAO = avmNodePropertyDAO;
|
fAVMNodePropertyDAO = avmNodePropertyDAO;
|
||||||
|
@@ -31,6 +31,7 @@ import org.alfresco.service.cmr.avm.AVMException;
|
|||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
||||||
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.springframework.dao.ConcurrencyFailureException;
|
import org.springframework.dao.ConcurrencyFailureException;
|
||||||
|
|
||||||
@@ -241,6 +242,10 @@ class AVMCrawler implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (e instanceof InvalidNodeRefException)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
throw new AVMException("Failure", e);
|
throw new AVMException("Failure", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -185,4 +185,16 @@ public interface AVMNode
|
|||||||
* @return The ACL on this node.
|
* @return The ACL on this node.
|
||||||
*/
|
*/
|
||||||
public DbAccessControlList getAcl();
|
public DbAccessControlList getAcl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the store that we are new in.
|
||||||
|
* @param store The store we are new in.
|
||||||
|
*/
|
||||||
|
public void setStoreNew(AVMStore store);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the possibly null store that we're new in.
|
||||||
|
* @return The store that we're new in.
|
||||||
|
*/
|
||||||
|
public AVMStore getStoreNew();
|
||||||
}
|
}
|
@@ -82,6 +82,13 @@ public interface AVMNodeDAO
|
|||||||
*/
|
*/
|
||||||
public List<String> getContentUrls();
|
public List<String> getContentUrls();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all the nodes that are new in the given store.
|
||||||
|
* @param store The store to query.
|
||||||
|
* @return A List of AVMNodes.
|
||||||
|
*/
|
||||||
|
public List<AVMNode> getNewInStore(AVMStore store);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inappropriate hack to get Hibernate to play nice.
|
* Inappropriate hack to get Hibernate to play nice.
|
||||||
*/
|
*/
|
||||||
|
@@ -62,6 +62,11 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
|||||||
*/
|
*/
|
||||||
private DbAccessControlList fACL;
|
private DbAccessControlList fACL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Store that we're new in.
|
||||||
|
*/
|
||||||
|
private AVMStore fStoreNew;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
@@ -93,6 +98,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
|||||||
time,
|
time,
|
||||||
time,
|
time,
|
||||||
time);
|
time);
|
||||||
|
fStoreNew = store;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -234,7 +240,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
|||||||
*/
|
*/
|
||||||
public boolean getIsNew()
|
public boolean getIsNew()
|
||||||
{
|
{
|
||||||
return AVMContext.fgInstance.fNewInAVMStoreDAO.getByNode(this) != null;
|
return fStoreNew != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -401,4 +407,22 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
|||||||
{
|
{
|
||||||
return fACL;
|
return fACL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the store we are new in.
|
||||||
|
* @param store The store we are new in.
|
||||||
|
*/
|
||||||
|
public void setStoreNew(AVMStore store)
|
||||||
|
{
|
||||||
|
fStoreNew = store;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the possibly null store we are new in.
|
||||||
|
* @return The store we are new in.
|
||||||
|
*/
|
||||||
|
public AVMStore getStoreNew()
|
||||||
|
{
|
||||||
|
return fStoreNew;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -186,8 +186,7 @@ public class AVMRepository
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
AVMStore rep = new AVMStoreImpl(this, name);
|
AVMStore rep = new AVMStoreImpl(this, name);
|
||||||
// Special handling for AVMStore creation.
|
// Special handling for AVMStore creation.
|
||||||
NewInAVMStore newInRep = AVMContext.fgInstance.fNewInAVMStoreDAO.getByNode(rep.getRoot());
|
rep.getRoot().setStoreNew(null);
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newInRep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -449,10 +448,10 @@ public class AVMRepository
|
|||||||
node.setIsRoot(false);
|
node.setIsRoot(false);
|
||||||
vrDAO.delete(vr);
|
vrDAO.delete(vr);
|
||||||
}
|
}
|
||||||
List<NewInAVMStore> newGuys = AVMContext.fgInstance.fNewInAVMStoreDAO.getByAVMStore(store);
|
List<AVMNode> newGuys = AVMContext.fgInstance.fAVMNodeDAO.getNewInStore(store);
|
||||||
for (NewInAVMStore newGuy : newGuys)
|
for (AVMNode newGuy : newGuys)
|
||||||
{
|
{
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newGuy);
|
newGuy.setStoreNew(null);
|
||||||
}
|
}
|
||||||
AVMContext.fgInstance.fAVMStorePropertyDAO.delete(store);
|
AVMContext.fgInstance.fAVMStorePropertyDAO.delete(store);
|
||||||
AVMContext.fgInstance.fAVMStoreDAO.delete(store);
|
AVMContext.fgInstance.fAVMStoreDAO.delete(store);
|
||||||
|
@@ -143,10 +143,10 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
throw new AVMExistsException("Already snapshotted.");
|
throw new AVMExistsException("Already snapshotted.");
|
||||||
}
|
}
|
||||||
// Clear out the new nodes.
|
// Clear out the new nodes.
|
||||||
List<NewInAVMStore> newInRep = AVMContext.fgInstance.fNewInAVMStoreDAO.getByAVMStore(this);
|
List<AVMNode> newInRep = AVMContext.fgInstance.fAVMNodeDAO.getNewInStore(this);
|
||||||
for (NewInAVMStore newGuy : newInRep)
|
for (AVMNode newGuy : newInRep)
|
||||||
{
|
{
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newGuy);
|
newGuy.setStoreNew(null);
|
||||||
}
|
}
|
||||||
// Make up a new version record.
|
// Make up a new version record.
|
||||||
VersionRoot versionRoot = new VersionRootImpl(this,
|
VersionRoot versionRoot = new VersionRootImpl(this,
|
||||||
|
@@ -28,6 +28,7 @@ import java.util.Map;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.service.cmr.avm.AVMCycleException;
|
import org.alfresco.service.cmr.avm.AVMCycleException;
|
||||||
import org.alfresco.service.cmr.avm.AVMException;
|
import org.alfresco.service.cmr.avm.AVMException;
|
||||||
import org.alfresco.service.cmr.avm.AVMExistsException;
|
import org.alfresco.service.cmr.avm.AVMExistsException;
|
||||||
@@ -35,6 +36,9 @@ import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
|||||||
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
import org.alfresco.service.cmr.avm.AVMWrongTypeException;
|
import org.alfresco.service.cmr.avm.AVMWrongTypeException;
|
||||||
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
|
import org.hibernate.HibernateException;
|
||||||
|
import org.springframework.dao.ConcurrencyFailureException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a Runnable which randomly performs operations on an AVM Repository.
|
* This is a Runnable which randomly performs operations on an AVM Repository.
|
||||||
@@ -266,16 +270,9 @@ class AVMTester implements Runnable
|
|||||||
out.close();
|
out.close();
|
||||||
addFile(appendPath(path, name));
|
addFile(appendPath(path, name));
|
||||||
}
|
}
|
||||||
catch (AVMException ae)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (ae instanceof AVMExistsException ||
|
handleException(e);
|
||||||
ae instanceof AVMNotFoundException ||
|
|
||||||
ae instanceof AVMWrongTypeException ||
|
|
||||||
ae instanceof AVMCycleException)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw ae;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,16 +286,9 @@ class AVMTester implements Runnable
|
|||||||
fService.createDirectory(path, name);
|
fService.createDirectory(path, name);
|
||||||
addDirectory(appendPath(path, name));
|
addDirectory(appendPath(path, name));
|
||||||
}
|
}
|
||||||
catch (AVMException ae)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (ae instanceof AVMExistsException ||
|
handleException(e);
|
||||||
ae instanceof AVMNotFoundException ||
|
|
||||||
ae instanceof AVMWrongTypeException ||
|
|
||||||
ae instanceof AVMCycleException)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw ae;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,16 +323,9 @@ class AVMTester implements Runnable
|
|||||||
addFile(appendPath(dstPath, name));
|
addFile(appendPath(dstPath, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (AVMException ae)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (ae instanceof AVMExistsException ||
|
handleException(e);
|
||||||
ae instanceof AVMNotFoundException ||
|
|
||||||
ae instanceof AVMWrongTypeException ||
|
|
||||||
ae instanceof AVMCycleException)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw ae;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,16 +340,9 @@ class AVMTester implements Runnable
|
|||||||
fService.createLayeredDirectory(target, path, name);
|
fService.createLayeredDirectory(target, path, name);
|
||||||
addDirectory(appendPath(path, name));
|
addDirectory(appendPath(path, name));
|
||||||
}
|
}
|
||||||
catch (AVMException ae)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (ae instanceof AVMExistsException ||
|
handleException(e);
|
||||||
ae instanceof AVMNotFoundException ||
|
|
||||||
ae instanceof AVMWrongTypeException ||
|
|
||||||
ae instanceof AVMCycleException)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw ae;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,16 +357,9 @@ class AVMTester implements Runnable
|
|||||||
fService.createLayeredFile(target, path, name);
|
fService.createLayeredFile(target, path, name);
|
||||||
addFile(appendPath(path, name));
|
addFile(appendPath(path, name));
|
||||||
}
|
}
|
||||||
catch (AVMException ae)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (ae instanceof AVMExistsException ||
|
handleException(e);
|
||||||
ae instanceof AVMNotFoundException ||
|
|
||||||
ae instanceof AVMWrongTypeException ||
|
|
||||||
ae instanceof AVMCycleException)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw ae;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,15 +379,9 @@ class AVMTester implements Runnable
|
|||||||
fService.removeNode(path, name);
|
fService.removeNode(path, name);
|
||||||
removePath(target);
|
removePath(target);
|
||||||
}
|
}
|
||||||
catch (AVMException e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (e instanceof AVMNotFoundException ||
|
handleException(e);
|
||||||
e instanceof AVMWrongTypeException ||
|
|
||||||
e instanceof AVMCycleException)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,15 +396,9 @@ class AVMTester implements Runnable
|
|||||||
out.println("I am " + path);
|
out.println("I am " + path);
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
catch (AVMException e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (e instanceof AVMNotFoundException ||
|
handleException(e);
|
||||||
e instanceof AVMWrongTypeException ||
|
|
||||||
e instanceof AVMCycleException)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,19 +414,9 @@ class AVMTester implements Runnable
|
|||||||
System.out.println(line);
|
System.out.println(line);
|
||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
catch (AVMException e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (e instanceof AVMNotFoundException ||
|
handleException(e);
|
||||||
e instanceof AVMWrongTypeException ||
|
|
||||||
e instanceof AVMCycleException)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
throw new AVMException("I/O Error.", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,15 +468,9 @@ class AVMTester implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (AVMException e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (e instanceof AVMNotFoundException ||
|
handleException(e);
|
||||||
e instanceof AVMWrongTypeException ||
|
|
||||||
e instanceof AVMCycleException)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,9 +481,9 @@ class AVMTester implements Runnable
|
|||||||
{
|
{
|
||||||
fService.createSnapshot("main");
|
fService.createSnapshot("main");
|
||||||
}
|
}
|
||||||
catch (AVMExistsException aee)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
// Do nothing. It's OK.
|
handleException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -628,4 +569,18 @@ class AVMTester implements Runnable
|
|||||||
{
|
{
|
||||||
return fgOpCount;
|
return fgOpCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleException(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
if (e instanceof AVMException ||
|
||||||
|
e instanceof AlfrescoRuntimeException ||
|
||||||
|
e instanceof ConcurrencyFailureException ||
|
||||||
|
e instanceof HibernateException ||
|
||||||
|
e instanceof InvalidNodeRefException)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new AVMException("Naughty Exception.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,6 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
fOpacity = false;
|
fOpacity = false;
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +113,6 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
AVMContext.fgInstance.fDeletedChildDAO.save(newDel);
|
AVMContext.fgInstance.fDeletedChildDAO.save(newDel);
|
||||||
}
|
}
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(repos, this));
|
|
||||||
copyProperties(other);
|
copyProperties(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +146,6 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
|
||||||
copyProperties(other);
|
copyProperties(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +169,6 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
fOpacity = false;
|
fOpacity = false;
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
|
||||||
copyProperties(dir);
|
copyProperties(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,7 +53,6 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
|
|||||||
fIndirection = other.getIndirection();
|
fIndirection = other.getIndirection();
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
|
||||||
copyProperties(other);
|
copyProperties(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +67,6 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
|
|||||||
fIndirection = indirection;
|
fIndirection = indirection;
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,37 +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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Eensy-weensy interface for tracking nodes that are new in a store.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public interface NewInAVMStore
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Get the AVMStore part.
|
|
||||||
* @return The AVMStore
|
|
||||||
*/
|
|
||||||
public AVMStore getAvmStore();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the node part.
|
|
||||||
* @return The AVMNode.
|
|
||||||
*/
|
|
||||||
public AVMNode getNode();
|
|
||||||
}
|
|
@@ -1,53 +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;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DAO for NewInAVMStore markers.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public interface NewInAVMStoreDAO
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Save one.
|
|
||||||
* @param newEntry The item to save.
|
|
||||||
*/
|
|
||||||
public void save(NewInAVMStore 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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all that are in the given store.
|
|
||||||
* @param store The AVMStore.
|
|
||||||
* @return A List of NewInAVMStores.
|
|
||||||
*/
|
|
||||||
public List<NewInAVMStore> getByAVMStore(AVMStore store);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete the given entry.
|
|
||||||
* @param newEntry The entry to delete.
|
|
||||||
*/
|
|
||||||
public void delete(NewInAVMStore newEntry);
|
|
||||||
}
|
|
@@ -1,135 +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;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A record of a node that is new and in which store it resides.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
class NewInAVMStoreImpl implements NewInAVMStore, Serializable
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1905996612150732182L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Primary Key.
|
|
||||||
*/
|
|
||||||
private Long fID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The AVMStore.
|
|
||||||
*/
|
|
||||||
private AVMStore fAVMStore;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Node.
|
|
||||||
*/
|
|
||||||
private AVMNode fNode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor.
|
|
||||||
*/
|
|
||||||
public NewInAVMStoreImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a new one.
|
|
||||||
* @param store The store.
|
|
||||||
* @param node The AVMNode that is new.
|
|
||||||
*/
|
|
||||||
public NewInAVMStoreImpl(AVMStore store, AVMNode node)
|
|
||||||
{
|
|
||||||
fAVMStore = store;
|
|
||||||
fNode = node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the fNode
|
|
||||||
*/
|
|
||||||
public AVMNode getNode()
|
|
||||||
{
|
|
||||||
return fNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param node the fNode to set
|
|
||||||
*/
|
|
||||||
public void setNode(AVMNode node)
|
|
||||||
{
|
|
||||||
fNode = node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the store
|
|
||||||
*/
|
|
||||||
public AVMStore getAvmStore()
|
|
||||||
{
|
|
||||||
return fAVMStore;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param store the AVMStore to set
|
|
||||||
*/
|
|
||||||
public void setAvmStore(AVMStore store)
|
|
||||||
{
|
|
||||||
fAVMStore = store;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the primary key. (For Hibernate)
|
|
||||||
* @param id The primary key.
|
|
||||||
*/
|
|
||||||
protected void setId(Long id)
|
|
||||||
{
|
|
||||||
fID = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the primary key. (For Hibernate)
|
|
||||||
* @return The primary key.
|
|
||||||
*/
|
|
||||||
protected Long getId()
|
|
||||||
{
|
|
||||||
return fID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object other)
|
|
||||||
{
|
|
||||||
if (this == other)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(other instanceof NewInAVMStore))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
NewInAVMStore o = (NewInAVMStore)other;
|
|
||||||
return fAVMStore.equals(o.getAvmStore()) &&
|
|
||||||
fNode.equals(o.getNode());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return fAVMStore.hashCode() + fNode.hashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@@ -275,11 +275,6 @@ public class OrphanReaper implements Runnable
|
|||||||
link.getMto().setMergedFrom(ancestor);
|
link.getMto().setMergedFrom(ancestor);
|
||||||
AVMContext.fgInstance.fMergeLinkDAO.delete(link);
|
AVMContext.fgInstance.fMergeLinkDAO.delete(link);
|
||||||
}
|
}
|
||||||
NewInAVMStore newInRep = AVMContext.fgInstance.fNewInAVMStoreDAO.getByNode(node);
|
|
||||||
if (newInRep != null)
|
|
||||||
{
|
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.delete(newInRep);
|
|
||||||
}
|
|
||||||
// Get rid of all properties belonging to this node.
|
// Get rid of all properties belonging to this node.
|
||||||
AVMContext.fgInstance.fAVMNodePropertyDAO.deleteAll(node);
|
AVMContext.fgInstance.fAVMNodePropertyDAO.deleteAll(node);
|
||||||
// Get rid of all aspects belonging to this node.
|
// Get rid of all aspects belonging to this node.
|
||||||
|
@@ -44,7 +44,6 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
super(store.getAVMRepository().issueID(), store);
|
super(store.getAVMRepository().issueID(), store);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,7 +72,6 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
AVMContext.fgInstance.fChildEntryDAO.save(newChild);
|
AVMContext.fgInstance.fChildEntryDAO.save(newChild);
|
||||||
}
|
}
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
|
||||||
copyProperties(other);
|
copyProperties(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,7 +73,6 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
|||||||
// AVMContext.fgInstance.fAVMNodeDAO.flush();
|
// AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,7 +89,6 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
|||||||
setContentData(other.getContentData(null));
|
setContentData(other.getContentData(null));
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
|
||||||
copyProperties(other);
|
copyProperties(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +110,6 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
|||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
this.setProperties(props);
|
this.setProperties(props);
|
||||||
AVMContext.fgInstance.fNewInAVMStoreDAO.save(new NewInAVMStoreImpl(store, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
<property name="accessDate" type="long" not-null="true"/>
|
<property name="accessDate" type="long" not-null="true"/>
|
||||||
</component>
|
</component>
|
||||||
<property name="isRoot" column="is_root" type="boolean"/>
|
<property name="isRoot" column="is_root" type="boolean"/>
|
||||||
|
<many-to-one name="storeNew" class="AVMStoreImpl" column="store_new_id"/>
|
||||||
<!-- ACL -->
|
<!-- ACL -->
|
||||||
<many-to-one name="acl" column="acl_id"
|
<many-to-one name="acl" column="acl_id"
|
||||||
class="org.alfresco.repo.domain.hibernate.DbAccessControlListImpl"/>
|
class="org.alfresco.repo.domain.hibernate.DbAccessControlListImpl"/>
|
||||||
@@ -161,14 +162,6 @@
|
|||||||
<key-many-to-one name="mto" class="AVMNodeImpl" column="mto"/>
|
<key-many-to-one name="mto" class="AVMNodeImpl" column="mto"/>
|
||||||
</composite-id>
|
</composite-id>
|
||||||
</class>
|
</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">
|
<class name="AVMNodePropertyImpl" proxy="AVMNodeProperty" table="avm_node_properties">
|
||||||
<id name="id" column="id" type="long">
|
<id name="id" column="id" type="long">
|
||||||
<generator class="native"/>
|
<generator class="native"/>
|
||||||
@@ -240,10 +233,10 @@
|
|||||||
where ce.parent = :parent
|
where ce.parent = :parent
|
||||||
]]>
|
]]>
|
||||||
</query>
|
</query>
|
||||||
<query name="AVMNode.ByNewInAVMStore">
|
<query name="AVMNode.GetNewInStore">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
from NewInAVMStoreImpl nie
|
from AVMNodeImpl an
|
||||||
where nie.avmStore = :store
|
where an.storeNew = :store
|
||||||
]]>
|
]]>
|
||||||
</query>
|
</query>
|
||||||
<query name="AVMNode.GetDescendents">
|
<query name="AVMNode.GetDescendents">
|
||||||
|
@@ -146,6 +146,19 @@ class AVMNodeDAOHibernate extends HibernateDaoSupport implements
|
|||||||
return (List<String>)query.list();
|
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.
|
* Inappropriate hack to get Hibernate to play nice.
|
||||||
*/
|
*/
|
||||||
|
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user